From 61070c9c6b665fdea79b3ccdfeafc3a6b50d262e Mon Sep 17 00:00:00 2001 From: Avi Ziv Date: Wed, 26 Jul 2017 17:37:57 +0300 Subject: [PATCH] [SDC] Full OnBoard health-check and NFoD support Change-Id: I606f8a52c7e6d2bd5558f824957d890e552c5423 Signed-off-by: Avi Ziv --- common/pom.xml | 10 - onboarding/pom.xml | 3 +- .../pom.xml.versionsBackup | 143 -------- .../pom.xml.versionsBackup | 36 -- .../action-library-rest/pom.xml.versionsBackup | 22 -- .../pom.xml.versionsBackup | 63 ---- .../pom.xml.versionsBackup | 18 - .../application-config-rest/pom.xml.versionsBackup | 24 -- .../onboarding-rest-war/pom.xml.versionsBackup | 226 ------------- .../pom.xml.versionsBackup | 44 --- .../pom.xml.versionsBackup | 28 -- .../sequence-rest/pom.xml.versionsBackup | 15 - .../validation-rest/pom.xml.versionsBackup | 21 -- .../pom.xml.versionsBackup | 152 --------- .../validation-rest-types/pom.xml.versionsBackup | 30 -- .../vendor-license-rest/pom.xml.versionsBackup | 23 -- .../pom.xml.versionsBackup | 135 -------- ...lementPoolEntityToEntitlementPoolEntityDto.java | 8 +- ...ementPoolRequestDtoToEntitlementPoolEntity.java | 9 +- ...seKeyGroupEntityToLicenseKeyGroupEntityDto.java | 5 + ...eKeyGroupRequestDtoToLicenseKeyGroupEntity.java | 5 + .../rest/services/FeatureGroupsImpl.java | 1 + .../pom.xml.versionsBackup | 29 -- .../types/EntitlementPoolRequestDto.java | 46 +-- .../types/FeatureGroupDescriptorDto.java | 2 +- .../types/LicenseKeyGroupRequestDto.java | 51 +++ .../pom.xml.versionsBackup | 21 -- .../pom.xml.versionsBackup | 153 --------- .../OrchestrationTemplateCandidateImpl.java | 8 + .../rest/services/VendorSoftwareProductsImpl.java | 29 +- .../pom.xml.versionsBackup | 30 -- .../types/ComputeDetailsDto.java | 1 - .../types/DeploymentFlavorRequestDto.java | 1 - .../types/ImageRequestDto.java | 1 - .../types/NicRequestDto.java | 1 - openecomp-be/api/pom.xml.versionsBackup | 21 -- .../pom.xml.versionsBackup | 76 ----- .../pom.xml.versionsBackup | 36 -- .../openecomp-sdc-healthcheck-manager/pom.xml | 2 +- .../pom.xml.versionsBackup | 78 ----- .../pom.xml.versionsBackup | 77 ----- .../impl/VendorLicenseManagerImpl.java | 106 +++--- .../sdc/vendorlicense/EntitlementPoolTest.java | 6 - .../sdc/vendorlicense/LicenseKeyGroupTest.java | 199 ++++++++++- .../vendorlicense/VendorLicenseFacadeImplTest.java | 144 +++++--- .../VSPPackage.zip | Bin 33617 -> 0 bytes .../pom.xml.versionsBackup | 159 --------- .../errors/ComputeErrorBuilder.java | 25 ++ .../errors/DeploymentFlavorErrorBuilder.java | 10 + .../errors/ImageErrorBuilder.java | 27 +- .../errors/NicErrorBuilder.java | 27 ++ .../impl/ComputeManagerImpl.java | 47 ++- .../impl/DeploymentFlavorManagerImpl.java | 27 +- .../impl/ImageManagerImpl.java | 35 +- .../impl/ManualVspToscaManagerImpl.java | 22 +- .../vendorsoftwareproduct/impl/NicManagerImpl.java | 35 +- .../OrchestrationTemplateCandidateManagerImpl.java | 38 ++- .../impl/VendorSoftwareProductManagerImpl.java | 21 ++ .../impl/ComputeManagerImplTest.java | 54 ++- .../impl/DeplomentFlavorManagerImplTest.java | 68 +++- .../impl/ImageManagerImplTest.java | 59 +++- .../impl/ManualVspToscaManagerImplTest.java | 156 ++++++--- .../impl/NicManagerImplTest.java | 61 +++- openecomp-be/backend/pom.xml.versionsBackup | 26 -- openecomp-be/configuration/pom.xml.versionsBackup | 17 - openecomp-be/lib/openecomp-common-lib/pom.xml | 10 - .../openecomp-common-lib/pom.xml.versionsBackup | 44 --- .../openecomp-config-lib/pom.xml.versionsBackup | 36 -- .../openecomp-facade-api/pom.xml.versionsBackup | 35 -- .../openecomp-facade-core/pom.xml.versionsBackup | 41 --- .../openecomp-facade-lib/pom.xml.versionsBackup | 34 -- .../openecomp-nosqldb-api/pom.xml.versionsBackup | 45 --- .../openecomp-nosqldb-core/pom.xml.versionsBackup | 46 --- .../openecomp-nosqldb-lib/pom.xml.versionsBackup | 35 -- .../openecomp-utilities-lib/pom.xml.versionsBackup | 83 ----- .../lib/openecomp-core-lib/pom.xml.versionsBackup | 22 -- .../pom.xml.versionsBackup | 35 -- .../pom.xml.versionsBackup | 35 -- .../pom.xml.versionsBackup | 36 -- .../healers/ComponentQuestionnaireHealer.java | 175 ++++++++-- .../sdc/healing/healers/CompositionDataHealer.java | 8 +- .../sdc/healing/healers/VlmVersionHealer.java | 7 + .../openecomp-healing-lib/pom.xml.versionsBackup | 23 -- .../lib/openecomp-heat-lib/pom.xml.versionsBackup | 50 --- .../pom.xml.versionsBackup | 57 ---- .../sdc/logging/messages/AuditMessages.java | 16 +- .../pom.xml.versionsBackup | 58 ---- .../openecomp-logging-lib/pom.xml.versionsBackup | 24 -- .../openecomp-migration-lib/pom.xml.versionsBackup | 151 --------- .../pom.xml.versionsBackup | 47 --- .../openecomp/sdc/healthcheck/dao/ActionDao.java | 2 +- .../pom.xml.versionsBackup | 30 -- .../pom.xml.versionsBackup | 23 -- .../pom.xml.versionsBackup | 39 --- .../pom.xml.versionsBackup | 45 --- .../pom.xml.versionsBackup | 94 ------ .../pom.xml.versionsBackup | 127 ------- .../pom.xml.versionsBackup | 44 --- .../openecomp-sdc-model-api/pom.xml.versionsBackup | 51 --- .../pom.xml.versionsBackup | 56 ---- .../pom.xml.versionsBackup | 49 --- .../openecomp-sdc-model-lib/pom.xml.versionsBackup | 44 --- .../openecomp-sdc-tosca-generator-api/pom.xml | 2 +- .../generator/datatypes/tosca/VspModelInfo.java | 75 +++++ .../sdc/generator/util/GeneratorConstants.java | 5 +- .../services/ManualVspToscaGenerationService.java | 71 ++-- .../sdc/generator/core/utils/GeneratorUtils.java | 4 +- .../att-sdc-translator-impl/pom.xml.versionsBackup | 70 ---- .../pom.xml.versionsBackup | 68 ---- .../pom.xml.versionsBackup | 75 ----- .../pom.xml.versionsBackup | 68 ---- .../pom.xml.versionsBackup | 45 --- .../pom.xml.versionsBackup | 26 -- .../att-sdc-validation-impl/pom.xml.versionsBackup | 92 ------ .../pom.xml.versionsBackup | 49 --- .../pom.xml.versionsBackup | 110 ------- .../pom.xml.versionsBackup | 103 ------ ...vaServerNamingConventionGuideLineValidator.java | 4 +- .../pom.xml.versionsBackup | 42 --- .../pom.xml.versionsBackup | 24 -- .../pom.xml.versionsBackup | 55 ---- .../dao/types/EntitlementPoolEntity.java | 137 ++------ .../dao/types/LicenseKeyGroupEntity.java | 92 +++++- .../dao/types/xml/OperationalScopeForXml.java | 38 +++ .../vendorlicense/facade/VendorLicenseFacade.java | 3 + .../pom.xml.versionsBackup | 53 --- .../zusammen/EntitlementPoolZusammenDaoImpl.java | 36 +- .../zusammen/LicenseKeyGroupZusammenDaoImpl.java | 33 +- .../facade/impl/VendorLicenseFacadeImpl.java | 110 ++++--- .../impl/VendorLicenseArtifactsServiceImpl.java | 42 ++- ...itlementPoolEntityForVendorLicenseArtifact.java | 10 +- .../MixinEntitlementPoolEntityForVnfArtifact.java | 10 +- .../impl/types/mixins/MixinFeatureGroupModel.java | 6 +- ...enseKeyGroupEntityForVendorLicenseArtifact.java | 23 +- .../MixinLicenseKeyGroupEntityForVnfArtifact.java | 24 +- .../pom.xml.versionsBackup | 23 -- .../pom.xml.versionsBackup | 67 ---- .../VendorSoftwareProductConstants.java | 2 +- .../composition/CompositionEntityDataManager.java | 2 - .../pom.xml | 10 + .../pom.xml.versionsBackup | 108 ------ .../errors/VendorSoftwareProductErrorCodes.java | 5 + .../services}/ManualVspDataCollectionService.java | 189 +++++------ .../composition/CompositionDataExtractorImpl.java | 12 +- .../CompositionEntityDataManagerImpl.java | 35 -- .../pom.xml.versionsBackup | 22 -- .../pom.xml.versionsBackup | 75 ----- .../pom.xml.versionsBackup | 54 --- .../pom.xml.versionsBackup | 24 -- .../lib/openecomp-tosca-lib/pom.xml.versionsBackup | 87 ----- .../sdc/tosca/datatypes/ToscaNodeType.java | 2 +- openecomp-be/lib/pom.xml.versionsBackup | 33 -- .../schemaTemplates/questionnaire/compute.ftl | 10 +- .../convertors/EntitlementPoolConvertor.java | 7 +- openecomp-be/tools/migration/cassandra2zusammen.sh | 7 +- .../core/tools/Commands/ExportDataCommand.java | 18 +- .../tools/Commands/exportdata/ElementHandler.java | 25 +- .../tools/Commands/exportdata/ItemHandler.java | 44 ++- .../tools/Commands/exportdata/VersionHandler.java | 9 +- .../tools/Commands/importdata/ElementImport.java | 50 ++- .../core/tools/Commands/importdata/ItemImport.java | 3 + .../core/tools/Commands/importdata/TreeWalker.java | 11 +- .../org/openecomp/core/tools/util/ZipUtils.java | 44 ++- .../zusammen-tools/src/main/resources/logback.xml | 281 +--------------- openecomp-ui/.gitignore | 3 + openecomp-ui/devConfig.defaults.json | 2 +- openecomp-ui/package.json | 9 +- openecomp-ui/proxy-server.js | 92 ------ openecomp-ui/resources/scss/_modules.scss | 1 + .../resources/scss/bootstrap-cust/_modals.scss | 1 + openecomp-ui/resources/scss/common/_utils.scss | 21 +- .../resources/scss/components/_datepicker.scss | 34 +- .../resources/scss/components/_dualListBox.scss | 3 +- .../resources/scss/components/_notifications.scss | 6 + .../scss/components/_selectActionTable.scss | 11 +- .../resources/scss/components/_validationForm.scss | 6 +- .../resources/scss/modules/_entitlementPools.scss | 28 +- .../resources/scss/modules/_featureGroup.scss | 8 + .../resources/scss/modules/_licenseKeyGroup.scss | 20 -- .../resources/scss/modules/_licenseModel.scss | 61 +++- .../scss/modules/_licenseModelLimits.scss | 121 +++++++ .../scss/modules/_licenseModelOverview.scss | 366 +++++++++++---------- .../modules/onboardingCatalog/_catalogTile.scss | 8 +- .../modules/onboardingCatalog/_vendorTile.scss | 5 +- openecomp-ui/resources/scss/onboarding.scss | 110 ++++--- openecomp-ui/runLocalFE.cmd | 38 --- openecomp-ui/runLocalFE.js | 104 ------ openecomp-ui/src/index.html | 2 +- .../src/nfvo-components/datepicker/Datepicker.jsx | 8 +- .../input/validation/InputOptions.jsx | 3 +- .../src/nfvo-components/input/validation/Tabs.jsx | 17 +- .../listEditor/ListEditorItemView.jsx | 2 +- .../VersionControllerConstants.js | 2 +- .../nfvo-components/table/SelectActionTable.jsx | 2 +- .../nfvo-components/table/SelectActionTableRow.jsx | 4 +- openecomp-ui/src/nfvo-utils/Validator.js | 5 +- openecomp-ui/src/nfvo-utils/getValue.js | 32 ++ .../sdc-app/common/reducers/PlainDataReducer.js | 7 + .../sdc-app/onboarding/OnboardingActionHelper.js | 19 +- .../src/sdc-app/onboarding/OnboardingPunchOut.jsx | 16 +- .../licenseModel/LicenseModelConstants.js | 14 + .../onboarding/licenseModel/LicenseModelReducer.js | 2 + .../licenseModel/LicenseModelValidations.js | 41 +++ .../licenseModel/creation/LicenseModelCreation.js | 2 +- .../EntitlementPoolsActionHelper.js | 84 ++++- .../entitlementPools/EntitlementPoolsConstants.js | 17 +- .../entitlementPools/EntitlementPoolsEditor.js | 17 +- .../EntitlementPoolsEditorReducer.js | 36 +- .../EntitlementPoolsEditorView.jsx | 346 +++++++++---------- .../entitlementPools/EntitlementPoolsLimits.js | 56 ++++ .../entitlementPools/EntitlementPoolsListEditor.js | 2 +- .../EntitlementPoolsListEditorView.jsx | 15 +- .../featureGroups/FeatureGroupEditor.js | 2 +- .../featureGroups/FeatureGroupEditorView.jsx | 36 +- .../featureGroups/FeatureGroupListEditorView.jsx | 14 +- .../featureGroups/FeatureGroupsActionHelper.js | 2 + .../featureGroups/FeatureGroupsEditorReducer.js | 8 +- .../licenseAgreement/LicenseAgreementConstants.js | 2 +- .../licenseAgreement/LicenseAgreementEditor.js | 2 +- .../LicenseAgreementEditorReducer.js | 4 +- .../LicenseAgreementEditorView.jsx | 13 +- .../LicenseAgreementListEditorView.jsx | 2 +- .../LicenseKeyGroupsActionHelper.js | 88 ++++- .../licenseKeyGroups/LicenseKeyGroupsConstants.js | 10 +- .../licenseKeyGroups/LicenseKeyGroupsEditor.js | 16 +- .../LicenseKeyGroupsEditorReducer.js | 44 ++- .../LicenseKeyGroupsEditorView.jsx | 254 +++++++++++--- .../licenseKeyGroups/LicenseKeyGroupsLimits.js | 57 ++++ .../licenseKeyGroups/LicenseKeyGroupsListEditor.js | 2 +- .../LicenseKeyGroupsListEditorView.jsx | 14 +- .../onboarding/licenseModel/limits/LimitEditor.js | 25 ++ .../onboarding/licenseModel/limits/LimitEditor.jsx | 193 +++++++++++ .../limits/LimitEditorActionHelper.js} | 24 +- .../licenseModel/limits/LimitEditorConstants.js | 52 +++ .../licenseModel/limits/LimitEditorReducer.js | 70 ++++ .../onboarding/licenseModel/limits/Limits.jsx | 108 ++++++ .../onboarding/licenseModel/limits/LimitsServer.js | 46 +++ .../overview/LicenseModelOverviewConstants.js | 8 +- .../overview/LicenseModelOverviewView.jsx | 7 +- .../licenseModel/overview/VLMListView.jsx | 10 +- .../overview/listItems/EntitlementPool.jsx | 24 +- .../overview/listItems/FeatureGroup.jsx | 23 +- .../overview/listItems/LicenseAgreement.jsx | 15 +- .../overview/listItems/LicenseKeyGroup.jsx | 12 +- .../listItems/listItemsComponents/IconCol.jsx | 4 +- .../licenseModel/overview/summary/ListButtons.jsx | 29 +- .../overview/summary/VendorDataView.js | 35 +- .../onboarding/onboard/CatalogItemDetails.jsx | 2 +- .../onboarding/softwareProduct/SoftwareProduct.js | 12 +- .../softwareProduct/SoftwareProductActionHelper.js | 3 +- .../softwareProduct/SoftwareProductReducer.js | 2 - .../attachments/setup/HeatSetupActionHelper.js | 12 +- .../SoftwareProductComponentsActionHelper.js | 31 +- .../images/SoftwareProductComponentsImageList.js | 3 +- .../SoftwareProductComponentsImageListView.jsx | 4 +- .../SoftwareProductComponentsMonitoringView.jsx | 2 +- .../SoftwareProductComponentsNetworkListView.jsx | 2 +- .../storage/SoftwareProductComponentStorage.js | 7 +- .../SoftwareProductComponentStorageView.jsx | 9 +- .../creation/SoftwareProductCreation.js | 2 +- .../SoftwareProductDependenciesView.jsx | 5 +- .../editor/SoftwareProductDeploymentEditor.js | 2 +- .../details/SoftwareProductDetailsView.jsx | 2 +- .../licenseModel/EntitlementPoolFactories.js | 12 +- .../factories/licenseModel/LimitFactories.js | 38 +++ .../test/licenseModel/entitlementPools/test.js | 170 ++++++++++ .../test/licenseModel/licenseKeyGroups/test.js | 169 ++++++++++ .../cassandra-actions/attributes/default.rb | 1 + 268 files changed, 4418 insertions(+), 6810 deletions(-) delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup delete mode 100644 openecomp-be/api/pom.xml.versionsBackup delete mode 100644 openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup delete mode 100644 openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup delete mode 100644 openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup create mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java create mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java delete mode 100644 openecomp-be/backend/pom.xml.versionsBackup delete mode 100644 openecomp-be/configuration/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java delete mode 100644 openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup rename openecomp-be/{backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils => lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services}/ManualVspDataCollectionService.java (71%) delete mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup delete mode 100644 openecomp-be/lib/pom.xml.versionsBackup delete mode 100644 openecomp-ui/proxy-server.js create mode 100644 openecomp-ui/resources/scss/modules/_licenseModelLimits.scss delete mode 100644 openecomp-ui/runLocalFE.cmd delete mode 100644 openecomp-ui/runLocalFE.js create mode 100644 openecomp-ui/src/nfvo-utils/getValue.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelValidations.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx rename openecomp-ui/src/sdc-app/onboarding/{softwareProduct/components/images/SoftwareProductComponentsImageNavigationReducer.js => licenseModel/limits/LimitEditorActionHelper.js} (63%) create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitsServer.js create mode 100644 openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js create mode 100644 sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb diff --git a/common/pom.xml b/common/pom.xml index 01be598ebb..fd5fb48cd9 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -15,17 +15,7 @@ - 4.12 - 1.8 - 1.8 - 1.7.21 1.8.7 - 2.5 - UTF-8 - 1.10 - 0.9.10 diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 41311914f9..f9b7cd3699 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -75,10 +75,9 @@ 9.0.6.v20130930 1.19.1 1.18.1 - 4.12 + RELEASE 1.1.2 1.10.19 - 1.1.0-SNAPSHOT 1.9.13 1.3.0 0.9.10 diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup deleted file mode 100644 index 47b9bdde7b..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,143 +0,0 @@ - - - 4.0.0 - - action-library-rest-services - - org.openecomp.sdc.onboarding - action-library-rest - 1.0-SNAPSHOT - - - - - ${project.build.directory}/generated-sources/error-codes - - - - - ${project.groupId} - action-library-rest-types - ${project.version} - - - - - org.springframework - spring-core - ${spring.framework.version} - - - org.springframework - spring-context - ${spring.framework.version} - - - org.springframework - spring-context-support - ${spring.framework.version} - - - org.springframework - spring-web - ${spring.framework.version} - - - org.springframework - spring-beans - ${spring.framework.version} - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf.version} - - - org.apache.httpcomponents - httpclient - ${http.client.version} - - - org.apache.httpcomponents - httpcore - ${http.client.version} - - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - - - - - - javax.inject - javax.inject - ${javax.inject.version} - provided - - - org.openecomp.sdc - openecomp-sdc-action-manager - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-action-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - org.slf4j - slf4j-api - 1.7.21 - - - com.sun.jersey.contribs - jersey-multipart - 1.18.1 - provided - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - test/core/unittest/offline/** - - true - - - - - - - - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml.versionsBackup deleted file mode 100644 index 4749ce7f8c..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - action-library-rest-types - action-library-rest-types - - - org.openecomp.sdc.onboarding - action-library-rest - 1.0-SNAPSHOT - ../ - - - - - org.openecomp.sdc - openecomp-sdc-common-rest - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-action-api - 1.0-SNAPSHOT - - - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup deleted file mode 100644 index de6c4c6760..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - org.openecomp.sdc.onboarding - action-library-rest - action-library-rest - 1.0-SNAPSHOT - pom - - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - ../ - - - /action-library-rest-services - /action-library-rest-types - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup deleted file mode 100644 index 9c3472a970..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,63 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - application-config-rest - 1.0-SNAPSHOT - - - application-config-rest-services - 1.0-SNAPSHOT - - - - - - io.swagger - swagger-annotations - 1.5.3 - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - org.springframework - spring-context - ${spring.framework.version} - - - javax.inject - javax.inject - 1 - - - org.openecomp.sdc - openecomp-sdc-application-config-manager - 1.0-SNAPSHOT - - - org.openecomp.sdc - application-config-rest-types - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-common-rest - 1.0-SNAPSHOT - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf.version} - - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup deleted file mode 100644 index a9c8bbaee5..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,18 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - application-config-rest - 1.0-SNAPSHOT - - - org.openecomp.sdc - application-config-rest-types - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup deleted file mode 100644 index fd2e251fea..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - - - org.openecomp.sdc - application-config-rest - 1.0-SNAPSHOT - pom - - - - application-config-rest-services - application-config-rest-types - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup deleted file mode 100644 index 983518fd29..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup +++ /dev/null @@ -1,226 +0,0 @@ - - 4.0.0 - - org.openecomp.sdc.onboarding - onboarding-be - onboarding-rest-war - 1.0-SNAPSHOT - war - - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - - - - - org.openecomp.sdc.onboarding - vendor-license-rest-services - ${project.version} - - - org.openecomp.sdc.onboarding - vendor-software-products-rest-services - ${project.version} - - - org.openecomp.sdc.onboarding - validation-rest-services - ${project.version} - - - - org.openecomp.sdc - application-config-rest-services - 1.0-SNAPSHOT - - - org.openecomp.sdc.onboarding - action-library-rest-services - ${project.version} - - - javax.servlet - servlet-api - ${javax.servlet.version} - - - - org.codehaus.jackson - jackson-jaxrs - ${org.codehaus.jackson.version} - - - org.codehaus.jackson - jackson-core-asl - ${org.codehaus.jackson.version} - - - javax.inject - javax.inject - 1 - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - 1.0-SNAPSHOT - - - org.eclipse.jetty - jetty-servlets - 9.0.6.v20130930 - - - org.openecomp.sdc - openecomp-sdc-application-config-manager - 1.0-SNAPSHOT - - - org.codehaus.groovy - groovy - ${groovy.version} - - - ch.qos.logback - logback-classic - ${logback.version} - - - ch.qos.logback - logback-core - ${logback.version} - - - org.codehaus.janino - janino - compile - - - - org.springframework - spring-core - 4.1.3.RELEASE - - - org.springframework - spring-web - 4.1.3.RELEASE - - - org.springframework - spring-aop - 4.1.3.RELEASE - - - org.springframework - spring-webmvc - 4.1.3.RELEASE - - - org.aspectj - aspectjweaver - 1.8.9 - - - org.aspectj - aspectjrt - 1.8.9 - - - org.aspectj - aspectjtools - 1.8.9 - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - org.apache.maven.plugins - maven-surefire-plugin - - - test/core/unittest/offline/** - - true - - - buildNumber - ${buildNumber} - - - - - - maven-war-plugin - 2.1.1 - - true - - - - ${basedir}/target/generated/swagger-ui - - - - - - com.github.kongchen - swagger-maven-plugin - 3.1.0 - - - - false - org.openecomp.sdcrests - http - /onboarding-api - - Rest API - v1.0, build #${buildNumber} - Rest API Documentation - - http://www.github.com/kongchen/swagger-maven-plugin - - - ${basedir}/templates/strapdown.html.hbs - ${basedir}/target/generated/api.html - ${basedir}/target/generated/swagger-ui - - - - - - - compile - - generate - - - - - - - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup deleted file mode 100644 index aaf3383c42..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - openecomp-sdc-common-rest - openecomp-sdc-common-rest - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - - - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - org.hibernate - hibernate-validator - ${hibernate.validator.version} - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - - io.swagger - swagger-core - ${swagger.version} - compile - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup deleted file mode 100644 index cd9b491c08..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup +++ /dev/null @@ -1,28 +0,0 @@ - - 4.0.0 - - openecomp-sdc-rest-webapp - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - pom - - - org.openecomp.sdc - openecomp-sdc-api - 1.0-SNAPSHOT - ../ - - - - /openecomp-sdc-common-rest - /vendor-license-rest - /onboarding-rest-war - /vendor-software-products-rest - /sequence-rest - /validation-rest - /action-library-rest - /application-config-rest - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup deleted file mode 100644 index 313a50ca9d..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,15 +0,0 @@ - - - - openecomp-sdc-rest-webapp - org.openecomp.sdc - 1.0-SNAPSHOT - - 4.0.0 - - sequence-rest - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup deleted file mode 100644 index 8bacd99f69..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,21 +0,0 @@ - - - 4.0.0 - org.openecomp.sdc.onboarding - validation-rest - validation-rest - 1.0-SNAPSHOT - pom - - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - - - /validation-rest-services - /validation-rest-types - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup deleted file mode 100644 index ffc417313a..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,152 +0,0 @@ - - - 4.0.0 - - validation-rest-services - - org.openecomp.sdc.onboarding - validation-rest - 1.0-SNAPSHOT - - - - - org.springframework - spring-core - ${spring.framework.version} - - - org.springframework - spring-context - ${spring.framework.version} - - - org.springframework - spring-context-support - ${spring.framework.version} - - - org.springframework - spring-web - ${spring.framework.version} - - - org.springframework - spring-beans - ${spring.framework.version} - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf.version} - - - org.apache.httpcomponents - httpclient - ${http.client.version} - - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - - - - - - javax.inject - javax.inject - ${javax.inject.version} - provided - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - com.sun.jersey - jersey-core - 1.19.1 - - - javax.ws.rs - jsr311-api - - - - - io.swagger - swagger-annotations - 1.5.3 - - - org.openecomp.sdc.onboarding - validation-rest-types - ${project.version} - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.4 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - ${project.version} - - - com.sun.jersey.contribs - jersey-multipart - 1.18.1 - provided - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - test/core/unittest/offline/** - - true - - - - - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup deleted file mode 100644 index 5cc8ee7c51..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - validation-rest-types - validation-rest-types - - - org.openecomp.sdc.onboarding - validation-rest - 1.0-SNAPSHOT - ../ - - - - - org.openecomp.sdc - openecomp-sdc-common-rest - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-manager - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup deleted file mode 100644 index ae9c3063bc..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - - org.openecomp.sdc.onboarding - vendor-license-rest - vendor-license-rest - 1.0-SNAPSHOT - pom - - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - ../ - - - - /vendor-license-rest-services - /vendor-license-rest-types - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup deleted file mode 100644 index 187135e1f4..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,135 +0,0 @@ - - 4.0.0 - - vendor-license-rest-services - vendor-license-rest-services - - - org.openecomp.sdc.onboarding - vendor-license-rest - 1.0-SNAPSHOT - ../ - - - - - ${project.build.directory}/generated-sources/error-codes - - - - - ${project.groupId} - vendor-license-rest-types - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-vendor-license-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-vendor-license-manager - ${project.version} - - - - - - org.springframework - spring-core - ${spring.framework.version} - - - org.springframework - spring-context - ${spring.framework.version} - - - org.springframework - spring-context-support - ${spring.framework.version} - - - org.springframework - spring-web - ${spring.framework.version} - - - org.springframework - spring-beans - ${spring.framework.version} - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf.version} - - - org.apache.httpcomponents - httpclient - ${http.client.version} - - - org.apache.httpcomponents - httpcore - ${http.client.version} - - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - - - - - - javax.inject - javax.inject - ${javax.inject.version} - provided - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - 1.0-SNAPSHOT - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - test/core/unittest/offline/** - - true - - - - - - - - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java index d35c06c30d..21293ab607 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java @@ -22,7 +22,6 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdcrests.mapping.MappingBase; -import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; @@ -39,14 +38,9 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto MapChoiceOrOtherToChoiceOrOtherDto choiceOrOtherMapper = new MapChoiceOrOtherToChoiceOrOtherDto(); - target.setEntitlementMetric( - choiceOrOtherMapper.applyMapping(source.getEntitlementMetric(), ChoiceOrOtherDto.class)); - target.setAggregationFunction( - choiceOrOtherMapper.applyMapping(source.getAggregationFunction(), ChoiceOrOtherDto.class)); target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto() .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); - target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOtherDto.class)); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); target.setStartDate(source.getStartDate()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java index 5442e1af61..9b215d69aa 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java @@ -20,7 +20,6 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; @@ -35,17 +34,11 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnit(source.getThresholdUnits()); target.setIncrements(source.getIncrements()); - MapChoiceOrOtherDtoToChoiceOrOther choiceOrOtherMapper = new MapChoiceOrOtherDtoToChoiceOrOther(); - target.setEntitlementMetric( - choiceOrOtherMapper.applyMapping(source.getEntitlementMetric(), ChoiceOrOther.class)); - target.setAggregationFunction( - choiceOrOtherMapper.applyMapping(source.getAggregationFunction(), ChoiceOrOther.class)); target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); - target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOther.class)); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setStartDate(source.getStartDate()); target.setExpiryDate(source.getExpiryDate()); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java index 38384711b1..66618e8fa7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java @@ -36,5 +36,10 @@ public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto() .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setThresholdUnits(source.getThresholdUnits()); + target.setThresholdValue(source.getThresholdValue()); + target.setIncrements(source.getIncrements()); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java index aee27c8521..4682a46216 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java @@ -34,5 +34,10 @@ public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity target.setType(source.getType()); target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setThresholdUnits(source.getThresholdUnits()); + target.setThresholdValue(source.getThresholdValue()); + target.setIncrements(source.getIncrements()); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java index e41942d455..99ac3cdb70 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java @@ -80,6 +80,7 @@ public class FeatureGroupsImpl implements FeatureGroups { fgDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds()); fgDto.setEntitlementPoolsIds(fg.getEntitlementPoolIds()); fgDto.setReferencingLicenseAgreements(fg.getReferencingLicenseAgreements()); + fgDto.setManufacturerReferenceNumber(fg.getManufacturerReferenceNumber()); outputMapper.doMapping(fg, fgDto); results.add(fgDto); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup deleted file mode 100644 index d24c315f39..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - vendor-license-rest-types - vendor-license-rest-types - 1.0-SNAPSHOT - - - org.openecomp.sdc.onboarding - vendor-license-rest - 1.0-SNAPSHOT - ../ - - - - - org.openecomp.sdc - openecomp-sdc-common-rest - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-vendor-license-manager - ${project.version} - - - - \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index b49a138a09..79cf750f74 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -33,7 +33,7 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @ApiModel(value = "EntitlementPoolRequest") -//@JsonIgnoreProperties(value = {"manufacturerReferenceNumber"}) +@JsonIgnoreProperties({"manufacturerReferenceNumber", "time", "aggregationFunction", "entitlementMetric"}) public class EntitlementPoolRequestDto { @NotNull @@ -46,23 +46,11 @@ public class EntitlementPoolRequestDto { private Integer thresholdValue; private ThresholdUnit thresholdUnits; - @NotNull - @Valid - private ChoiceOrOtherDto entitlementMetric; @Size(max = 120) private String increments; - @NotNull - @Valid - private ChoiceOrOtherDto aggregationFunction; @Valid private MultiChoiceOrOtherDto operationalScope; - @NotNull - @Valid - private ChoiceOrOtherDto time; - @NotNull - @Size(max = 100) - private String manufacturerReferenceNumber; private String startDate; private String expiryDate; @@ -99,14 +87,6 @@ public class EntitlementPoolRequestDto { this.thresholdUnits = thresholdUnits; } - public ChoiceOrOtherDto getEntitlementMetric() { - return entitlementMetric; - } - - public void setEntitlementMetric(ChoiceOrOtherDto entitlementMetric) { - this.entitlementMetric = entitlementMetric; - } - public String getIncrements() { return increments; } @@ -115,14 +95,6 @@ public class EntitlementPoolRequestDto { this.increments = increments; } - public ChoiceOrOtherDto getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction(ChoiceOrOtherDto aggregationFunction) { - this.aggregationFunction = aggregationFunction; - } - public MultiChoiceOrOtherDto getOperationalScope() { return operationalScope; } @@ -131,22 +103,6 @@ public class EntitlementPoolRequestDto { this.operationalScope = operationalScope; } - public ChoiceOrOtherDto getTime() { - return time; - } - - public void setTime(ChoiceOrOtherDto time) { - this.time = time; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - public String getStartDate() { return startDate; } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java index f2d0d651ef..56b3c25635 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java @@ -35,7 +35,7 @@ public class FeatureGroupDescriptorDto { @NotNull private String partNumber; - //@NotBlank(message = "is mandatory and should not be empty") + @NotBlank(message = "is mandatory and should not be empty") @Size(max = 100) private String manufacturerReferenceNumber; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java index a9072f5e94..fb56f85326 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java @@ -22,6 +22,7 @@ package org.openecomp.sdcrests.vendorlicense.types; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; import javax.validation.Valid; import javax.validation.constraints.NotNull; @@ -39,6 +40,16 @@ public class LicenseKeyGroupRequestDto { @Valid private MultiChoiceOrOtherDto operationalScope; + private String startDate; + private String expiryDate; + + private Integer thresholdValue; + + private ThresholdUnit thresholdUnits; + + @Size(max = 120) + private String increments; + public String getName() { return name; } @@ -70,4 +81,44 @@ public class LicenseKeyGroupRequestDto { public void setOperationalScope(MultiChoiceOrOtherDto operationalScope) { this.operationalScope = operationalScope; } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + public Integer getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(Integer thresholdValue) { + this.thresholdValue = thresholdValue; + } + + public ThresholdUnit getThresholdUnits() { + return thresholdUnits; + } + + public void setThresholdUnits(ThresholdUnit thresholdUnits) { + this.thresholdUnits = thresholdUnits; + } + + public String getIncrements() { + return increments; + } + + public void setIncrements(String increments) { + this.increments = increments; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup deleted file mode 100644 index 074c8d9e10..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,21 +0,0 @@ - - - 4.0.0 - org.openecomp.sdc.onboarding - vendor-software-products-rest - vendor-software-products-rest - 1.0-SNAPSHOT - pom - - - org.openecomp.sdc - openecomp-sdc-rest-webapp - 1.0-SNAPSHOT - - - /vendor-software-products-rest-services - /vendor-software-products-rest-types - - \ 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.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml.versionsBackup deleted file mode 100644 index ba2814613e..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,153 +0,0 @@ - - - 4.0.0 - - vendor-software-products-rest-services - - org.openecomp.sdc.onboarding - vendor-software-products-rest - 1.0-SNAPSHOT - - - - - org.springframework - spring-core - ${spring.framework.version} - - - org.springframework - spring-context - ${spring.framework.version} - - - org.springframework - spring-context-support - ${spring.framework.version} - - - org.springframework - spring-web - ${spring.framework.version} - - - org.springframework - spring-beans - ${spring.framework.version} - - - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf.version} - - - org.apache.httpcomponents - httpclient - ${http.client.version} - - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - - - - - - javax.inject - javax.inject - ${javax.inject.version} - provided - - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - com.sun.jersey - jersey-core - 1.19.1 - - - javax.ws.rs - jsr311-api - - - - - io.swagger - swagger-annotations - 1.5.3 - - - org.openecomp.sdc.onboarding - vendor-software-products-rest-types - ${project.version} - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.4 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - ${project.version} - - - - com.sun.jersey.contribs - jersey-multipart - 1.18.1 - provided - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - test/core/unittest/offline/** - - true - - - - - - - - \ 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/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 d5eb961285..0793e9473e 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 @@ -3,6 +3,8 @@ package org.openecomp.sdcrests.vsp.rest.services; import org.apache.commons.beanutils.BeanUtils; 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; @@ -30,6 +32,9 @@ 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; @Named @@ -82,9 +87,12 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate OrchestrationTemplateActionResponseDto responseDto = new OrchestrationTemplateActionResponseDto(); BeanUtils.copyProperties(responseDto, response); + return Response.ok(responseDto).build(); } + + @Override public Response updateFilesDataStructure( String vspId, String versionId, FileDataStructureDto fileDataStructureDto, String user) 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 6dcb63dfdd..9c642eb862 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 @@ -25,6 +25,7 @@ import org.openecomp.sdc.activityLog.ActivityLogManagerFactory; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; 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; @@ -75,6 +76,8 @@ import java.io.IOException; import java.util.Collection; import java.util.List; +import static org.openecomp.sdc.logging.messages.AuditMessages.SUBMIT_VSP_ERROR; + @Named @Service("vendorSoftwareProducts") @@ -206,8 +209,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { switch (request.getAction()) { case Checkout: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkout_VSP.toString()); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VSP + vspId); vendorSoftwareProductManager.checkout(vspId, user); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VSP + vspId); break; case Undo_Checkout: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Undo_Checkout_VSP.toString()); @@ -215,18 +218,28 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { break; case Checkin: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkin_VSP.toString()); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VSP + vspId); vendorSoftwareProductManager.checkin(vspId, user); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VSP + vspId); break; case Submit: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Submit_VSP.toString()); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId); ValidationResponse validationResponse = vendorSoftwareProductManager.submit(vspId, user); if (!validationResponse.isValid()) { + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP_FAIL + vspId); + if (validationResponse.getVspErrors() != null) { + validationResponse.getVspErrors().forEach(errorCode -> logger.audit(AuditMessages + .AUDIT_MSG + String.format(SUBMIT_VSP_ERROR, errorCode.message(), vspId))); + } + if (validationResponse.getUploadDataErrors() != null) { + validationResponse.getUploadDataErrors().values().forEach(errorMessages + -> printAuditForErrors(errorMessages, vspId, SUBMIT_VSP_ERROR)); + } + return Response.status(Response.Status.EXPECTATION_FAILED).entity( new MapValidationResponseToDto() .applyMapping(validationResponse, ValidationResponseDto.class)).build(); } + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId); break; case Create_Package: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Create_Package.toString()); @@ -371,4 +384,14 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { return Response.ok(results).build(); } + + private void printAuditForErrors(List 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/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup deleted file mode 100644 index 7fb5fd711e..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - vendor-software-products-rest-types - vendor-software-products-rest-types - - - org.openecomp.sdc.onboarding - vendor-software-products-rest - 1.0-SNAPSHOT - ../ - - - - - org.openecomp.sdc - openecomp-sdc-common-rest - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - 1.0-SNAPSHOT - - - - \ No newline at end of file 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/ComputeDetailsDto.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/ComputeDetailsDto.java index 4b7889b16d..92ad0fdb0c 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/ComputeDetailsDto.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/ComputeDetailsDto.java @@ -8,7 +8,6 @@ import javax.validation.constraints.Size; public class ComputeDetailsDto implements CompositionDataEntityDto { @NotBlank(message = "is mandatory and should not be empty") @Size(min = 0, max = 30, message = "length should not exceed 30 characters.") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") private String name; @Size(min = 0, max = 300, message = "length should not exceed 300 characters.") private String description; 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/DeploymentFlavorRequestDto.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/DeploymentFlavorRequestDto.java index 54ce63b252..baf6707ddf 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/DeploymentFlavorRequestDto.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/DeploymentFlavorRequestDto.java @@ -10,7 +10,6 @@ import javax.validation.constraints.Size; public class DeploymentFlavorRequestDto { @NotBlank(message = "is mandatory and should not be empty") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") @Size(min = 0, max = 30,message = "length should not exceed 30 characters.") private String model; @Size(min = 0, max = 300,message = "length should not exceed 300 characters.") 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/ImageRequestDto.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/ImageRequestDto.java index 6164522dda..4386245342 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/ImageRequestDto.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/ImageRequestDto.java @@ -8,7 +8,6 @@ import javax.validation.constraints.Pattern; public class ImageRequestDto implements CompositionDataEntityDto { @NotBlank(message = "is mandatory and should not be empty") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") private String fileName; private String description; /*private String version; 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/NicRequestDto.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/NicRequestDto.java index fba85b64ed..fdf953c80c 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/NicRequestDto.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/NicRequestDto.java @@ -29,7 +29,6 @@ import javax.validation.constraints.Pattern; public class NicRequestDto { @NotBlank(message = "is mandatory and should not be empty") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") private String name; private String description; private String networkId; diff --git a/openecomp-be/api/pom.xml.versionsBackup b/openecomp-be/api/pom.xml.versionsBackup deleted file mode 100644 index 4c41573002..0000000000 --- a/openecomp-be/api/pom.xml.versionsBackup +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - - openecomp-sdc-api - openecomp-sdc-api - 1.0-SNAPSHOT - pom - http://maven.apache.org - - - org.openecomp.sdc - openecomp-sdc - 1.0-SNAPSHOT - - - - /openecomp-sdc-rest-webapp - - - \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup deleted file mode 100644 index 21cfd19b02..0000000000 --- a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,76 +0,0 @@ - - - 4.0.0 - - openecomp-sdc-action-manager - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-core - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-nosqldb-core - 1.0-SNAPSHOT - - - org.testng - testng - 6.9.10 - test - - - junit - junit - RELEASE - test - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - org.openecomp.sdc - openecomp-sdc-action-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-versioning-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - backend - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup deleted file mode 100644 index a9cc7a32f6..0000000000 --- a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - org.openecomp.sdc - openecomp-sdc-application-config-manager - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-config-lib - 1.0-SNAPSHOT - - - org.testng - testng - 6.9.10 - test - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - backend - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml index ea105b1f90..359d940e52 100644 --- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml @@ -80,4 +80,4 @@ - + \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup deleted file mode 100644 index 4d678ad77d..0000000000 --- a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,78 +0,0 @@ - - - 4.0.0 - - openecomp-sdc-validation-manager - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.testng - testng - 6.9.10 - test - - - junit - junit - RELEASE - test - - - - - org.openecomp.sdc - openecomp-sdc-translator-core - 1.0-SNAPSHOT - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - org.openecomp.sdc - openecomp-sdc-vendor-license-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-common-lib - 1.0-SNAPSHOT - - - - - - org.openecomp.sdc - backend - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup deleted file mode 100644 index 85b34a187e..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,77 +0,0 @@ - - 4.0.0 - - openecomp-sdc-vendor-license-manager - openecomp-sdc-vendor-license-manager - - - backend - org.openecomp.sdc - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - openecomp-sdc-vendor-license-core - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - test - 4.11 - - - javax.el - javax.el-api - ${javax.el-api.version} - - - org.glassfish.web - javax.el - 2.2.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - 1.0-SNAPSHOT - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - - commons-io - commons-io - ${commons.io.version} - - - - \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java index 622ff02501..b570170985 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java @@ -365,9 +365,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { String user) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - return featureGroupDao.list(new FeatureGroupEntity(vlmId, VersioningUtil - .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), - null)); + return vendorLicenseFacade.listFeatureGroups(vlmId, version, user); } @Override @@ -487,15 +485,6 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { .debugEntryMessage("VLM id", entitlementPool.getVendorLicenseModelId()); mdcDataDebugMessage .debugExitMessage("VLM id", entitlementPool.getVendorLicenseModelId()); - validateCreateDate(entitlementPool); - return vendorLicenseFacade.createEntitlementPool(entitlementPool, user); - } - - private void validateCreateDate(EntitlementPoolEntity entitlementPool){ - mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate - ()+" "+entitlementPool.getExpiryDate()); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" @@ -504,40 +493,49 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" : null) : null); - if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) { - if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore - (LocalDate.now().atStartOfDay()) || - LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay() - .isEqual(LocalDate.now().atStartOfDay()) || - LocalDate.parse(entitlementPool.getExpiryDate(), formatter) - .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) { + validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(), + entitlementPool.getVendorLicenseModelId()); + return vendorLicenseFacade.createEntitlementPool(entitlementPool, user); + } + + private void validateCreateDate(String startDate, String expiryDate, String vendorLicenseModelId){ + mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate + +" "+expiryDate); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); + + if(startDate != null && expiryDate != null) { + if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore + (LocalDate.now().atStartOfDay()) || LocalDate.parse(expiryDate, formatter).atStartOfDay() + .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || LocalDate + .parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } } - if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() == null) { - if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore + if(startDate != null && expiryDate == null) { + if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore (LocalDate.now().atStartOfDay())) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } } - if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) { + if(startDate == null && expiryDate != null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } @@ -545,39 +543,31 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugExitMessage(null,null); } - private void validateUpdateDate(EntitlementPoolEntity entitlementPool){ - mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate - ()+" "+entitlementPool.getExpiryDate()); + private void validateUpdateDate(String startDate, String expiryDate, String vendorLicenseModelId){ + mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate + +" "+ expiryDate); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); - entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool - .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" - : null) : null); - entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool - .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" - : null) : null); - - if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) { - if (LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay() - .isEqual(LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay()) || - LocalDate.parse(entitlementPool.getExpiryDate(), formatter) - .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) { + if(startDate != null && expiryDate != null) { + if (LocalDate.parse(expiryDate, formatter).atStartOfDay() + .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || + LocalDate.parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } } - if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) { + if(startDate == null && expiryDate != null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } @@ -590,7 +580,15 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool .getVendorLicenseModelId(), entitlementPool.getId()); - validateUpdateDate(entitlementPool); + entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool + .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" + : null) : null); + entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool + .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" + : null) : null); + + validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(), + entitlementPool.getVendorLicenseModelId()); Version version = VersioningUtil.resolveVersion(entitlementPool.getVersion(), getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write, user), user); @@ -692,6 +690,16 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugExitMessage("VLM id", licenseKeyGroup .getVendorLicenseModelId()); + + licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup + .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z" + : null) : null); + licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup + .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z" + : null) : null); + + validateCreateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(), + licenseKeyGroup.getVendorLicenseModelId()); return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup, user); } @@ -700,6 +708,16 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", licenseKeyGroup .getVendorLicenseModelId(), licenseKeyGroup.getId()); + licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup + .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z" + : null) : null); + licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup + .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z" + : null) : null); + + validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(), + licenseKeyGroup.getVendorLicenseModelId()); + Version version = VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(), getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, user), user); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java index 9b079de3fa..620c6fbf91 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java @@ -89,15 +89,9 @@ public class EntitlementPoolTest { entitlementPool.setDescription(desc); entitlementPool.setThresholdValue(threshold); entitlementPool.setThresholdUnit(thresholdUnit); - entitlementPool - .setEntitlementMetric(new ChoiceOrOther<>(entitlementMetricChoice, entitlementMetricOther)); entitlementPool.setIncrements(increments); - entitlementPool.setAggregationFunction( - new ChoiceOrOther<>(aggregationFunctionChoice, aggregationFunctionOther)); entitlementPool.setOperationalScope( new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther)); - entitlementPool.setTime(new ChoiceOrOther<>(timeChoice, timeOther)); - entitlementPool.setManufacturerReferenceNumber(sku); return entitlementPool; } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java index 782d93a885..04f7c794bc 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java @@ -29,6 +29,7 @@ import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.*; +import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.dao.types.Version; @@ -41,6 +42,10 @@ import org.testng.annotations.Test; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -54,6 +59,8 @@ public class LicenseKeyGroupTest { private final String USER = "lkgTestUser"; private final String LKG_NAME = "LKG name"; private final String LT_NAME = "LT name"; + private final String LKG1_NAME = "LKG1 name"; + private final String USER1 = "user1"; @Mock private VendorLicenseFacade vendorLicenseFacade; @@ -186,8 +193,193 @@ public class LicenseKeyGroupTest { } } + @Test + public void createTest() { + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter)); + + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1); + } + + @Test + public void createWithInvalidStartExpiryDateTest() { + try { + + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void createWithoutStartDateTest() { + try { + + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1).getId(); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void createWithSameStartExpiryDateTest() { + try { + + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().plusDays(2L).format(formatter)); + lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1).getId(); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void createUpdate() { + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().minusDays(3L).format(formatter)); + lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + VersionInfo info = new VersionInfo(); + Version version = new Version(); + info.getViewableVersions().add(version); + info.setActiveVersion(version); + doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); + + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + } + + @Test + public void updateWithInvalidStartExpiryDateTest() { + try { + + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void updateWithoutStartDateTest() { + try { + + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void updateWithSameStartExpiryDateTest() { + try { + + Set opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().format(formatter)); + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + + public static LicenseKeyGroupEntity createLicenseKeyGroup(String vlmId, Version version, + String name, String desc, + LicenseKeyType type, + MultiChoiceOrOther operationalScope) { + LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity(); + licenseKeyGroup.setVendorLicenseModelId(vlmId); + licenseKeyGroup.setVersion(version); + licenseKeyGroup.setName(name); + licenseKeyGroup.setDescription(desc); + licenseKeyGroup.setType(type); + licenseKeyGroup.setOperationalScope(operationalScope); + return licenseKeyGroup; + } + /*public static final String LKG1_NAME = "LKG1 name"; private static final Version VERSION01 = new Version(0, 1); + public static final String LKG1_NAME = "LKG1 name"; private static final String USER1 = "user1"; public static String vlm1Id; public static String vlm2Id; @@ -211,7 +403,12 @@ public class LicenseKeyGroupTest { return licenseKeyGroup; } - @BeforeClass + @BeforeMethod + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + /*@BeforeClass private void init() { licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface(); noSqlDb = NoSqlDbFactory.getInstance().createInterface(); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java index 58db488d86..40bbc77faa 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java @@ -1,18 +1,27 @@ package org.openecomp.sdc.vendorlicense; +import org.junit.Assert; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.vendorlicense.dao.*; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl; +import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; +import java.util.List; import java.util.Set; import static org.mockito.Matchers.anyObject; @@ -21,12 +30,16 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; /** - * Created by diveshm on 7/3/2017. + * This test just verifies Feature Group Get and List APIs. */ public class VendorLicenseFacadeImplTest { //JUnit Test Cases using Mockito private static final Version VERSION01 = new Version(0, 1); - private final String FG1_NAME = "FG1 name"; + public static final String EP1 = "ep1"; + public static final String MRN = "mrn"; + public static final String VLM_ID = "VLM_ID"; + public static final String USER = "USER1"; + @Mock private VendorLicenseModelDao vendorLicenseModelDao; @@ -50,78 +63,101 @@ public class VendorLicenseFacadeImplTest { @Spy private VendorLicenseFacadeImpl vendorLicenseFacadeImpl; - public FeatureGroupEntity createFeatureGroup(String vlmId, Version version, String id, String name, String desc, - String partNumber, String manufacturerReferenceNumber, Set - licenseKeyGroupIds, Set entitlementPoolIds, Set - referencingLicenseAgreements){ - FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlmId, version, id); - featureGroup.setVendorLicenseModelId(vlmId); - featureGroup.setVersion(version); - featureGroup.setId(id); - featureGroup.setName(name); - featureGroup.setDescription(desc); - featureGroup.setPartNumber(partNumber); - //featureGroup.setManufacturerReferenceNumber(manufacturerReferenceNumber); - featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); - featureGroup.setEntitlementPoolIds(entitlementPoolIds); - featureGroup.setReferencingLicenseAgreements(referencingLicenseAgreements); - - return featureGroup; - } - @BeforeMethod public void setUp() throws Exception{ MockitoAnnotations.initMocks(this); } @Test - public void testCreate(){ - Set licenseKeyGroupIds; - licenseKeyGroupIds = new HashSet<>(); - licenseKeyGroupIds.add("lkg1"); + public void testGetFeatureGroupWhenMRNNull () { + resetFieldModifiers(); + + FeatureGroupEntity featureGroup = createFeatureGroup(); + + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); Set entitlementPoolIds; entitlementPoolIds = new HashSet<>(); - entitlementPoolIds.add("ep1"); - - Set referencingLicenseAgreements; - referencingLicenseAgreements = new HashSet<>(); - referencingLicenseAgreements.add("la1"); + entitlementPoolIds.add(EP1); - FeatureGroupEntity featureGroupEntity = createFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", - "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds, - referencingLicenseAgreements); + EntitlementPoolEntity ep = createEP(); - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + featureGroup.setEntitlementPoolIds(entitlementPoolIds); - /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) - featureGroupDao.create(featureGroupEntity); - verify(featureGroupDao).create(anyObject());*/ + doReturn(info).when(vendorLicenseFacadeImpl).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(featureGroup).when(featureGroupDao).get(featureGroup); + doReturn(ep).when(entitlementPoolDao).get(anyObject()); + doReturn(MRN).when(entitlementPoolDao).getManufacturerReferenceNumber(anyObject()); + FeatureGroupEntity retrieved = vendorLicenseFacadeImpl.getFeatureGroup(featureGroup, USER); + Assert.assertEquals(MRN, retrieved.getManufacturerReferenceNumber()); } @Test - public void testCreateWithoutManufacturerReferenceNumber(){ - Set licenseKeyGroupIds; - licenseKeyGroupIds = new HashSet<>(); - licenseKeyGroupIds.add("lkg1"); + public void testListFeatureGroups () { + resetFieldModifiers(); - Set entitlementPoolIds; - entitlementPoolIds = new HashSet<>(); - entitlementPoolIds.add("ep1"); + FeatureGroupEntity featureGroup = createFeatureGroup(); - Set referencingLicenseAgreements; - referencingLicenseAgreements = new HashSet<>(); - referencingLicenseAgreements.add("la1"); + Collection featureGroups = new ArrayList(); + featureGroups.add(featureGroup); - FeatureGroupEntity featureGroupEntity = createFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", - "partNumber", null, licenseKeyGroupIds, entitlementPoolIds, - referencingLicenseAgreements); - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); - /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) - featureGroupDao.create(featureGroupEntity); + EntitlementPoolEntity ep = createEP(); - verify(featureGroupDao, never()).create(anyObject());*/ + doReturn(info).when(vendorLicenseFacadeImpl).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(featureGroup).when(featureGroupDao).get(featureGroup); + doReturn(ep).when(entitlementPoolDao).get(anyObject()); + doReturn(MRN).when(entitlementPoolDao).getManufacturerReferenceNumber(anyObject()); + Collection retrieved = vendorLicenseFacadeImpl.listFeatureGroups(VLM_ID, + VERSION01, USER); + retrieved.stream().forEach(fg -> Assert.assertEquals(MRN,fg.getManufacturerReferenceNumber())); + } + + private void resetFieldModifiers() { + try { + Field fgField = VendorLicenseFacadeImpl.class.getDeclaredField("featureGroupDao"); + fgField.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(fgField, fgField.getModifiers() & ~Modifier.FINAL); + fgField.set(null, featureGroupDao); + + Field epField = VendorLicenseFacadeImpl.class.getDeclaredField("entitlementPoolDao"); + epField.setAccessible(true); + modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(epField, epField.getModifiers() & ~Modifier.FINAL); + epField.set(null, entitlementPoolDao); + } catch(NoSuchFieldException | IllegalAccessException e) + { + org.testng.Assert.fail(); + } + } + + private FeatureGroupEntity createFeatureGroup() { + FeatureGroupEntity featureGroup = new FeatureGroupEntity(VLM_ID, VERSION01, USER); + featureGroup.setManufacturerReferenceNumber(null); + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); + + Set entitlementPoolIds; + entitlementPoolIds = new HashSet<>(); + entitlementPoolIds.add(EP1); + + featureGroup.setEntitlementPoolIds(entitlementPoolIds); + return featureGroup; + } + private EntitlementPoolEntity createEP() { + EntitlementPoolEntity ep = new EntitlementPoolEntity(VLM_ID,VERSION01, EP1); + ep.setManufacturerReferenceNumber(MRN); + return ep; } + } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip deleted file mode 100644 index ca55484a3c258f850fc480047fae8ae0257ab5a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33617 zcmb4qW0)Xqwq)71ZQHhOS9RI8ZQHihWp&xM?dr0tw!b@jpWSEf%s0FFCo}(MMw~b& zPP_`zz#u395D*Xm4K7Af0RPt|`sZ21#MHvp!r8*k)=5X$&eqw{(85~K$m!4hhqJQF zp9c$P7iSZ3Yda%DYZVWB6DMU8M^}ps8 zR<=W53I-P)WEZLi)?A2W(zzsMqq)AxwA`-q%?%qaX@l{D@`oe(9tTP&m`6&|^f9hR z(#y9aINsey#)?!(+%(B;NNM|yYVjj5ywhd?x$fw^kTIZBdqH#Cg(@r5Bi|MJDj$SC zM`uw?)G8CYlC|{9x~?fYWNA&&I+iA97bR#gS}d!-1cSg~398Ji-R{>wi%Th@udz`U zK}Jg|AE7&WbFT1Adp!XIyA;Kw~$-xv_=F20wT&{n6R&;r><6Dk|RBG1z@ zwMTPE7j}bVHDz<-m z_Em1;pz+^a_w3N~`&_z)bFM?C*_QWpchn3VxWmE8qqVF*3tm9{Oj%Yh7vb@ffEr0y zyePBqFc;ZtMGVMkbZw9?;h>N+N<0!GK^mv3TXjao#fb z7?Bbq(QJi@c9@vj+E^`@6)Q{3bYV)7rR>+RNVH#njOMH~lP`Jl$RE)lpU3{`&01TW z=u7^EA^XF;^BPhZ0WKq3%M~@?pm4+`?JOIII%u9)=rR|7CQ7h@Fos%mjX!EVg)veg zZ(oJw8Q+pWnTu*VLxzzePMl`qo^~HEB<0RbdApg4(Yl>ji0G-K_EiWVebURCuyA6m zsG2WHIOAvO)jjsClGiWo`*i9}Ebh=YF(W4B#=b{)yDg9kWjd~^D`!CD>r5naZ^!ek zzMynCmss6(=xFHG!o-Z-ol1NLLvphh@oR@5(ZzCCzfm}}tPanDIr!9+{^%2~MGLo{ zl6>gu%;<#2%B$Y@(+7v>9EquW(2G7+@^tUmiF$PgCo8I#${<+L*S*A)i>bZL+bnVo zuF>uv*LQ|jQgrK{>4{4EB2Mx& z&xxxx_1EM_s}6;!2WNLaW{?k;p{n0UN3Wh&A(O)#)|$`(lS1Z>(=K>j5$$)5{O`P6 z_-WoVC-^RCtt%ZtC_cRo#Xes0WPLW12jz1b6}iuPzTG9cX5J07V!Yb6RYsz%zS`nm zcs=dmEq=4nKOb94INH8ceeLvDK})eK;>voQbnwc}Inwv9O?@U?S_VO)zJU~^!68_o zV3g~C0RV830RR;KZH3_aHx)wI&c^;fmxXRsS-U@Fq5DMr6n;>mt_O9C;j+F(qe&N3 ztPtDq&7O2!@a;m}Z`yVpQ!YRkC=3NZ?JsVEn^$cn0*;>Od+13eH>=;Q= zWhHDZ1QB?`r{_4gpM}CmxG2m}2}(U{P^j6^zT>@yq#}ma(q&_E8azhTF#|p`B!6lb zMVhmILDzT>_q_9J{ye7pQF*8k5IHiiBp&B}s6?h@%Lo<2FCCJ|Vg8u@3=rL+^r#n|jPOik1LW9S5dqcl zp@W&Quy_3TnY_1Xhu@3uhN25~vMJ`3+vYM2TG!C5@JMjOSX>inyXq~yIVe%3>09(F z#xV*cYFW6{(Y>Bz70fbLajearMJ?oYIZ?Z5gJr{}x$`^6+KNG}T6cCKN$yFM7+)aE z(}BDFx%v##fjO8z@yyX$0aF?Gn(B@2ZY zqnK_x{Kw}lA5AB&u`s>-pS^oxV+~caAoXR<0A6OT*y|m-qG}1}7C*(U?hW&#!cR|P zS$!`O3<;k{{_KUIWtZh6euG%uheaq&TeE& zrRqEL#S6;oa!Hp&(^-LM`Z+WtMv-BtFryc8gj#6i)F`E1MwDwZJlgXNw?DZ*GLNhC%2lqKBYpYoK%`; zT|^sL6E;0=F}AqeYtKqk?$)vqI1o)kr3`F#7^kV9jfkWu0HEoTVMSLq`y00-M0C!Q zv>0Bz7v~=#&A$p&b=Bryn|x9AOMekCvmjW$GnBD>lPT~C!eyF8B=8#~1+xY(PrAxj zpeGunSWzZY$7c*Y=l|5?PH`X0X6)fG&1*AhM9>UL+a)((?};DoKqV_vG8jsKvy6%W z^#TZ8qNtgVZyX=pPl&jRNxI6Bju}306??8^`0;)(mfi1#9+wjwd-j|jR}sSQT$4)c zp(aQk7Wz#Up=P*rkwfAPsb}Ik%-3_{ZAbGnC8J^EonD{MulwD8OX`uYGpuH6rk-(W zrHvZS$4J=&^8Nn0;;XfSpKPi_?i)&N`9LVBr1fe?_}1mV;GMXez^I@3J}^?7Wh12l zb>9URZU1UZIN(4q&o8GbWFDp)ug3|z!^u_k2z4GP@7`%KN7Hwj@9rG&cVTh>s$`pV z$7K*|2l$=h*^*wa=E)V6Ppx9Lh0FEDS2n6aFJ+7!%p2`@`=Yw9-rWA~%n}tLRZRhc zO?a2djn>T#fA_cd_nBvwB$@_}DS>CK;Ee2*TuMRzn=ih-?+aawOI##1g$B68{a|~B z@OA}G;qhL%2lE=+$+{I$@ew~&m7{!ZT^f6|S%#xrT1SWD5E6exp5ezsH+_YaFa$1e zfsks*=Y~v5k@iglLP?tRZ}_r>zCacP7C$?4u;{K!=}DAL2jP~_p342}u9Z}7_h4>n?y>(P!23`=EsIgX&pRve< z>~%ex%+w8JR6%kfZ=m_WdwzkHFiy(zC5c17{rWH%J#ilvhGb_C9?o#bKpdk5xWFXH zxtZ2)b09R&ErU*M7l%>~-=DTG){Ba^zhP!6ERxXJ72`Jd{4_N4xA`1cMKpSmMIlyA z!N$k(r+EWdV2XE|n*|_zOt}c15rnj_ky&}V;R;WRPd&0@yP;p{K^`x}1I+l=0Own8 zL?ouCt$oU)G0r4EpB>(BB92oFuSP5a2{Or|f5S`v5v(iT}v1+(Y9~;|Z)sclNEU*?k z?XoF^vY$i*3y2$9Siap;ka%wlmtvwUTU0fthmhF}BKkJeH$nK;7r#u`z+vmJGks54 z6_N2xuN=xC6uY>G&sB4V*UOa$E*!AhYEIDyE^5zM{7~_PSt%=#WV2Wb&vy5KpvpaM zxjy1y&e^{t&;M_R*k znw=KuTlhP#Q3%zuYKr8{y&nz{yt+92v`p4-fKh-EVpX-QrD(QNJdtQhwq*6+UMpg- z0F>94lkML&4jwqV{c4g+gzsEs%Y^U10-XrvF zx4a^Qpp*oxbA-tKD90n;9*Yp1F`2q?F@?G}L`KI;@q3fk)p(qmUPIyLu=5#gBk@{7 zq|DA@h8C4Mr0b4E5RsnN5J}HmK?&w#dx88FI<2@0T+93N+?PN!yo9WPAX>pgXl+1Ot+--{ zVFJ$=p8$$uzQY@fXi@U>tMwKrDX5Jz`icV^PB~I29Udg8K~DY8_!cVqu|{VhZY9a3 zk$Epx@E#@!#RE{7e@{LH72KOPURuA)E$)7JdK|cwdM@|to2R_nWg-GvY&6teP^Ggt zRWxwTtE3*}3Y;UlRt#YgRL_JE72jN#)wuIt=C67b17hjh%^KAnFjlDz*zB>yoG%9%L3**RJ%xmf>SliaI8}%qd9$37^nBnC!NBW}?As(6c2ek`>FV zZ>^!H!{RXejqfU}S?Y1=Sv!rD*>aNobsP_yAPFJ*#}U)_NGC__tY#fb(EaI`dAF9Z zzRWw1JzJ{szrD~86XnjFiTa_-sAR-xA;u_32I9fOLUnsI#mmM%eljqh{c+!g8JiadyC1 zr|PuhXa_25$5-38PI5ijUsn%(XwzHSS&{qO6CZF={W{=`@JOT*B2OC!HHAYxln8b| zgwy<};e})h;{Zg=VT#+@t1^F{qYiL$1)phgBrq%9T^Dx412VV@n)v1D;q|j4*9;ni zljG85)Yf?x@%c`jv)V&DR^OLXM+$uVS4HO<+g`@m$alI@2IpAq4ylH93-*yimkO6V zvUaf5vec!72rsGpJ#KdWSW_&xJsWL6yLiyNg_AkpR}ZAb5K=b&8tlB(bLkN##<0CZKd}~$cJI!@1B;X zB6_M^A{Mzbg7UHlNR@5F7&=0XnHnQ?)m!85}cCUx;`DB@m|{7=cP$@>@jhea-bcXd7$-fTjrtMYo(TL=grtJ5l1(kf+~}; zs?d=wob zv!j+0=BG{HOjOhUWpN=vcjXV}CCqya_33Z_v&X|bAT0v(g!HI;#%MV?L9QR!xJ)zN z0H#vR2@|F+0!Bi<6(q9UM53`_id_0ZF~Z4LOF0b7sw75smmgjBteQrlE_;-1hoq>| zx`#dm8VJJ!t)o0_jOdpYE;IGCZ9L7eM>d901sZMtcut(%5JF>RAXzK~*J{n~cG~?oZC>DCL(ROv{07 zj)e!)2O!9Pva_%3l;RI(p^80PB?!XuFO4%; zi{zv`$tq1PSLYlnU>nOp#U&^=5YJMd%p&iIAp5N2Pv$@ux@wI*He^n_q)mvFUDeqF z(aNbI42M_SePQb@PYfkWg|1fOgI#Prym4Jqrj1wr{5BKacW9Wzt*jX9guX5&Trgx| zLeK;Y6Mx>z1qEXD?C~GfrNwV*R4R*fw{A`ZE*5mys!GuhO84zGoiiqNS1o;+MaDyU z4iw^w$GoUb!PNilB;?ie*0#i0JM!^+w@2spbvm0p-3(AVjp(7~Rsr$nO-c~AVO8p^ z$;M?HL!6~;U5@cLe};^Vb{dsp5x?w*0(Ib<w1GGv40$mu6ODe zU}_HaoyaR-UKCyHMl->NGZBB9c9a~OubyUFZd*JFv@2P*vAs!uk}wS{T|=906KwBA z@M4NMAa@ASjb^yVITpD(=i2*fLADe_Wn+M7B-ZHlEHLPo<`|jMLl<)R3ETsA^wwdU zSlVHew@u>`#}qTv;Y90+Uv-cmauf^$ec{B>Kn^sGO+e)}$XqkR&Vq(9 z&h@0WNU%#){M1dU(Hxx=86bN?o^!)nl`g~>KkEmbE;0GPhWXsIgiN(-VJMUZ==LCy= zUcn_x@y65lz>6NOuuzo>w@0i4Ee?q2SC$K$bOgQBK*p8c{DDH8xyC&GvBqHW&IGi& z(cA$kf-l~K?=lUal!vl=o7nCMD76r03`o(Q2*X6WBjK=|HmY=v9tXTMSe+3 z+HQjbq31;X_cEIO5(2{s{?fFwBhhKxsq&&v zXd#?1#dG&c^XYfv@_U`C8729OE^XA!B=J=pE65@PPP?_YO-8DyIOdVmPxR1e@asy0(3p6VbpQ zz7(4F=SV|aL2S=s1QRenU1dTbvCTI7QZ>1lx#EJCmbWdh_M0;+^}&C^v;PnZqEYf^ zxG+Nn1Hd2$BKR1mls@QsB;G|fevWVvEBAP`cMEHIu?*b%P9FGOEpMu#rN{ddptaeD z>6H=BueZAsZwOJ*dCj9py(}hanr84<Vs_YB#wwm1yd~OyWxJ!6;gyFfrb| zb4&$8{3(8?sI$(dW@qhKbYt2KWo!08-Wa;gRt??Ch!i@y2;yKq4AG*DIwGp8xxG~U zZt&ghawyiMK}(4*eX&5je|}R1ik~yIZu3y!1VnXJa&5pnC?&{5i1Gd-|6I5i$#qt> z4~d6N85p8cb}P%&PxI6y_Qxfqw4Beyw0nRdX|rZ2GQMFs4nCt~AR&gNqxg^lw(_z* zN}Q3Knf9w9IE?cM;z_N3OMo0w6b#7%Ls_cZhw7ql) z>>-n$(>s9kpp1Io2hIA~`dOup9&|qu#?CIO&fE|7gCo@=fVLO)+?&z2J1BXF5wj9& zoTSGCMDUv8IdZ>vD`wZ|aasJ3y ztiZfRSx0PwOpC6J7 z!5$V<%e}&0v*mCz`(5~to7@#$!eDuDD-HSvG-m9WEO`*+EJvA4K0m{cz-|O$e}dyk z?3Npm5$J0P0H%xWkO7*Yg!W*>6&&Q;n8jT7PG5LKm-{K}bF@5ka*A97>*jcd*t5;7 z+dx+8Xl?ztDhH2lP96xj&nFI;naz^UGSHbT#eVl0yd$CDOce#fkf* z0-89sMa(Qf=xRw0Ioj1U>PWb52c+L8TOtEZPMfayW~8jHRVsm5zw>*kt(C2w~48RLv@g+@wrsTr?NoZ)gTB^U>gVSRvz<< zs!JdlJxjDg*(cUDf@M zAixd5xQnffD`9BClI2F{{WPy=XVxKzwFr(|J>x zq7#`@VP8C1HQvPuk=oflJI>$Mn|lyKP>PK^zIx|BKRU<(uZU_-7tUIMn1dfq-G}~2 z_m6%z^>%nOG{|#6sGBS%p+GRu(8U7FI5Z?&4OCFp715Y1^i3SX#YTdXllauWM{5;f z{iu3+tX;Mw>r?$?#ZNqGd8u#m3QIprw_^jaisOFaQ^5{oMXT{enF$qAI<6Z)`fXv3 zT8B^gsofB)vtxZq;ML^1v+h^OpoF|^AUu}VwFC;jgZPRJq`P+#>H-Za&W-YaEW$aGjJ@qxh&3tCz9sFd7OwzbVtMSlA!o|J$75rv2d7nGE z(Vr?{`s16h##U(p*o?>Cz_}B z$TWZ+2iQ0GU%eWiN#WPcA0>^T{5v(}|0gy5-(!=q$qyGt3ulkNya=cNpshn{fA&ut z2;J}MlQp^q#BHag;5+ke8Xy!%#18f10i|Ng2BJ!&lxCkdZW2D^u2}4{UJW&vQ@^{} z@k`m|B3XWAvv@GAmvA@7`qA`>rxB~Bq+f?nEx@1gE1gJiA%273$njJ0JLerNfW$WXv!*&nq1jRmcMC;)O>T_&B+F0Lt>2 zBQbIO=+>T`7QiZr##4p_0Cc3nTr+uyt=}xzN*HvBB8LPq3s5@`;vU56l$8m=;&e#? z(RU^Vg~~I3fFJ&v*g>>n+RF}}Ievkmy<(7dvQnu!qgbk8?D4S~>@Da-GS+ogOEuJx zUsVFCFNcY0YbmW&8s}oZn6NLKAud%gV(NC=j^Kd7Y^`P3Mi$#QlhmnG$ zhYoFDYl8Hn65AD>+p8iQ|DLqWcD_Q{(E_4SFxRz5Kg^nhoC6GGyDRa?mgC^$xR5)GPgWr-Cya zk!n>sxN{AgIVaU!oMs%$FNo=YR*BuMnH!jS*qI8p`>}aQ6X_ku zoi0Gzd$llR{Duuwfs=yD@r;XF4xzCgV({oOnHvK6EBPk zMnTHyhcT-D1OfuSzR+FBtLW7!j|=aQbf9Ow+jZxNeGfTvXKTqH?-Js{Q3Iy;`;+IO zU~hTP0d@!hTRDu(0&JICMq3xvzgBXX zvR-2@f2Oe!*uP`A^gl8DzvCxrOllU6&Mt=5vW7p*Eo@CBZJkXVO$~qi2k&u6Rn}>P z0HOOr{SqJI;Neu8Z(YtzX+$<#2QylYO&J7=!0h7&8cArd;b471(nW~o=Jtt}MoxR$ zJR;?I$K?TOhjS_u^jy3jVzr}=e#c z=j*?hv(>8v0C4-i>67vbs%bvAe%?^K@SwtnfqW+$r{5o#T!^(SLG!ji(=J2o_`1-N z8}EJG%%+<*oZ#AVT77zs=c+52?#JCaE!UUC6ZHy67f8wXc3OM~9{Vr0)$s<>9%=Z) zCKVR@E=JtC4^IFQ`j} zc0W7*@c{S!cKa;y@1ZUuDEB94_5X9kWSd!7ZXKtoOS`8ea{))};;xh}EIB{i%_0nvUbZFA-+3`kHENOnR-AY>ONF^fe zd!a^YHsfD{0kLMAw{rk}gjbGXGPgkD_BAQYI-_Ou^6ctvaT9AAoGhI3w`GgWbY&Mv z2jyfdCQLG+K`=I!B4?E)XwW49lF;q1$9!xF^4I*RNa#R|+^cRw3Vlc?nbk>7 zZMc~@QM`L5L?L6H%$R`@$RM{^%*0|8f;kaG7Z`x}@CWBOQO>^WB>o$+fw(!;XB#Y% zsQTB%pag0%i-Ojq?MAUP7rKtw5Yc^H#EV^;n}rSJSIIL;$MyXuB@F2?1Sj)GO}1yQ z($crR`;W&yXw(t3)G^9qdLykc{=!O{1EWf5&D zX_6|P?cF<0EZ~X1U@K?#_Ql;-O$c_f4MV1XW58QoYDap-#dLDce1|xv^q*Bzo-isU zaOM?FdtMAV6u7t=(UtfXG`kF?$R7PK(d>%?&u5rN%BTD z;N&5B4!+ovUA&}qPKO_%d9}B36=gp*;JXFAQ&>2?$hw38-_25Nu0{5x^INdMYwlS7 za^$+LP5woAmDM_WfzY--5A?lgE@Zo!_~8jEXxfSg!hLr4k?z~HBC{v%G{r9cmFIBm z(8?!>^hSj>e-$37sgvW2zPPEi(RFgWPTDL*6xFvwY-?rvx%i<-;3G0usXf4g*H$%7 zgFaDYtG&#~9KT?N9|5wUi-dQY1q37U!O-z6He#dwLsRvVgED(nedvT4KlQU_FB{u4Dj|L|$1`$H$O|LD#k;@|0x z(7z|+KXm7Rue<(FclobYUH>-~6%%mUP10&=RE`8gNYqp6M+7@t4<(p1zkJ18tzjI1 z7~>8>T3Kq&&Xy&1n`1!Y7!#zpDpHQ1SyFqV`%;9}Og$pKDI1gX?g{bXn4F2w$~4V$VmIy)h+$)9bl$1P zfXJgG)D!p%hJfKs!%^_sWaGk46U=Lts%AyYBN8N7WMtv%ni!RtqcIJH#lzjBKpx4C zTT$4Fa~pd5v{ePQc$jjDha?+Le`s(H9#h~%Wo9;riY8ZBBAP~`Wb_xq7^=6AmJUUO zRRtTdI0i7vM^6W8(O!Dh=%z1IS?LPJfj+1Ar32*)(VCrvBC*OXR|5($=_o;z8Pm{@ zrNp(uH18#C-)5VR`tgXWjwJ0S&q7o)EAg_^b1&TG@2&v!iala1=YyB`1@vKK1ks1E zV8jt1Rtz0?mvEuDf-H=T9bSL!t+>OpiT{|78qzZ*8XGaZcw$x%2+}EI(yGOf{>%!mqNU|dcecu z;Yq#FUpy|f$a#(C_HHwIvH0ai@UL5==~0Evn7_H$wcW;hy&nf9mvFg{<28zpOO3p2 zlP=^hg+#>Dj-s;AyO**_OmJVYKhmXH3)cz)50gL$_IP;zN z&vVWET(xw2qP}1JIIx@O&GIVpvKxyVcCA@*Gj9o#DI0suk=7==i_=aN{7z#1TKCer z!VL*w)@oSJ5#%u9q~5HIBB5W>ht1=t79LeYdhE`J{`MIv+iQDP%ty9&vao{36*aa! zd2=x<896mCOB_@pT{j-+1!Y_a0Y;hQ@%Oc3&s}#(7#)%+ZS?U>K(5fiq-~R|>JV=E zv1-EHo>5g)&Y&u-0hrzIaq)g|71uek!8rF1abywu#3uN|$CSSf8It@HA7u?KZ2uMG zu5dRTi#VRTdjs(i_Rcr7$(mRZ3r3^JHL zk->Tc&*qC>-|$UmF!$~cyH{_YWRLE-H<6_}h~TWnPS8rR;z1-63l49X42o`%MdD!} z)SdG1s7`s2Y;Lyw)5QimX>=$+Pp7%Pr&oSAv=V4T2Golbk$E4C-UGQGN%WddG6>() zkgFq+Nb$44@EwOH*4li1-5zd{U1B|^^T<7C^0N~!69tN%3)$V~s@sWR_+cZE8>H(o;kRavl&n zIZ1X1gVf+p$wqBnp7IXLs!+lUXiepmB_T};c<{%)+nJm1X0%n6#VMgB6>;`m7~#|O z^~q(IAssrIV7yUFBpmW^cfCgZ0Yn>sQRrv3E#tA<)?IB=IpshWmskb%3)u!7og=7D zF;O||4Jpv~nVpJSmdRfpa#&D&(evI%4(=)Ce#&XOG$t=uCZi7i zD7HGJh<*fzX(n4n5!WM7+udGXj|LkAi^dW`FIOf!Ll(=5te%EEQ`Mcdg;J=6fm;5O&9~OP-rGbIdYir+d{g8GO+miYtrbFcLtOMz8QC(o) zEi!MJJVc(wtRV;yGt+?1!@@o91ZmtseN0DXR>4~W`BPomw3uN$n490Np-1o9$Vcni zh;~x9y2{3@Qyl#%yKRNC3l5nWP7Ix@_Vr`_qzEO6+f3p_?};3h-PToncDZ!SwyfA&re zW`o~Mz{9T@fKsKlVLaEZyBOt>nj(RLs)TS&&uf?tLW4!7X zYKH5gc6^DcAgSMqMPAznujDseyWR-j!9Ea02ohq|WVVBe4($Z6$Dfo7x**pps=Rp- z+afXbn6A7p;4jaJfzMd&*R;6!c|>B`5V`^lIb4GY$T?g?*t1NVUje+`L7z;dX?YiE zWi~dJ@{DN$V45;qtXHN~7!fkKv<8!hbkW;l5G`DQDN*j>1M!8qsCOr#%k4FyJ%w5i znQAEsK#pQ7j7E85nYy;(r+i$*znPBsO52d;jwAd zdRwP5o6*GN-sKnVw+~jfg*TBPy}rY=e#zk-G`7Iqv!u>TLZ@!~FAnt-%Ich77uu_! zP@vPJhgjF@R%3LF2s)2d2?I3dboa%t#J!I*Ub13FZ6_h}On0v-!^yIr81<>H=i@Yz zS2djST24R`rJtt)tE_5AA1+U6^Dlc2AbRYeJn_*~VFp4zQ5>(ZZaW`Qx_Ki`7g zH36&NUsM3IZ_L`92T)sr8p1o`603)05Bl7L-P0xE3zmRsr#&M_a=Y-&aH$JEXS&D@ zv-@;EzFovPsuN4NxN$!-DDD>Jh6Yz5vmr8^!((4sMp7<*Mq2_&5b2akY84g zvu9dG8!7_K8_D7Ot?WN}Yd+#M32FKS%u7EhXAmw6+btFkR;)EAa&xKF__}iP4NYwFdv=} z>X|4ijsOZcn^x^4`5EH|igBA1T+%vvB-?F!)==pl78aFp9b9T{^-iKf%k0T%t{@Qs z{>|yopyD+$bbWLJK258R&csRk`qgE%tN%=ncWZW zVEm^`-bCBm3QX;2+xq)nn2F8->T%FjpDN$Mbk$57^EJz`ZlMFtaL8{NWz8)^{xqkU z6*IjAmq&CF_=(QrtuI9*qEHXBj0x`hX@hMAN$F#WS65)IP>c~^t&}SqwtQ79VtHuu ziy1il*~*yyGSKF=g{wh9JD<2ya+uC}%oaObR|vT<6?@wY^}A)yPt+Sc-nD7v-`0)6 zJ>9$_1>(WLR~T&^Ye9Y@t8x(0x!7R|u)(Iw#;lPXVT?vNB_RvQc{j2F9u7i&K@yPj zg=Ydd9w#Sc$s%#ujF*aJHB!!%T1z!kW+DCeE18wleDa#H4P?+3NQ`7=Lng~rsa5y^ zWt1+DNyU%aTv?>{GfNR3hmdr8V+5G>VU2J`gFHJ8}$ zs2M(X$nv|W8Nxg7XU~;QSw|j^s1;%(eQwCwdHbi7ijx}+JBs({z(jR0OI7+Ut<`CE1vm4t1a6bTipH3BeX@MEamwL7RH(CIG zxdXTI?9;)p)54@_fu)iMW;MA$j+IW~CH0!@q!#h>J+X5bxzGDn0Bw{ytUJqP%~@0T zij%gvxD&Qcwn8^=U9-smeCo9nQbE^8sM<`2Xss0Dcvf%)T@0t5^ZcUKi`DkORwR`h~=Py!Gg> zOb5sj0^qOQ4#43;Kof2Gd9`J$-PBg-CnKpb1LBSbWk3Ihiw9tD%LgDwNVluA1CX7m z(bons(Z2tliFhSQm1nLZ>XPn3M`gXH z^+Mu(r{mIyF-XQ5MT)oM1B1lYleh7=2hY1iU9k{5LAi00?XSDeX~<70uX!zpl?eh3 za3P^k94x>A<@HsgtZqs4knM_001#~kKHU?uZ4>syX<)#AYFVzxEvKc_ErSKb!lP=cBE>rLKeCSG&_nZy7)4&ZQ zy0GjGK09&!3Z(^T4F(gSaZ%CVr63&_--H8X2wPpBsq&=gC8Y1)YX(03f=C%FN}zkz z-tR08#ME}4i%!YCRG?RM(_iv9nCIS6J4yHzxIHOj@m)6K`uJb|dyCY!(&QflLH|!Y z>)%JS*#F65`0rJdf}P`kO5qNvPW(CBjPNJ&_XIA)p}rN}OaX-wgV5QHWMyH3SRxUk z!})v1ts;yT+ZGp{))O(<2gb}y4dq=UpRR&wy8f2#oHvAm9@9QAvebh1446%g|GY$x z4$Fupfl(WPK@u&a`Bx~D`&}$BR@Qr8UiD7l7LHcr{Q&VtkyhnVVX+3tf+K$BI^pB5 zV~@|~KtM1soIRq9bXvUp-?9f=*&h4A3YZ(nl53bDtRdZ$=FIa77I=c~1YBWl61t%F zJtR}gW$@fb+KwcfTBsCnbSTARol^ABKXW4t3iGgd%6;-=gmt^Z8 z$#3sZY!V&@%rSrnm}@9pFR}81w?YtR2C|1gPA5ZCl75B2r1&7dSc(J!O0ogBf@q{F z5#H!zK@2m7KtXdEfq7m<`x`41#FV)YoEw2%*m-xSGcSo-laxNo=bS(v4;z%^^q(1H+J@ze|4L zyMebVz=V#3JkAn@ZN2#!bI~op;yZ=AG$*>FPES6?QQ+>%f55itksEJNeud=jW3{V-^NN&2 zZX-jb05HKH(_4L!Hua0 zEk{kI9#e2N`+mv2L?%SfLKmKUX}R;VbDu7&k(BVU%qY#1de zvucfhK<+MbV~4iY9H8m!B^-22H%VPcrhVZ(t0cvCgeA%?&Sc=!GTT(qrw;M6++@AB zMY1)bWx5EpXS}T%D`&SB8-ym*gW6SC&wS6)MyeVTDp6ew4~egc2Pix$g}OlV~GQh-4cv}w>d(-b!0Ir3+)+Re_goaAhZX(lO4aO_li6EA`% zxBP6(d}O6rP(#5$svSxscdlF_GA|^u%}<7{ySg*u@iPP-@H3&2l~9W$S1y4>I$Jj5 z-auj(g^hEfz0ABzmL-volvE(O^phu(lANA*bcP--GG-Q#`B;yOV0dv3lq5_qPhRER z0qEzS@;es#WotZMym!h-Jpofenam(-CkqLsUWzPH_RNuMb~?j&?O_I_}qJ1PU z_a?nEVrRUvx?S6Bccgf(J;NA|k+A(x@`>876KHunVFoZ{w2B(@^HiD)6v&WoPIgrx z+qtN;R1@tVke8SnH3ceXph)3LB8XptU?mX8`F1393z3X0oiKLSt=MU)OEJgEFhQaj)up|&i$YdBj$ zYEvN`B?;3E)??>VPGG97vaBVN~J;T<0E?&V#7E~BZm(&S_ zp?ia&|9bjKt=K^7k(Z+s;4;l0DmrMf1s^Ju@EzC#JLT0#)}ZpgT6+iZyta02G`8)e zu^KyVY};mIvq>7GjoH|?ZL_g$+dS#oXYZ!{zi<8P+vhy*HIw;Xx$@j&%z-%`yV!nn zzu9AQyS0u6l0Mx^=O!-*d|Ex+2N;RM%EEU$DrGkH+y^5sLra9wHt-10L&GZ}YhZKd z#{~kyuvD(B``YIW<7+Vh@lE7g(Z@BFF+Zg5sq)@_XY0p0U`q;0nVJV}!Qd#z5J>>J z8XJw0b`9N6if6&CE2Rv*+}2b1-^W12yVdSGv;%#wx{7HNN}(-)D5ZVeY04aJxlz_o z&O>H2jpTdW6+8_Nun&#h(c+oC)_t>7Km(K+Ph!}T*=E2@&1~|+_*bEa zsLW}*)KKsR!;wxJ@27 z_|ND#&wj>f7Vtr{xNZnL$~{uRX*PG~1|db<7M_@s#vM;kX`$RZKu!bAMrit^KkBwl z#WQC*Qu_ftr`akMf9l678CIC9I`9u!Ck;m=2V}EbO@O%M)C7Vu;(8FXL@WFal|1Ut z$RY=|$3<&Uh^1*=3bz9gm|@wT1pZ_8BZk{%2#zMsrHB~q##P^Wifiiq1NED*_i4Wr zs%yMgNni}xDy7%+_wUZy;<&n*Q04Mci%(lU*J7U3;p}yPYWbk?eyUG(RJ5KD&^o5o z2B$eABL+MBU~#U+g{-zP@W+f?*A649tYe!)GJ`ATx|IzkK>I+>p>u81Wwqvy_r+#7 zFz5XRBWUp9N9kB%tHfM@?c}=1G3s&}FStv{8^kDHOfwbJ-S`IT^2NPAI2S$s|8?M( z%DJG6c=d>E!u`7w!=E0J|9yy6V)*CrnJVqC{v$BW7pV7MMxVkKXR|Bg;0)E~3wznb z&Wez8YdYb+wAO6+qU_Spn}}Nlq4rBl%MmY#43mq}Z-BCDpe2~gm^{z{ZU`pqWb;&H z*AvVbNc3dlz)I$)MV|%oaxbt{@~Wq}*nZGMI7T4-6h|vnI>F2j}l0 zP`w5d2PnRtgv}loXrq@)H6>0cPCc4HgG_djVGuG&T;#w=Vd@-IaT*!V0u61#TMq>w zr{Ly8(H}hooQbOsFPCtt+WYxI&zW}#nhieP{`%1=yW)HF8paT??~^D6sIj^?+V>ci zQaDu6>USv=8L*01cA1vIdJz&l>ecJnnr=QjVg*J~%zh0~j>=(?iTv>esb|o>AC| zjF`QzhOIM8;6Z7h#C}&2#U!uOJV_PRtOsxz!Cgk9rWV^#ljSNaIkH6Q&kd4QKw-y-QSv z?i(5@^Qqfe;>2JVY7U!J@Fv(kxZ{!LG44>S>X4dVToe6cjsjsLXYzIHB=qKvpy1#DLgEeU z-ia1bACJD0aK&Ts&&|hwV%BhM9{rP~K`X+3 zrowPaN!{i?PTgiaIM)7oD1HAGN{Q*!ke!G6cMFvE4=M8>NS8-yl6Ld20n-;$*RvxC zF&ggTB4oLw@n9o(?`Q>(7i_P12U|}DW_xmYynKNPq*w}<+^woTD*IkDi-aL34QQz4 z+amvv#cl{}izOwhBuViWo0Y6KNOW%U5{jd+HLQGYQvGbu5LMyr^EI;AYzKVRb z3Y|&UYR(hZ6%s4mP$t_b2?*2Q^7KIH)c9xMdh?#upjZUr zDPLWU>Kwnig5#-U!X0AQ^0>$gi|@j%31b@g+3{`*K=J7nOvMJXOCaP`j8ld{vhkPk zG6ktd)sKQG)z00A5%pfXOOD7KyG_&Er-k*yPga367(m;la2z^+dfXyT&qy9MBi%u%0A$fW&meY*t(;DS#NK zrh2&2@!(W9wHmh|6}JAOvSiO{0i8@CJ&eZXl!fHxzq>QPz3869%IWB*2lGZ&^IP%jbr*~O?^lN@(^r34{(a`m&^Jkm|4z#e$U{sizT6Gn4 z#p;<(Hs?O-R>Dx9Ne?K$n!QnvW2n&@D=eX_NwGDD1uuQ!g9k6gzxSEO960d5W5#I$ zbN?uy{a=}?G_=@f@L$)S1@+&py+1QmN$J{~I2!(|jCKFYwPZ@=zoYPm=-CCVJu|>p zBCBRK(;U3#*`f7K&5LA4mH>WjpMK1a8P)AUsnOQo@Epf6p=f0=nMjL`UXCq{3_F zR2={j(?75yW~{$T{4!v=1bb7K%w$_=9Ux06*Wght9Wt$g7{x^C#mMaN0VT_}id4Q7 z&p;=ZM4TZ_**c`d5W|P1ET)HhxozX(8)%ghbbo&Es$>If9W3u26Zr^_3=#G{XOw>i zMG;+%LaBN{=#%%|;Kjv6SoaL=Rp=_7HP~FY|3YmUOV_nTo@8G*hTT~Kf%{e%kO4^k z^wQb;S=D52yH8q}CG0$y5w^A@{foDwh~{G6U!WcHAcn%H;t@fp&{jSj%yv8ghh({L zEkDmWYU%`Uvutc2+&&!>Y&UH@UB-to7jAlbsz=k)=&uU_N=&Fg4N0SZm!NROs4`WA zF1fqaMdLgb;#IqSw!TmoW78GS2B@W|Wh;$BYSiA!Lc4zt2j+Czo60R7?;8mn9V}Zl z_arSo)y{2N4cmf@&t}7Nc9#sbx!Z--WUc~$XGS?vk4b0rbzLG}?o&`~sGs>BnscdC zdC9B$C8PGx zvXvUd{8=pPeCjU)TyBPTtIf6`rSrJTYC&HDrcHbfz*vvSVn?oc_R%}`n9{7Pb~5aQ{F7VLSLqIxa{57+h#ud^joCg#M5$kcL% zHU{i{S!o3yaOybsJWG|MO>=qxw_9Q}+TEi?971K6_8Z~sq(AJYi$?yj_z9VliSdA|G91bvTbtt4Ft!*~fXc~*G z!^DXNZY%nc1$&gk_k_y?Oh(;gQs;av@C( zTus0}Cb(*5QoaQ_JROQZvE-6QJH53RwO@T50!>>jG(&eLbn>?vpYDy&&0F- z(l-Rq*=QEklMk>&>K9?IuonI$ECBjnk zdC6TxcU`+Z58qy};Y9K#%j^COc^_B*D%xVuwxm#@cqGEDvvnDyb#PTc*n@*vi3$)k zL>P6gA`6!4vlBS|R26}3zth!-aMIFH#_RMXGx0%hen+5q$~8uwVQhL4HiUx?qCE|y z8Kp|igv8*T?SK+~n{NS>M~bjGxQxn-Zgu77V0%FuGgwV{>Vjb@g_KjgybsBm(P!_- zhV`ujYbhr;MIp>kDf~#Wg$&nJ#$@ypOO24V%)(se3j zlje_nc&O8ZCc(`Nkq5g0w@yAE%>|DJM;%%_r?>OhFq#_nbvR%R`fZ6wQstl_NFnQfGp{}AL?5A5&{-+P5f!JE(t=YI zr=+gS2~`(i2IQNABk*EX`(mbyU1X!5oXlORM@*qig3TpW_z;%8O}}ri_MsTIhlxIt zm8ozLoGsqHmHoxu#?FIu@9D3U4#s_-16^L#=;MDIS;6whH2;6Y1pmR&yIOfcZi5ZM zeTV827-P1#$;C51<0~vCl95@e!q-VD1$}WmQMjmt`7bM${VZ_4kfcN6G!6EtEyMVesx<8ig9hV8I*UR+&epDs37SA2vNvAK&vGXZ6SF&9XX>Q z#=}Dmr`c8FvNSc!w`=uU_kxZo$*JV0<9i%k+1D(Y2j(`ctwXAj9g!FU-kct`wgXwk zlxF^Qkg)oGG>AQhi?{^eeHK1JenS%!nof&0W(y!pu{c8Iky=e}G+CmoWX9kzcM$q) zL#6Hm5igo!Xuxx=`U2u0Uwe1cbYi{H|dL-aXDK0xhn50Z&jD2u~Az?yP8v)CD@DI)9WBBi~zaK;CyT~Sn*WN zT(;OE$yZ_;Gx-XlXf6Hu)f%p1p}m!6;8t{y!WRE?ewc=}|QO^8mY z`<$$u0&7YPwcmxjsJ3dV!nsg1P2VHT9;b^1TDzrHl8z+p$=L^H;$toY%_c1Vj30=ZmsBC%pN50=#cICjIB z@I-?BWM)4O!&y~^X~hilxD1?QvvAt+bgaO6o3<-yUq3I$@2!B1GK7z9^|O z5SAd)wld_qvJnn5LTRqdWd-NsN@9Q1)eB=^x{e)21a+X{1I$>sHAA3mDX zmkf>LQsdgYE#@CqFa0mcC+4sU*Ui>`(Mn;fL+Xp^mwTVJP!L2{$fj?;1fw~5D~-zZ zU11z5A8pz(KIG{hiV&_aZqyKlUoJCl>tY{##xOd7%FSz;!!yj2iD5}{^kTir>!&!W zL8fBVGt@Na>yU)I?yK6HmA|Y&kPkT=b6gXFKJxbEaEsxjA*GDX=dVN+fa2b9W#FJD)DJRV5 zUw-Noyb~TT++JVfMM!`58vj2m*Cv(*hPFyp<_;Eb;vxT~sjFF8+-`vdq2)k%HP(?- zDY?+nF{$5~!-S!F9*>=%jENo$5DlJUp!9@>XCR!qJ7@D=2xzvu_M4Sjp;yFN3+ zVOA2Ci09^FUHIJjXzRfqwdyDDE+Vd)Wav`!=z4SZ)sUI`fR}n2wDr3too?eu0uuY0 zZjo$)XVwx>2X0*qQW=iUP=881@FVG%(v@PGepYA0L;X=ZfY#WLK}L^dAb7h7oe{>N zLWH_c?X(sx_)e2h22*Scuw081XXNw{D0nJ01B`qfIG1oAzOQ1k29w3ZeNoL1W}c=$ zZbpTg8TzPBA|YyZG75o?0u!p+X_UQL*EX&Qz3s!lcC?O1s8h>2#6rEQtmI`>js+$| zQ0oo%95Ub~(5UHqR001%pjF4|i~Ga%)sL;*L|tL^2_^tG#wdBEr^$0u#;~w!SqRR!ZNA3w3+p!z~MnB&JYHWW^OOx zo!U7(z65W&`GK9PnV_;v!JFyqbH+enQ1EDfaL=nAPtfCGV_MgNXbP9ZO<(|Bx9D_( z=VON2eDDpFqvdEMP>~aR9M~0G+?An_bbpSonGXQM5DQ;>~14WvffB z>B>OaL-)Qxa*N)&0ce5O3XYxbC~4~|I%{kt43pkE(Gf;;a9bQMuSTx8G zXut5>iPbL^&~Ja&0DPIa-2OB;08QoEd*gfO)5aD$3`LGXOyKt5O)m{^tXnQ>{$uAS zC=VrvOZh`*C)}sq{==`JX0lL?&|&oC6n5;SYTpF=kU=w`nx^gR)?@>KzL|bMQfNCo zJASX3L45dVCV{`{mn=xzG_M-ivV5maG1TCwLg?D-p{IYwlvR=N@_K?FkWVkLdv`3r zxy?|cjGRkYSPYA**mm+zcgnklw}`0Y62;Ru39Ke877b3zto=;suh{Uvt5)wsg+a$le3UDRQu!5B@ zu-~f2qfjzr#zrIXKEHJMMufv)Ald4LtuZbdo0Ycmcno7bay@v^E#*?xi}H)j>}twMSEc2gfpfw z{~*L*=co>SjL7K|?ZW77C$re@%D3i38hDBikIddMV-f?|w`-Uop<)(O7}ky}1Y$i{ z^phko(@MoyB;*k8W)yF|y?g#E>E%RYcFoi44tw>tTHAN8CrDmfdz04)b9+0DPgeHt zEv$^+)6vthz1Op&XJDnLF|>57jvXvXmAZ>ev^?RI=O$SRKUU8 z!$LvH3fMn)G~vWcK<`U;KoHbC-TL@MtuK;o8nZAxJ^Vb(ohWIT(KBtVE)43M__Y1- z)I0xoq$U!vwUQNaGV2Cjv6%?b~P>%-&uyGT5|anYO+!;hPG+s#G=T=O)l z1&{QX6BoK*M@0728kvrFy|YGsuFmoD53m0`oi>~#3ZApVnxT4dGN}3G9p4GzAq_)G za|8IW7~`cH!6-SCixH3#lnsn{;EVphdH$+wTa$x zDlsZ+5$jdi(2qzmVMsN}BTsWlKeqK);2W+|$AP5ytTs%$H(TS1B(hogsV~_s!0rt@ zcwegGccY3FEYxt)t>wt>Imzu#ud7u$;1eKccHq!S7ZGWIcqf3()aylHu|JJt1+p$H zGQ4A`tJ66cF`)HuZ^E(xnW%OPvq%m)fk0pK$!YCSLxnq5S^SI-BA;Y!qt^yIV3<;O zIz;i~i)Ij_|3lLUp*Zpss05`ci(CRi-_OH0eSUWGvmFu_rymt}Cnx10m&fA4xav(k z92o}cSv^j@HP`1!#2x!X1mg~+&IcXIB6}VCy)~D*Ml3thgE$)bCs8#VD>)lGeE5TF zYw2xzCNUX}4>|RZgZ&uclFIFS)+{8*avs1MN*0MPM?_&mu%k2=k`8Ap%~)x0)pwQk zuk!tcP3?;Y<(avh(+wvC$c{2!av?_tG89d80q-&`3ZE>6F#=NB5Tj42yFLezEGPFL z-yOt#Au?enEhmm99#Zb0jIpMK(f=M0Y1ZuHr@l}%qgYC(nX9;v-1}st9B0TWt}*ls z3$6*USM(viN<_W%jy|&R>|{jS_XayI87nPK1NF3}Xsmt+Vey!2f@7_mZ_+y04XaCp zKAwQeK_?5MtUB(6w8mt-qK*olf|MaTklrY~G+Tf^4y-)^@SBYYh@%T1j|wwB!v8inIo|tD)GE8nk=vTroLYIcyt;@R5)>@IxdJMq>QguWvRZG zFFn>BNK0FdkU|AQ6BQQR%{AY*hI8VqSR|nLNFa9%bRwkV!v0vn)ru0nr;&GmEmR`m zk^;3?6>lxn-yMZsg9zU&R1ra51sV%Od)>lqIT@LOq4#~Xl#nzOl#(&oI+5m5oYLvM@2QP8JRg%Z~Gs z)8^+UKu9w>^eS-=i>Hu7ZVP! zFtF72QD0$0hG4HK?d;mr+M&cLq1&K7YT)uCWRUw4VoQvkPBt;r(PN->HQxJCw3C>n z7pc%-(8d;`{naUDTy~!D*CwO?tqa!wecyDkFkjM84_l~1^?(n5X$#ff=!rE(YO~ry znFae4$-B731>%(!u}hD=#50g0TKjzR5yc^$T#T^y+>qg+f(kDs>;tPulQZk=;3AB$ z$*$q-lJ0;A5^V%yB5h7(Vt%Fb)BaT<0Ap$-(_kXYC~(Y2nHsN`a|*Xk829^gY`yrM zm(^ssFjvG8o{jS>D&O%o!|y5iZ`d?4 z8e56RFt?Hg)%6t~ImM>w@P@KQVKxHYH3*{mKDV)31IHOgcfrGEX)w&>0Iq$-K1y@N zb#3&;+Vel=YY=ap9N5ViB09?embl&OB*VtGwLx_wrrIvR2GXea!>tFR;xCBO4ZyH9 zH0)J`b|I!JQ6OTV!Y-kf%o`#y3^2GDpiESztf&WdSy}c~THtMzRfOEVTuSh;C@N$GP;oEbl`OwII~6F7=nN?K zG2+5Za9v^RT3qN984f6iL#Fk?>~!{rMI?c*9>7hXn}!CIWc9a{?c&=Y&?nyXBOs=) zg7H(ga7P;`S6WpKNWg2NT2`U0)7x%gw;P1S{kp`2Ha#Gll%Re~1%bS>L1{4_U(?8( zRva??IblvEc8ET8i0pxhNjO9xeZ^HMlJd!I9tbqruxym9QfF*HmX?KeCE$n8^+aGa z!ZliSw8QtZckg`W=10H5hUB4M&NY{#^48=9Yq1%OXw4y^r~nTa$z0&^TgS)*`E0a7 zfo=xSK}8_7lL0dOwD|!o>qBHk=O_7A_UUtTcqK4dU)9!t&t9kW0?ZJ;W*o9+E?VRR zy>||1B1rpA-|psPf$~(uH<+AEU1z%b0ggK22&kyX+qq1D0losu58Rhx$PP%-HUXj< zkM2N6o>0%DCa{d3i2x~9x>HWdNe z6xC~m2Vt$7j`u$4l0>xrAq>gKk=7ia1o9l^xsfUwAfc0Yqeg>xETM1h=p}pLZH~@V zSeM0inR@J~PjT#;G*DQ&x9tjinF-u}P)TP+Gh?}tES9oaZHuFSCN}F!BOdu6654*1 z7?rm`tQ7@*`7rZkpD=CgJJDu{C69UZHz^1XU2gH+AC|<)Ss-SSk`{|4@+8Fw!iAQo z!GO>tio%RTYKz94Rix?m9ohZHnc-)RL^(vMxR)Xou=jQMgi>?PxWLm<=K0!5=-YUo zCaZfyT8d%^e>f+~0;rZi)vpW;_{xYyp-coT?Ve+@N?pww}D3#E*TsWOt6x@9F$VX*ZhafFFQx(FF80$cTV2A7CxD9gmegokQVG;2q6iw4t^L+wPs|0P20N?GmRny8 zsN%U@=uE{ncUhblMU=z!t}Jz+POd0uKi>k|3p$R%cDTa@w~iMLx8IE$wY%WdLOjX6 zcIB+}^Z9j3m(|I~8WWZe9bIFWa8oe&6bnJMNYJ&%3!9U}$IqlL3|Gv#aUBzjB!Ej*}MKn1jf!NgX}eO$%#e z$4VB-z=@5LvH-!!(gBUVW`@0njlJfSecB~(@1E@n&ASe!wXK+A{0s(O#-DZU--WrM zCJ>=mRUP?hMQOhT8H<-)c=sUSOWYh;ec5MP;J=Q>EK9g3sr@s_$+r?q3RvX`-=7XEpf4J4`##Fd;J$V zST?6+``*J(@$TJpx5K`0(l-lMK+{GovVgm!UpjIDHCsqsdP7>;rJ;-3?8J%KBsw!k4j7yM3=vyJLmp@-1!A1*@BEe2y?XpT!~tGChi7 zu_qOBA*i}6qM5dPdZN|RpIYV z;d9PqavR<3hGDLJtEgQ5R>ATOyY!eE#_D=jTt`H)D|w$(E2PdV@iq?Grr7Wd2k{0- zsey9+{=no01J--sPSM-c29mehnU^=aej1l553N;9MpK(lMzb|K?OfV1XL}(z|E`Bq z@ukSvv}HIx;Y$Z2^U(`5z|jNBhA|b_fNrvG!yOrC5#v(1=nE%Bnx}s9`@1-g1*eY# z0xy4s&j3{TnJ2v(SZ>t+?)>`G$nr}>7PU08vbA{iuduSzHP;Y!FflOHP?DF?e!UpA z-~5rr-r4?0Ro3cN2kBwy`5f?BO2uaNr#;kt1ERcD^&DrroXetZ>)K2S=E~Vf*NaiSPXZJ8MaWSSGD=Drsb71jz z=?W0vV9Vr6{j#{}LDwl1qhqP%bpV1Bcli{Y6EZSTjg3BjGPpCl+TP^cW40MJ^DQfh z3vAL!l8HB@uuiuKLA8yh_K7wH`X(2(N-Mqp@CY+>MVHty8lEKqdU~FfqQ_$0YYVe) zJu^&mc!;1#n4eeKw)lyoSYd5FNIXC;UIoCXGBi;-(Io{6lgF_2V3Fo43l_F6)jL)| z;^98QIF@^Cl0L~oHKv1a*8s>7dNtYB&m!%FH|c9)gxh@%nRZNHOZ;t6w0zN*w3vcB zj-A8=nkr_o)r#L01Pj0BE_G6HG0SMlv$2Or3_r$x=xN+f>E_5o?!+5RyjJv`>Q+R=MV>XdT-%}}i z-jZ8@tpdP8RgyT06oSUkiEpA?}q-eCJK&YzB?z;DGh`)h9M!rcBrvN+ol%=QUS zN`b9S^n48`^3ajI1I7uvdsa(LX6W5;4v%UC1Frd@Lv;DUN^d|v{W!mXw(!i|LRr?22a`D`P5ZKK8Mf@) zx~m~yZ>aj#zH`QQef`YqE&E^P)~464;o(~GTXnvq!xjqTD>~Jl*@4oS+f(|X1sOgu zJr+9SG{0;NmY&`oIE^3Ndzx@?#F^J;brq?|`JZSv-#^fOS*dr1Qast)#qf+J!P5hm zo_&U^aTvHPXre3~C_Mk4Uj;9*l=r$3H{U0P%ZKewj68(CH+H5zRBv(rv<`T%J7qGz zio{BP>k|Cx0RW&NEzi&UUh-8EHqf=#)%fe{UxKk@a5=HtU)vWDQ4f=m=D`Pe^~4iHeC%^a$t$So|YWX}R}cV#huOk!`h16dC|&t#>kJIa4<08+pIOPoJ|n9+B5 zZCUW^_3wpZyx%qzN2B-VuVqCo?F?VlZw7|uG|m?07V=|}nFI)rF~#m=I!qbLNs2({ z&M$3ypNizm5aepVw00RB*p^7o^0UG$5j9?Y!cwQBN}F?}Yko>5t9*8Ab!~lYbLJ;& z^z@n@8SHNWJg7E1`$CwM)c3jDQitOpe2h_{*5ny=hE)|^GUfb3{pJTMd08gJ$Y|U6 zEwLcR&QeOW1eSjx`7<8Xu z;qWz3`OM`E3byN`Ga^h#k!6L+h$D6+#xnZy4Q^F>AE(+~tK|bMU7^O3bcFCrT?mjQ zoukiK*AKiHomp$76%{rzCAlrPzsTar!29^{t|arg(;Yo+_}Mo-9nphl8-r*QU4nCI z0d+knurjhqikA3_p-@y*k(;%fiH&5TH1$KpGq@3OgxZgdybQve^nl`rpe(Jt zO@TA8n7*`tjgzB_xR*0ma#jXtN~CdEgs;L(LWu0cbq&U$n7VN;7U62qYmLgnr+J#N z<5cg_<8u1H1X?@8z!}=y$Sd%%L*5;qpxgE*GL?* z11y64N}APUkmOj2r9@P;A9aWcWXFwMQj83GovRbuf;9@qPfYP#LAyV&(0qdvGP>3I zxPz!XM14O7EE>}&XOs-+1EbOIsplCTg|FkbxC|4_`ksSHcI^=^d42kVD#5InX_=Ud zm9iac&`@yBbl4pmnW0d(-7CprLxn? ztL2yXU;a|p?BouME4_}=^sBRkj5r_=3c#;&zi-QY{w(+VJN^Gs{P$1DxAho*dS(71 z!kLtv-a9;0>UNafKh5E<#pS83-&+$b^p8U#eV|7 zO=T(Y3-$HRl;qz6|3|rG|3rM7tdH+E#2fN|i})Wn6aIC=Z+HQ(p5AXC?Y~P1 z_$SA=xd49O5n4EZ=lIWZCH%?%ZD99Lzl>kB|KWH3|2-N0fg9SNAaCQJe+O}Yo$YTQ z%YP6t{wK)WfV1B>oJOACL8Sg^VD+C6Z$oB&U#6wPzeD`@!}<^6*!~228zb;D3g;Ke zysp}}5AA<3B5(a|e}AD3N&U|JKMOkevlDL}9(jKC;Pq}v{&$@Jd1C(`mfu_Vqo4Bq zFX~eI9qpgHRQ}ncw+8s%=W^DozTxe#@c(nSrawX68V`Tkq<#^Y?pw9Rzp?E9$?mO1 z@2AD_7nK^kW%ob!$3GdowVu7c@7|D!;adj3nF0S~@>VbNd#AXJ-ZJ@Doq9F9{mJgF zH2M2rQ&_)c_eOj3e^u@LiSbtI`ze?Hq7J*iky8I;^H%2gDI)$N5Bs-G{Z|6xpS<3l mjDJcgzew2eH(vinW|0vGeLYG70N}lTq@V!+j+}me`+opq6}FWC diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup deleted file mode 100644 index 839a192ec5..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,159 +0,0 @@ - - - 4.0.0 - - openecomp-sdc-vendor-software-product-manager - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-nosqldb-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-core - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - ${project.version} - - - org.testng - testng - 6.9.10 - test - - - junit - junit - RELEASE - test - - - org.mockito - mockito-all - 1.10.19 - test - - - org.openecomp.sdc - openecomp-sdc-translator-core - 1.0-SNAPSHOT - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - - org.openecomp.sdc - openecomp-sdc-vendor-license-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-enrichment-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-impl - 1.0-SNAPSHOT - runtime - - - org.openecomp.sdc - openecomp-sdc-enrichment-impl - 1.0-SNAPSHOT - - - commons-io - commons-io - ${commons.io.version} - - - org.openecomp.sdc - openecomp-sdc-model-impl - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-manager - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-healing-core - 1.0-SNAPSHOT - runtime - - - org.openecomp.sdc - openecomp-sdc-healing-impl - 1.0-SNAPSHOT - runtime - - - org.openecomp.sdc - openecomp-sdc-healing-api - 1.0-SNAPSHOT - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - - - org.openecomp.sdc - backend - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java new file mode 100644 index 0000000000..1c728bdfbb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java @@ -0,0 +1,25 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +/** + * The Compute error builder. + */ +public class ComputeErrorBuilder { + private static final String COMPUTE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; + + /** + * Gets image name format error builder. + * + * @return the image name format error builder + */ + public static ErrorCode getComputeNameFormatErrorBuilder(String pattern) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(COMPUTE_NAME_FORMAT_MSG, pattern)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java index 63d716504b..97476a2dfd 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java @@ -17,6 +17,8 @@ public class DeploymentFlavorErrorBuilder { "Invalid Request,Same Vfc cannot be associated more than once."; private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG = "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s."; + private static final String DEPLOYMENT_FLAVOUR_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; private static final String INVALID_COMPUTE_FLAVOR_ID_MSG = "Invalid request, Compute Flavor with Id %s does not exist for VFC with Id %s."; private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG="VSP cannot be " + @@ -92,4 +94,12 @@ public class DeploymentFlavorErrorBuilder { builder.withMessage(String.format(FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG)); return builder.build(); } + + public static ErrorCode getDeploymentFlavorNameFormatErrorBuilder(String pattern){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DEPLOYMENT_FLAVOUR_NAME_FORMAT_MSG, pattern)); + return builder.build(); + } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java index 95bff60479..24883b5c13 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java @@ -1,13 +1,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.errors; -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_NAME_NOT_ALLOWED; - -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED; -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT; - import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.*; + /** * The Image error builder. */ @@ -15,7 +12,8 @@ public class ImageErrorBuilder { private static final String VFC_IMAGE_DUPLICATE_NAME_MSG = "Invalid request, Image with name %s" + " already exists for component with ID %s."; - + private static final String VFC_IMAGE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; private static final String IMAGE_INVALID_FORMAT_MSG = "The format value doesn't meet the " + "expected attribute value."; @@ -28,11 +26,24 @@ public class ImageErrorBuilder { * * @return the duplicate image name error builder */ - public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componenetId) { + public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componentId) { ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); builder.withId(DUPLICATE_IMAGE_NAME_NOT_ALLOWED); builder.withCategory(ErrorCategory.APPLICATION); - builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componenetId )); + builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componentId )); + return builder.build(); + } + + /** + * Gets image name format error builder. + * + * @return the image name format error builder + */ + public static ErrorCode getImageNameFormatErrorBuilder(String pattern) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(IMAGE_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VFC_IMAGE_NAME_FORMAT_MSG, pattern)); return builder.build(); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java new file mode 100644 index 0000000000..fc8ecf26a4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED; + +/** + * The NIC error builder. + */ +public class NicErrorBuilder { + private static final String NIC_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; + + /** + * Gets image name format error builder. + * + * @return the image name format error builder + */ + public static ErrorCode getNicNameFormatErrorBuilder(String imageName, String pattern) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(NIC_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(NIC_NAME_FORMAT_MSG, pattern)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java index a2d1d708c1..cd102ebb1d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java @@ -12,15 +12,15 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; -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.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.errors.ComputeErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; @@ -34,14 +34,11 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEnti import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; -import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.compute.Compute; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComputeCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; import java.util.ArrayList; import java.util.Collection; @@ -92,9 +89,13 @@ public class ComputeManagerImpl implements ComputeManager { onboardingMethodUpdateErrorCode.message()); throw new CoreException(onboardingMethodUpdateErrorCode); } else { + //validateComponentId(compute.getVspId(),compute.getVersion(),compute.getComponentId()); - validateCompute(compute); - createdCompute = createCompute(compute); + Collection vfcComputeList = listCompute(compute.getVspId(),compute.getVersion + (),compute.getComponentId()); + + validateVfcCompute(compute, vfcComputeList, LoggerTragetServiceName.CREATE_COMPUTE); + createdCompute = createCompute(compute); } mdcDataDebugMessage @@ -108,7 +109,7 @@ public class ComputeManagerImpl implements ComputeManager { return compositionEntityDataManager.createCompute(compute); } - private void validateCompute(ComputeEntity compute) { + /*private void validateCompute(ComputeEntity compute) { Collection vfcComputeList = listCompute(compute.getVspId(),compute.getVersion (),compute.getComponentId()); @@ -123,7 +124,7 @@ public class ComputeManagerImpl implements ComputeManager { throw new CoreException(duplicateComputeInComponentErrorBuilder); } - } + }*/ private void validateComputeUpdate(ComputeEntity compute) { Collection vfcComputeList = listCompute(compute.getVspId(),compute.getVersion @@ -347,7 +348,7 @@ public class ComputeManagerImpl implements ComputeManager { retrieved.setQuestionnaireData(null); vfcComputeList.remove(retrieved); if(vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) - validateVfcCompute(compute, vfcComputeList); + validateVfcCompute(compute, vfcComputeList, LoggerTragetServiceName.UPDATE_COMPUTE); //Set format to default value in order to handle FTL validation when compute format is null /*if(compute.getComputeCompositionData().getFormat() == null) @@ -384,22 +385,32 @@ public class ComputeManagerImpl implements ComputeManager { } } - private void validateVfcCompute(ComputeEntity compute, Collection vfcComputeList) { - if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), compute.getId())) { - ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder.getDuplicateComputeNameErrorBuilder(compute + private void validateVfcCompute(ComputeEntity compute, Collection vfcComputeList, String event) { + if(!compute.getComputeCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = ComputeErrorBuilder.getComputeNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + throw new CoreException(errorCode); + } + + if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), compute.getId())) { + ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder.getDuplicateComputeNameErrorBuilder(compute .getComputeCompositionData().getName(), compute.getComponentId()); - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(), + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), errorCode.id(),errorCode.message()); - throw new CoreException(errorCode); - } + throw new CoreException(errorCode); + } } private boolean isComputeNameDuplicate(Collection computes, String name, String computeId) { for (ComputeEntity compute : computes) { - if (compute.getComputeCompositionData().getName().equals(name) && !compute.getId().equals(computeId)) { + if (compute.getComputeCompositionData().getName().equalsIgnoreCase(name) && !compute.getId().equals(computeId)) { return true; } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java index 7069d778a7..2e964458d5 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java @@ -10,6 +10,7 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; @@ -23,17 +24,14 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMet import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.DeploymentFlavorCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; import java.util.ArrayList; import java.util.Collection; @@ -112,6 +110,18 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager { private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity, String user, Version activeVersion) { + + if(!deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = DeploymentFlavorErrorBuilder.getDeploymentFlavorNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_NIC, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } //Validation for unique model. Collection listDeploymentFlavors = listDeploymentFlavors(deploymentFlavorEntity.getVspId(), @@ -357,6 +367,17 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager { updateDeploymentFlavorErrorBuilder.message()); throw new CoreException(updateDeploymentFlavorErrorBuilder); } + else { + if(!deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = DeploymentFlavorErrorBuilder.getDeploymentFlavorNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + throw new CoreException(errorCode); + } + } //deploymentFlavorEntity.setVersion(activeVersion); DeploymentFlavorEntity retrieved = getDeploymentFlavor(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion(), diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java index e180138119..6a8f9e0c45 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java @@ -12,9 +12,7 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.ImageManager; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; @@ -34,10 +32,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.ima import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ImageCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; import java.util.Collection; @@ -66,7 +62,8 @@ public class ImageManagerImpl implements ImageManager { VersionableEntityAction.Write, user).getActiveVersion(); imageEntity.setVersion(activeVersion);*/ - if (!vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion())) { + boolean isManual = vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion()); + if (!isManual) { ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder .getAddImageNotSupportedHeatOnboardMethodErrorBuilder(); @@ -80,7 +77,7 @@ public class ImageManagerImpl implements ImageManager { Collection vfcImageList = listImages(imageEntity.getVspId() , imageEntity.getVersion(), imageEntity.getComponentId()); - validateVfcImage(imageEntity, vfcImageList); + validateVfcImage(isManual, imageEntity, vfcImageList, LoggerTragetServiceName.CREATE_IMAGE); compositionEntityDataManager.createImage(imageEntity); return imageEntity; } @@ -219,11 +216,11 @@ public class ImageManagerImpl implements ImageManager { /*Version activeVersion = getVersionInfo(image.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); image.setVersion(activeVersion);*/ - + boolean isManual = vspInfoDao.isManual(image.getVspId(), image.getVersion()); ImageEntity retrieved = getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(), image.getId()); - if(!vspInfoDao.isManual(image.getVspId(), image.getVersion())) { + if(!isManual) { final Image imageCompositionData = image.getImageCompositionData(); final String fileName = imageCompositionData.getFileName(); //final String format = imageCompositionData.getFormat(); @@ -239,7 +236,7 @@ public class ImageManagerImpl implements ImageManager { //Set to null so that retrieved object is equal to one in list and gets removed. retrieved.setQuestionnaireData(null); vfcImageList.remove(retrieved); - validateVfcImage(image, vfcImageList); + validateVfcImage(isManual, image, vfcImageList, LoggerTragetServiceName.UPDATE_IMAGE); //Set format to default value in order to handle FTL validation when image format is null /*if(image.getImageCompositionData().getFormat() == null) @@ -325,13 +322,25 @@ public class ImageManagerImpl implements ImageManager { return false; } - private void validateVfcImage(ImageEntity image, Collection vfcImageList) { + private void validateVfcImage(boolean isManual, ImageEntity image, Collection vfcImageList, String event) { + if(isManual && !image.getImageCompositionData().getFileName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = ImageErrorBuilder.getImageNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + if (isImageNameDuplicate(vfcImageList,image.getImageCompositionData().getFileName())) { ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageNameErrorBuilder(image .getImageCompositionData().getFileName(), image.getComponentId()); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(), + event, ErrorLevel.ERROR.name(), errorCode.id(),errorCode.message()); throw new CoreException(errorCode); @@ -354,6 +363,4 @@ public class ImageManagerImpl implements ImageManager { .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image, schemaInput); } - - } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java index ef33812ddc..06e54528b7 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java @@ -2,7 +2,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; import org.apache.commons.collections4.MapUtils; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; @@ -14,8 +13,8 @@ import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager; +import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; -import org.openecomp.sdc.vendorsoftwareproduct.utils.ManualVspDataCollectionService; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.List; @@ -25,12 +24,12 @@ import java.util.Optional; public class ManualVspToscaManagerImpl implements ManualVspToscaManager { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private ManualVspDataCollectionService + manualVspDataCollectionService = new ManualVspDataCollectionService(); @Override public VspModelInfo gatherVspInformation(String vspId, Version version, String user) { mdcDataDebugMessage.debugEntryMessage(null, null); - ManualVspDataCollectionService - manualVspDataCollectionService = new ManualVspDataCollectionService(); VspModelInfo vspModelInfo = new VspModelInfo(); //Get Release Vendor Name Optional releaseVendor; @@ -40,7 +39,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { releaseVendor = Optional.empty(); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Release Vendor not found"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Release Vendor not found : " + + ex.getMessage()); } releaseVendor.ifPresent(vspModelInfo::setReleaseVendor); @@ -51,7 +51,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors : " + + ex.getMessage()); allowedFlavors = null; } if (MapUtils.isNotEmpty(allowedFlavors)) { @@ -66,7 +67,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images : " + + ex.getMessage()); vspComponentImages = null; } if (MapUtils.isNotEmpty(vspComponentImages)) { @@ -80,7 +82,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components : " + + ex.getMessage()); vspComponents = null; } if (MapUtils.isNotEmpty(vspComponents)) { @@ -94,7 +97,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics : " + + ex.getMessage()); vspComponentNics = null; } if (MapUtils.isNotEmpty(vspComponentNics)) { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java index b196b3f54c..0304353113 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java @@ -31,18 +31,13 @@ import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager; import org.openecomp.sdc.vendorsoftwareproduct.NicManager; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.DeleteNicErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateNicInComponentErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.NicInternalNetworkErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.NicNetworkIdNotAllowedExternalNetworkErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.*; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; @@ -55,7 +50,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NicCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; @@ -145,6 +139,19 @@ public class NicManagerImpl implements NicManager { String networkId = nic.getNicCompositionData().getNetworkId(); NetworkType networkType = nic.getNicCompositionData().getNetworkType(); String networkDescription = nic.getNicCompositionData().getNetworkDescription(); + + if(!nic.getNicCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = NicErrorBuilder.getNicNameFormatErrorBuilder(nic + .getNicCompositionData().getName(), VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + listNics.forEach(nicEntity -> { Nic nicdata = nicEntity.getNicCompositionData(); if (nic.getNicCompositionData().getName().equalsIgnoreCase(nicdata.getName())) { @@ -265,6 +272,18 @@ public class NicManagerImpl implements NicManager { schemaInput.setManual(vspInfoDao.isManual(nic.getVspId(), nic.getVersion())); schemaInput.setNic(retrieved.getNicCompositionData()); + if(schemaInput.isManual() && !nic.getNicCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = NicErrorBuilder.getNicNameFormatErrorBuilder(nic + .getNicCompositionData().getName(), VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_NIC, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + CompositionEntityValidationData validationData = compositionEntityDataManager .validateEntity(nic, SchemaTemplateContext.composition, schemaInput); if (CollectionUtils.isEmpty(validationData.getErrors())) { 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 959cf15789..07e84803aa 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 @@ -29,6 +29,7 @@ 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.sdc.activityLog.ActivityLogManager; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdc.common.errors.CoreException; @@ -47,6 +48,7 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.api.annotations.Metrics; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +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; @@ -90,6 +92,7 @@ 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; @@ -225,6 +228,7 @@ 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(); @@ -233,6 +237,8 @@ public class OrchestrationTemplateCandidateManagerImpl 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; } @@ -246,6 +252,8 @@ public class OrchestrationTemplateCandidateManagerImpl 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; } @@ -258,6 +266,8 @@ public class OrchestrationTemplateCandidateManagerImpl Optional zipByteArrayInputStream = candidateService .fetchZipFileByteArrayInputStream(vspId, candidateDataEntity, manifest, uploadErrors); if (!zipByteArrayInputStream.isPresent()) { + response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId, + HEAT_VALIDATION_ERROR)); return response; } @@ -275,8 +285,18 @@ public class OrchestrationTemplateCandidateManagerImpl 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); + } + + 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); @@ -287,7 +307,10 @@ public class OrchestrationTemplateCandidateManagerImpl .getNonUnifiedToscaServiceModel())); retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire, componentNicsQuestionnaire, componentMibList, processes, processArtifact); + + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId); } + uploadFileResponse.addStructureErrors(uploadErrors); ActivityLogEntity activityLogEntity = @@ -299,7 +322,6 @@ public class OrchestrationTemplateCandidateManagerImpl return response; } - @Override public Optional getFilesDataStructure( String vspId, Version version, String user) { @@ -462,7 +484,7 @@ public class OrchestrationTemplateCandidateManagerImpl componentArtifactDao.listArtifacts(new ComponentMonitoringUploadEntity(vspId, activeVersion, componentEntity.getId(), null)); - if(CollectionUtils.isNotEmpty(componentMib)){ + if (CollectionUtils.isNotEmpty(componentMib)) { componentMibList.put(componentName,componentMib); } @@ -614,4 +636,14 @@ public class OrchestrationTemplateCandidateManagerImpl return vspDetails; } -} + private void printAuditForErrors(List 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/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 0b48c334c6..89246376e4 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 @@ -48,6 +48,7 @@ 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.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerServiceName; @@ -594,6 +595,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa enrichmentManager.setModel(serviceModel); Map> enrichErrors = enrichmentManager.enrich(); + if (MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, enrichErrors))) { + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.ENRICHMENT_COMPLETED + + vendorSoftwareProductId); + } else { + enrichErrors.values().forEach(errorList -> + auditIfContainsErrors(errorList,vendorSoftwareProductId,AuditMessages.ENRICHMENT_ERROR)); + } + enrichedServiceModelDao .storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel()); @@ -993,6 +1002,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa packageInfoDao.create(packageInfo); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_PACKAGE + vspId); + mdcDataDebugMessage.debugExitMessage("VSP id", vspId); return packageInfo; } @@ -1178,4 +1189,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa String user) { return vendorSoftwareProductDao.listComputesByVsp(vspId, version); } + + private void auditIfContainsErrors(List 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/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java index c8f473c8c7..103762c56d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java @@ -140,11 +140,12 @@ public class ComputeManagerImplTest { } @Test - public void testCreateManualImageWithDuplicateName() { + public void testCreateManualComputeWithDuplicateName() { ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + expectedDiffName.setId(COMPUTE1_ID + "Name"); ComputeData computeData = expectedDiffName.getComputeCompositionData(); computeData.setName(COMPUTE1_ID + "Name"); expectedDiffName.setComputeCompositionData(computeData); @@ -162,6 +163,28 @@ public class ComputeManagerImplTest { } } + @Test + public void testCreateManualComputeWithIncorrectNameFormat() { + ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + ComputeData computeData = expectedDiffName.getComputeCompositionData(); + computeData.setName(COMPUTE1_ID + "Name/*"); + expectedDiffName.setComputeCompositionData(computeData); + List vfcImageList = new ArrayList(); + vfcImageList.add(expectedDiffName); + doReturn(vfcImageList).when(computeDao).list(anyObject()); + + try { + computeManager.createCompute(expectedDiffName, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } @Test public void testUpdateNonExistingComputeId_negative() { @@ -191,6 +214,33 @@ public class ComputeManagerImplTest { verify(computeDao).update(computeEntity); } + @Test + public void testUpdateComputeWithIncorrectNameFormat() { + doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID)) + .when(computeDao).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.compute, COMPUTE1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + ComputeData computeData = new ComputeData(); + computeData.setName(COMPUTE1_ID + "name/*"); + computeData.setDescription(COMPUTE1_ID + "desc updated"); + computeEntity.setComputeCompositionData(computeData); + + try { + computeManager.updateCompute(computeEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testIllegalComputeUpdate() { doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID)) @@ -207,7 +257,7 @@ public class ComputeManagerImplTest { ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); ComputeData computeData = new ComputeData(); - computeData.setName(COMPUTE1_ID + " name updated"); + computeData.setName(COMPUTE1_ID + "_name_updated"); computeData.setDescription(COMPUTE1_ID + " desc updated"); computeEntity.setComputeCompositionData(computeData); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java index e082b25435..598b97b34e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java @@ -22,8 +22,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; @@ -99,7 +97,7 @@ public class DeplomentFlavorManagerImplTest { DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData(); - deploymentFlavor.setModel(DF1_ID + " Name"); + deploymentFlavor.setModel(DF1_ID + "Name"); expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor); List list = new ArrayList(); list.add(expectedDiffName); @@ -115,6 +113,28 @@ public class DeplomentFlavorManagerImplTest { } } + @Test + public void testCreateManualDepFlavorWithIncorrectNameFormat() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData(); + deploymentFlavor.setModel(DF1_ID + "Name/*"); + expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor); + List list = new ArrayList(); + list.add(expectedDiffName); + doReturn(list).when(deploymentFlavorDaoMock).list(anyObject()); + + try { + deploymentFlavorManager.createDeploymentFlavor(expectedDiffName, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } @Test public void testCreateManualDepFlavorWithFGNotInVSP() { DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); @@ -253,7 +273,7 @@ public class DeplomentFlavorManagerImplTest { Assert.assertEquals(deploymentFlavorEntities.size(), 2); for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { Assert.assertEquals(deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel() - , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+" name" : DF2_ID+" name" ); + , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+"name" : DF2_ID+"name" ); } } @@ -286,7 +306,7 @@ public class DeplomentFlavorManagerImplTest { DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID); DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel(DF1_ID + " name"); + deploymentFlavor.setModel(DF1_ID + "_name"); deploymentFlavor.setDescription(DF1_ID + " desc updated"); deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); @@ -296,6 +316,36 @@ public class DeplomentFlavorManagerImplTest { verify(deploymentFlavorDaoMock).update(deploymentFlavorEntity); } + @Test + public void testManualUpdateDepFlavorIncorrectNameFormat() { + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + doReturn(createDeploymentFlavor(VSP_ID, VERSION, DF1_ID)) + .when(deploymentFlavorDaoMock).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.image, DF1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel(DF1_ID + "_name/*"); + deploymentFlavor.setDescription(DF1_ID + " desc updated"); + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); + + try { + deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testGetNonExistingDepFlavorId_negative() { testGet_negative(VSP_ID, VERSION, "non existing image id", USER, @@ -378,7 +428,7 @@ public class DeplomentFlavorManagerImplTest { DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel(deploymentFlavorId + " name"); + deploymentFlavor.setModel(deploymentFlavorId + "name"); deploymentFlavor.setDescription(deploymentFlavorId + " desc"); deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); @@ -388,8 +438,12 @@ public class DeplomentFlavorManagerImplTest { private void testUpdate_negative(String vspId, Version version, String deploymentFlavorId, String user, String expectedErrorCode) { try { + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel("Name"); + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); deploymentFlavorManager - .updateDeploymentFlavor(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId), user); + .updateDeploymentFlavor(deploymentFlavorEntity, user); Assert.fail(); } catch (CoreException exception) { Assert.assertEquals(exception.code().id(), expectedErrorCode); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java index ec676e517b..c29cb42953 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java @@ -84,7 +84,7 @@ public class ImageManagerImplTest { Assert.assertEquals(images.size(), 2); for (ImageEntity image : images) { Assert.assertEquals(image.getImageCompositionData().getFileName(), - IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+" name" : IMAGE2_ID+" name" ); + IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+"_name" : IMAGE2_ID+"_name" ); } } @@ -104,6 +104,28 @@ public class ImageManagerImplTest { verify(compositionEntityDataManagerMock).createImage(expected); } + @Test + public void testCreateManualImageWithIncorrectNameFormat() { + ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); + Image image = expectedDiffName.getImageCompositionData(); + image.setFileName(IMAGE1_ID + " Name*/"); + expectedDiffName.setImageCompositionData(image); + List vfcImageList = new ArrayList(); + vfcImageList.add(expectedDiffName); + doReturn(vfcImageList).when(imageDao).list(anyObject()); + try { + imageManager.createImage(expectedDiffName, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testCreateManualImageWithDuplicateName() { ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); @@ -111,7 +133,7 @@ public class ImageManagerImplTest { ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); Image image = expectedDiffName.getImageCompositionData(); - image.setFileName(IMAGE1_ID + " Name"); + image.setFileName(IMAGE1_ID + "_Name"); expectedDiffName.setImageCompositionData(image); List vfcImageList = new ArrayList(); vfcImageList.add(expectedDiffName); @@ -143,7 +165,7 @@ public class ImageManagerImplTest { ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); Image imageData = new Image(); - imageData.setFileName(IMAGE1_ID + " name"); + imageData.setFileName(IMAGE1_ID + "_name"); imageData.setDescription(IMAGE1_ID + " desc updated"); imageEntity.setImageCompositionData(imageData); @@ -153,6 +175,33 @@ public class ImageManagerImplTest { verify(imageDao).update(imageEntity); } + @Test + public void testUpdateImageWithIncorrectNameFormat() { + doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID)) + .when(imageDao).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.image, IMAGE1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); + Image imageData = new Image(); + imageData.setFileName(IMAGE1_ID + "name/*"); + imageData.setDescription(IMAGE1_ID + " desc updated"); + imageEntity.setImageCompositionData(imageData); + + try { + imageManager.updateImage(imageEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testIllegalImageUpdate() { doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID)) @@ -169,7 +218,7 @@ public class ImageManagerImplTest { ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); Image imageData = new Image(); - imageData.setFileName(IMAGE1_ID + " name updated"); + imageData.setFileName(IMAGE1_ID + "_name_updated"); imageData.setDescription(IMAGE1_ID + " desc updated"); imageEntity.setImageCompositionData(imageData); @@ -345,7 +394,7 @@ public class ImageManagerImplTest { static ImageEntity createImage(String vspId, Version version, String compId, String imageId) { ImageEntity imageEntity = new ImageEntity(vspId, version, compId, imageId); Image imageData = new Image(); - imageData.setFileName(imageId + " name"); + imageData.setFileName(imageId + "_name"); imageData.setDescription(imageId + " desc"); imageEntity.setImageCompositionData(imageData); return imageEntity; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java index 4bbbec166e..8ea853c5fa 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; import static org.openecomp.sdc.generator.util.GeneratorConstants.ALLOWED_FLAVORS_PROPERTY; +import static org.openecomp.sdc.generator.util.GeneratorConstants.IMAGES_PROPERTY; import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_NODE_TEMPLATE_ID_SUFFIX; import static org.openecomp.sdc.tosca.services.ToscaConstants.BINDING_REQUIREMENT_ID; import static org.openecomp.sdc.tosca.services.ToscaConstants.COUNT_PROPERTY_NAME; @@ -10,6 +13,10 @@ import static org.openecomp.sdc.translator.services.heattotosca.Constants.GLOBAL import org.junit.Assert; import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; import org.openecomp.sdc.generator.core.utils.GeneratorUtils; import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; @@ -36,43 +43,112 @@ import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService; +import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; public class ManualVspToscaManagerImplTest { + private static final String USER = "manualVspToscaTestUser"; + private static final String INVALID_VSP_ID = "Invalid_Vsp_Id"; + private static final String VSP_ID = "Vsp_Id_1"; + private static final String VSP_VERSION = "1.0"; + + private static final String RELEASE_VENDOR = "Vendor-1"; private static final String COMPONENT_ID = "Component_id"; private static final String COMPONENT_NAME = "Component_name"; private static final String SP_PART_NUMBER_1 = "Part_number_123"; private static final String FEATURE_GROUP_ID_1 = "Feature_Group_id_1"; private static final String MANUFACTURER_REF_1 = "Manufacturer_Ref_1"; - private static final String VENDOR_MODEL_1 = "VLM_1"; + private static final String VENDOR_MODEL_1 = "Deployment_Flavor_Model_1"; private static final int NUM_CPUS_1 = 1; - private static final String DISK_SIZE_1 = "2GB"; - private static final String MEM_SIZE_1 = "8GB"; + private static final String DISK_SIZE_1 = "2 GB"; + private static final String MEM_SIZE_1 = "8 GB"; private static final String SP_PART_NUMBER_2 = "Part_number_345"; private static final String FEATURE_GROUP_ID_2 = "Feature_Group_id_2"; private static final String MANUFACTURER_REF_2 = "Manufacturer_Ref_2"; - private static final String VENDOR_MODEL_2 = "VLM_2"; + private static final String VENDOR_MODEL_2 = "Deployment_Flavor_Model_2"; private static final int NUM_CPUS_2 = 4; - private static final String DISK_SIZE_2 = "3GB"; - private static final String MEM_SIZE_2 = "2GB"; + private static final String DISK_SIZE_2 = "3 GB"; + private static final String MEM_SIZE_2 = "2 GB"; private static final String IMAGE_VERSION_1 = "3.16.1"; private static final String IMAGE_HASH_1 = "65edfgye3256hjutve"; private static final String IMAGE_FILE_NAME_1 = "image-file-name1"; - private static final String IMAGE_FILE_FORMAT_1 = "qcow2"; private static final String IMAGE_VERSION_2 = "3.1.9"; private static final String IMAGE_HASH_2 = "84rtedfe3256hjutaw"; private static final String IMAGE_FILE_NAME_2 = "image-file-name1"; - private static final String IMAGE_FILE_FORMAT_2 = "iso"; private ManualVspToscaManager manualVspToscaManager = new ManualVspToscaManagerImpl(); + @Spy + @InjectMocks + private ManualVspToscaManagerImpl manualVspToscaManagerMock; + + @Mock + private ManualVspDataCollectionService manualVspDataCollectionServiceMock; + + @Test + public void testGatherVspInformationInvalidVsp() { + MockitoAnnotations.initMocks(this); + VspModelInfo expectedVspData = new VspModelInfo(); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getReleaseVendor(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getAllowedFlavors(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getVspComponentImages(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getVspComponents(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getVspComponentNics(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + VspModelInfo vspModelInfo = manualVspToscaManagerMock.gatherVspInformation(INVALID_VSP_ID, + Version.valueOf(VSP_VERSION), USER); + Assert.assertEquals(expectedVspData, vspModelInfo); + } + + + @Test + public void testGatherVspInformationValidVsp() { + MockitoAnnotations.initMocks(this); + Map deploymentFlavorData = getDeploymentFlavorData(); + Map> componentNics = getComponentNics(); + Map componentData = getComponentData(); + Map> vfcImageData = getVfcImageData(); + doReturn(Optional.of(RELEASE_VENDOR)).when(manualVspDataCollectionServiceMock) + .getReleaseVendor(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(deploymentFlavorData).when(manualVspDataCollectionServiceMock) + .getAllowedFlavors(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(vfcImageData).when(manualVspDataCollectionServiceMock) + .getVspComponentImages(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(componentData).when(manualVspDataCollectionServiceMock) + .getVspComponents(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(componentNics).when(manualVspDataCollectionServiceMock) + .getVspComponentNics(VSP_ID, Version.valueOf(VSP_VERSION), USER); + VspModelInfo vspModelInfo = manualVspToscaManagerMock.gatherVspInformation(VSP_ID, + Version.valueOf(VSP_VERSION), USER); + + VspModelInfo expectedVspData = new VspModelInfo(); + expectedVspData.setReleaseVendor(RELEASE_VENDOR); + expectedVspData.setComponents(getComponentData()); + expectedVspData.setMultiFlavorVfcImages(getVfcImageData()); + expectedVspData.setAllowedFlavors(getDeploymentFlavorData()); + expectedVspData.setNics(getComponentNics()); + + Assert.assertEquals(expectedVspData, vspModelInfo); + } + @Test public void testGenerateToscaInvalidVspId() { VspModelInfo emptyVspCollectedData = new VspModelInfo(); @@ -87,7 +163,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaNoComponent() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(null); vspCollectedData.setMultiFlavorVfcImages(null); vspCollectedData.setAllowedFlavors(getDeploymentFlavorData()); @@ -111,7 +187,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -131,7 +206,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -139,8 +213,8 @@ public class ManualVspToscaManagerImplTest { Assert.assertNotNull(mainServiceTemplate); String componentName = vspCollectedData.getComponents().get(COMPONENT_ID); Assert.assertNull(mainServiceTemplate.getTopology_template().getNode_templates() - .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX) - .getProperties()); + .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX) + .getProperties().get(IMAGES_PROPERTY)); } @Test @@ -154,7 +228,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map serviceTemplates = toscaServiceModel.getServiceTemplates(); String componentName = vspCollectedData.getComponents().get(COMPONENT_ID); @@ -171,7 +244,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaNoManufacturerRefNumAndFeatureGroup() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(getComponentData()); vspCollectedData.setMultiFlavorVfcImages(getVfcImageData()); Map deploymentFlavorData = getDeploymentFlavorData(); @@ -184,7 +257,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -204,7 +276,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaNoDeploymentFlavor() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(getComponentData()); vspCollectedData.setMultiFlavorVfcImages(getVfcImageData()); vspCollectedData.setAllowedFlavors(null); @@ -213,7 +285,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -228,7 +299,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaCompleteData() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(getComponentData()); vspCollectedData.setMultiFlavorVfcImages(getVfcImageData()); vspCollectedData.setAllowedFlavors(getDeploymentFlavorData()); @@ -237,31 +308,23 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate); Assert.assertNotNull(mainServiceTemplate); String componentName = vspCollectedData.getComponents().get(COMPONENT_ID); - - Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates() - .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX)); Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates() .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX)); //Validate vnf configuration node template validateVnfConfigurationNodeTemplate(mainServiceTemplate, componentName); - //Validate vfc node template - validateVfcNodeTemplateinMainServiceTemplate(mainServiceTemplate, componentName); //Validate vnf node template validateVnfNodeTemplate(mainServiceTemplate, componentName); - //Validate substitution service template ServiceTemplate substitutionServiceTemplate = toscaServiceModel.getServiceTemplates() .get(componentName + GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX); List nics = vspCollectedData.getNics().get(COMPONENT_ID); validateSubstitutionServiceTemplate(substitutionServiceTemplate, nics, componentName); - //Validate global substitution service template ServiceTemplate globalSubstitutionServiceTemplate = toscaServiceModel.getServiceTemplates() .get(ToscaUtil.getServiceTemplateFileName(GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME)); @@ -284,24 +347,18 @@ public class ManualVspToscaManagerImplTest { Assert.assertEquals(deploymentFlavorData, allowedFlavors); } - private void validateVfcNodeTemplateinMainServiceTemplate(ServiceTemplate mainServiceTemplate, - String componentName) { - NodeTemplate vfcNodeTemplate = - mainServiceTemplate.getTopology_template().getNode_templates() - .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX); - Assert.assertNotNull(vfcNodeTemplate); - Assert.assertEquals(ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE, vfcNodeTemplate.getType()); + private void validateImagePropertyData(NodeTemplate vnfNodeTemplate, String componentName) { Map vfcImages = (Map) - vfcNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY); + vnfNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY); Assert.assertNotNull(vfcImages); Assert.assertEquals(2, vfcImages.size()); MultiFlavorVfcImage image1 = vfcImages.get(IMAGE_VERSION_1); MultiFlavorVfcImage expectedImage1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1, - IMAGE_FILE_NAME_1, "md5", IMAGE_FILE_FORMAT_1); + IMAGE_FILE_NAME_1, "md5"); Assert.assertEquals(expectedImage1, image1); MultiFlavorVfcImage image2 = vfcImages.get(IMAGE_VERSION_2); MultiFlavorVfcImage expectedImage2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2, - IMAGE_FILE_NAME_2, "md5", IMAGE_FILE_FORMAT_2); + IMAGE_FILE_NAME_2, "md5"); Assert.assertEquals(expectedImage2, image2); } @@ -311,12 +368,11 @@ public class ManualVspToscaManagerImplTest { mainServiceTemplate.getTopology_template().getNode_templates() .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX); Assert.assertNotNull(vnfNodeTemplate); - Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName, - vnfNodeTemplate.getType()); + Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE, vnfNodeTemplate.getType()); Assert.assertNotNull(vnfNodeTemplate.getDirectives()); Assert.assertEquals(true, vnfNodeTemplate.getDirectives().contains(ToscaConstants .NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE)); - + validateImagePropertyData(vnfNodeTemplate, componentName); Map serviceTemplateFilterProperty = (Map) vnfNodeTemplate .getProperties().get(SERVICE_TEMPLATE_FILTER_PROPERTY_NAME); Assert.assertNotNull(serviceTemplateFilterProperty); @@ -372,8 +428,8 @@ public class ManualVspToscaManagerImplTest { private void validateSubstitutionMappings(SubstitutionMapping substitutionMappings, List nics, String componentName) { - Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName, - substitutionMappings.getNode_type()); + Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE, substitutionMappings + .getNode_type()); Map> capabilities = substitutionMappings.getCapabilities(); validateSubstitutionCapabilities(capabilities, componentName); Map> requirements = substitutionMappings.getRequirements(); @@ -420,7 +476,7 @@ public class ManualVspToscaManagerImplTest { Map nodeTypes = globalSubstitutionServiceTemplate.getNode_types(); Assert.assertEquals(1, nodeTypes.size()); NodeType deploymentFlavorNodeType = - nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName); + nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE); Assert.assertNotNull(deploymentFlavorNodeType); Map properties = deploymentFlavorNodeType.getProperties(); Assert.assertNotNull(properties); @@ -475,9 +531,9 @@ public class ManualVspToscaManagerImplTest { Map> imageData = new HashMap<>(); List images = new ArrayList<>(2); MultiFlavorVfcImage image1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1, IMAGE_FILE_NAME_1, - "md5", IMAGE_FILE_FORMAT_1); + "md5"); MultiFlavorVfcImage image2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2, IMAGE_FILE_NAME_2, - "md5", IMAGE_FILE_FORMAT_2); + "md5"); images.add(image1); images.add(image2); imageData.put(COMPONENT_ID, images); @@ -522,10 +578,10 @@ public class ManualVspToscaManagerImplTest { return computeFlavor; } - private VendorInfo getVendorInfo(String manufacturerRefNumber, String vlmId) { + private VendorInfo getVendorInfo(String manufacturerRefNumber, String deploymentFlavorModel) { VendorInfo vendorInfo = new VendorInfo(); vendorInfo.setManufacturer_reference_number(manufacturerRefNumber); - vendorInfo.setVendor_model(vlmId); + vendorInfo.setVendor_model(deploymentFlavorModel); return vendorInfo; } @@ -535,13 +591,13 @@ public class ManualVspToscaManagerImplTest { return licenseFlavor; } - private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash, String fileName, - String fileHashType, String fileFormat) { + private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash, + String fileName, String fileHashType) { MultiFlavorVfcImage image = new MultiFlavorVfcImage(); image.setSoftware_version(imageVersion); image.setFile_hash(fileHash); image.setFile_hash_type(fileHashType); - image.setFile_name(fileName+"-"+IMAGE_VERSION_2+"."+fileFormat); + image.setFile_name(fileName); return image; } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java index b2cfba7672..fe275e9d68 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java @@ -109,6 +109,31 @@ public class NicManagerImplTest { Assert.assertNotNull(created); } + @Test + public void testCreateWithIncorrectNicNameFormat() { + NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); + Nic nic = nicEntity.getNicCompositionData(); + nic.setNetworkType(NetworkType.Internal); + nicEntity.setNicCompositionData(nic); + doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject()); + Collection nicEntities = new ArrayList<>(); + + NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); + Nic newNameNic = nicEntityDiffName.getNicCompositionData(); + newNameNic.setName(NIC1_ID + "_Name/*"); + nicEntityDiffName.setNicCompositionData(newNameNic); + nicEntities.add(nicEntityDiffName); + doReturn(nicEntities).when(nicDao).list(anyObject()); + doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject()); + + try { + NicEntity created = nicManager.createNic(nicEntity,USER); + } catch (CoreException exception) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED, + exception.code().id()); + } + } + @Test public void testCreateWithDupNicName() { NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); @@ -120,7 +145,7 @@ public class NicManagerImplTest { NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); Nic newNameNic = nicEntityDiffName.getNicCompositionData(); - newNameNic.setName(NIC1_ID + " Name"); + newNameNic.setName(NIC1_ID + "_Name"); nicEntityDiffName.setNicCompositionData(newNameNic); nicEntities.add(nicEntityDiffName); doReturn(nicEntities).when(nicDao).list(anyObject()); @@ -282,7 +307,7 @@ public class NicManagerImplTest { NicEntity nicEntity = new NicEntity(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID); Nic nicData = new Nic(); - nicData.setName(NIC1_ID + " name updated"); + nicData.setName(NIC1_ID + "_name_updated"); nicData.setDescription(NIC1_ID + " desc updated"); nicData.setNetworkId(NETWORK1_ID); nicEntity.setNicCompositionData(nicData); @@ -294,6 +319,36 @@ public class NicManagerImplTest { verify(nicDao, never()).update(nicEntity); } + @Test + public void testUpdateIncorrectNameFormat() { + doReturn(createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID)) + .when(nicDao).get(anyObject()); + + CompositionEntityValidationData toBeReturned = + new CompositionEntityValidationData(CompositionEntityType.nic, NIC1_ID); + toBeReturned.setErrors(Arrays.asList("error1", "error2")); + doReturn(toBeReturned) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + NicEntity nicEntity = new NicEntity(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID); + Nic nicData = new Nic(); + nicData.setName(NIC1_ID + "_name_updated/*"); + nicData.setDescription(NIC1_ID + " desc updated"); + nicData.setNetworkId(NETWORK1_ID); + nicEntity.setNicCompositionData(nicData); + + try { + nicManager.updateNic(nicEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testGetNonExistingNicId_negative() { @@ -426,7 +481,7 @@ public class NicManagerImplTest { String networkId) { NicEntity nicEntity = new NicEntity(vspId, version, compId, nicId); Nic nicData = new Nic(); - nicData.setName(nicId + " name"); + nicData.setName(nicId + "_name"); nicData.setDescription(nicId + " desc"); nicData.setNetworkId(networkId); nicEntity.setNicCompositionData(nicData); diff --git a/openecomp-be/backend/pom.xml.versionsBackup b/openecomp-be/backend/pom.xml.versionsBackup deleted file mode 100644 index 15ac71b64d..0000000000 --- a/openecomp-be/backend/pom.xml.versionsBackup +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - - - openecomp-sdc - org.openecomp.sdc - 1.0-SNAPSHOT - - - org.openecomp.sdc - backend - pom - - - openecomp-sdc-vendor-license-manager - openecomp-sdc-vendor-software-product-manager - openecomp-sdc-validation-manager - openecomp-sdc-action-manager - openecomp-sdc-application-config-manager - - - - diff --git a/openecomp-be/configuration/pom.xml.versionsBackup b/openecomp-be/configuration/pom.xml.versionsBackup deleted file mode 100644 index a627e11af3..0000000000 --- a/openecomp-be/configuration/pom.xml.versionsBackup +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - - openecomp-sdc-configuration - openecomp-sdc-configuration - 1.0-SNAPSHOT - pom - - - - org.openecomp.sdc - openecomp-sdc - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-common-lib/pom.xml b/openecomp-be/lib/openecomp-common-lib/pom.xml index 0ebbf0632d..747ba4a28d 100644 --- a/openecomp-be/lib/openecomp-common-lib/pom.xml +++ b/openecomp-be/lib/openecomp-common-lib/pom.xml @@ -34,16 +34,6 @@ logback-classic ${logback.version} - - org.openecomp.sdc.core - openecomp-utilities-lib - 1.1.0-SNAPSHOT - - - commons-io - commons-io - 2.5 - commons-io commons-io diff --git a/openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup deleted file mode 100644 index e2333b5ae3..0000000000 --- a/openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - - org.openecomp.core - openecomp-common-lib - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - 1.0-SNAPSHOT - - - javax.ws.rs - javax.ws.rs-api - 2.0-m10 - - - ch.qos.logback - logback-classic - ${logback.version} - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - - openecomp-common-lib - - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup deleted file mode 100644 index 7d6cd8f980..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - - org.openecomp.core - openecomp-nosqldb-core - 1.0-SNAPSHOT - - - org.testng - testng - 6.9.10 - test - - - - - - org.openecomp.core - openecomp-core-lib - 1.0-SNAPSHOT - - - openecomp-config-lib - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup deleted file mode 100644 index be88b2799a..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - - openecomp-facade-api - openecomp-facade-api - org.openecomp.core - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../../.. - - - - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup deleted file mode 100644 index 72ce7fab94..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup +++ /dev/null @@ -1,41 +0,0 @@ - - 4.0.0 - - openecomp-facade-core - openecomp-facade-core - org.openecomp.core - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - ../../.. - - - - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - org.openecomp.core - openecomp-facade-api - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-facade-api - 1.0-SNAPSHOT - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup deleted file mode 100644 index c4d0d1faf0..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - openecomp-facade-lib - openecomp-facade-lib - - pom - - openecomp-core-lib - org.openecomp.core - 1.0-SNAPSHOT - - - - openecomp-facade-api - openecomp-facade-core - - - - - org.openecomp.core - openecomp-facade-api - ${project.version} - compile - - - org.openecomp.core - openecomp-facade-core - ${project.version} - runtime - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup deleted file mode 100644 index 288274d728..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup +++ /dev/null @@ -1,45 +0,0 @@ - - 4.0.0 - - openecomp-nosqldb-api - openecomp-nosqldb-api - org.openecomp.core - - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - ../../.. - - - - - org.openecomp.core - openecomp-facade-api - 1.0-SNAPSHOT - - - com.datastax.cassandra - cassandra-driver-core - ${datasatx.version} - - - com.datastax.cassandra - cassandra-driver-mapping - ${datasatx.version} - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup deleted file mode 100644 index fa859a0db8..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - - openecomp-nosqldb-core - openecomp-nosqldb-core - org.openecomp.core - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - ../../.. - - - - - org.openecomp.core - openecomp-nosqldb-api - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - test - 4.11 - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup deleted file mode 100644 index 3a4bfd4ba0..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ - - 4.0.0 - - openecomp-nosqldb-lib - openecomp-nosqldb-lib - org.openecomp.core - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - ../.. - - - - openecomp-nosqldb-api - openecomp-nosqldb-core - - - - - org.openecomp.core - openecomp-nosqldb-api - ${project.version} - compile - - - org.openecomp.core - openecomp-nosqldb-core - ${project.version} - runtime - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup deleted file mode 100644 index 1e448f5a61..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,83 +0,0 @@ - - 4.0.0 - - openecomp-utilities-lib - openecomp-utilities-lib - - - - openecomp-core-lib - org.openecomp.core - 1.0-SNAPSHOT - - - - - - - org.yaml - snakeyaml - 1.17 - - - org.apache.commons - commons-lang3 - 3.4 - - - org.apache.commons - commons-collections4 - 4.1 - - - com.google.code.gson - gson - 2.3.1 - - - commons-codec - commons-codec - ${commons.codec.version} - - - junit - junit - test - 4.11 - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - - - org.everit.json - org.everit.json.schema - 1.3.0 - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - com.google.code.gson - gson - 2.3.1 - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup deleted file mode 100644 index d02ce28af6..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,22 +0,0 @@ - - 4.0.0 - - org.openecomp.core - openecomp-core-lib - openecomp-core-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - /openecomp-facade-lib - /openecomp-nosqldb-lib - /openecomp-utilities-lib - /openecomp-config-lib - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup deleted file mode 100644 index c9d100dd50..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - - org.openecomp.core - openecomp-facade-core - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-facade-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - openecomp-healing-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-healing-api - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup deleted file mode 100644 index c48c3259e1..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-healing-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-api - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - openecomp-healing-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-healing-core - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup deleted file mode 100644 index c5f936366b..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-healing-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-core - 1.0-SNAPSHOT - runtime - - - - - org.openecomp.sdc - openecomp-healing-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-healing-impl - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java index c759d21f01..2e63a8d50a 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.healing.healers; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.openecomp.sdc.common.utils.SdcCommon; @@ -7,9 +8,15 @@ import org.openecomp.sdc.healing.interfaces.Healer; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; 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.ComputeEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; @@ -17,13 +24,31 @@ import java.util.Map; public class ComponentQuestionnaireHealer implements Healer { - /*private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory.getInstance().createInterface();*/ private static final ComponentDao componentDao = ComponentDaoFactory.getInstance().createInterface(); + private static final ComputeDao computeDao = + ComputeDaoFactory.getInstance().createInterface(); + private static final ImageDao imageDao = + ImageDaoFactory.getInstance().createInterface(); + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final String GENERAL = "general"; + public static final String IMAGE = "image"; + public static final String FORMAT = "format"; + public static final String CPU_OVER_SUBSCRIPTION_RATIO = "CpuOverSubscriptionRatio"; + public static final String MEMORY_RAM = "MemoryRAM"; + public static final String VM_SIZING = "vmSizing"; + public static final String COMPUTE = "compute"; + public static final String NUM_OF_VMS = "numOfVMs"; + public static final String DISK = "disk"; + public static final String IO_OP_PER_SEC = "IOOperationsPerSec"; + + public static final String COMPUTE_CPU_OVER_SUBSCRIPTION_RATIO = "cpuOverSubscriptionRatio"; + public static final String COMPUTE_MEMORY_RAM = "memoryRAM"; + public static final String COMPUTE_IO_OP_PER_SEC = "ioOperationsPerSec"; + public ComponentQuestionnaireHealer(){ } @@ -36,43 +61,133 @@ public class ComponentQuestionnaireHealer implements Healer { Collection componentEntities = componentDao.list(new ComponentEntity(vspId, version, null)); componentEntities.forEach(componentEntity -> { - /*String questionnaire=vendorSoftwareProductDao.getComponent(vspId, version, componentEntity - .getId()).getQuestionnaireData();*/ String questionnaire = componentDao.getQuestionnaireData(vspId, version, componentEntity .getId()).getQuestionnaireData(); + if (questionnaire != null) { - JsonParser jsonParser = new JsonParser(); - JsonObject json = (JsonObject) jsonParser.parse(questionnaire); - if (json.getAsJsonObject("compute") != null && json.getAsJsonObject("compute") - .getAsJsonObject("vmSizing") != null) { - json.getAsJsonObject("compute").remove("vmSizing"); - } + JsonParser jsonParser = new JsonParser(); + JsonObject json = (JsonObject) jsonParser.parse(questionnaire); - if (json.getAsJsonObject("compute") != null && json.getAsJsonObject("compute") - .getAsJsonObject("numOfVMs") != null ) { - if (json.getAsJsonObject("compute").getAsJsonObject("numOfVMs"). - get("CpuOverSubscriptionRatio") != null ) { - json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").remove - ("CpuOverSubscriptionRatio"); - } - if (json.getAsJsonObject("compute").getAsJsonObject("numOfVMs"). - get("MemoryRAM") != null ) { - json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").remove("MemoryRAM"); - } - } + Collection computeEntities = computeDao.list(new ComputeEntity(vspId, + version, componentEntity.getId(), null)); + computeEntities.stream().forEach( + computeEntity -> { + populateComputeQuestionnaire(json, computeEntity); + } + ); - if (json.getAsJsonObject("general") != null && json.getAsJsonObject("general") - .getAsJsonObject("image") != null && json.getAsJsonObject("general").getAsJsonObject - ("image").get("format") != null) { - json.getAsJsonObject("general").getAsJsonObject("image").remove("format"); - } - String questionnaireData = json.toString(); - /*vendorSoftwareProductDao.updateComponentQuestionnaire(vspId, version, componentEntity - .getId(),questionnaireData);*/ + Collection imageEntities = imageDao.list(new ImageEntity(vspId, + version, componentEntity.getId(), null)); + imageEntities.stream().forEach( + imageEntity -> { + populateImageQuestionnaire(json, imageEntity); + } + ); + + processDiskAttribute(json, "bootDiskSizePerVM"); + processDiskAttribute(json, "ephemeralDiskSizePerVM"); + + String questionnaireData = json.toString(); componentDao.updateQuestionnaireData(vspId, version, componentEntity.getId(), questionnaireData); } }); return componentEntities; } + + /** + * Move Disk Atributes from genral/image/ to genral/disk in component questionnaire itself + * @param json + * @param diskAttrName + * @param diskJsonObject + * @return + */ + private void processDiskAttribute(JsonObject json, String diskAttrName) { + boolean isBootDisksizePerVM = isDiskAttributePresent(json, diskAttrName); + if (isBootDisksizePerVM) { + JsonObject diskJsonObject = json.getAsJsonObject(GENERAL).getAsJsonObject(DISK); + if (diskJsonObject == null) { + diskJsonObject = new JsonObject(); + } + + diskJsonObject.addProperty(diskAttrName, json.getAsJsonObject(GENERAL).getAsJsonObject(IMAGE) + .get(diskAttrName).getAsNumber()); + + json.getAsJsonObject(GENERAL).add(DISK, diskJsonObject); + json.getAsJsonObject(GENERAL).getAsJsonObject(IMAGE).remove(diskAttrName); + } + } + + private boolean isDiskAttributePresent(JsonObject json, String diskAttrName) { + return json.getAsJsonObject(GENERAL) != null && + json.getAsJsonObject(GENERAL).getAsJsonObject(IMAGE) != null && + json.getAsJsonObject(GENERAL).getAsJsonObject (IMAGE).get(diskAttrName) + != null; + } + + /** + * Move the required attributes from component to Image Questionnaire + * @param json + * @param imageEntity + */ + private void populateImageQuestionnaire(JsonObject json, ImageEntity imageEntity) { + JsonObject general = getJsonObject(json, GENERAL); + boolean isImageFormat = general != null && json + .getAsJsonObject(GENERAL) + .getAsJsonObject(IMAGE) != null && json.getAsJsonObject(GENERAL).getAsJsonObject + (IMAGE).get(FORMAT) != null; + if (isImageFormat) { + JsonObject image = getJsonObject(general, IMAGE); + JsonElement jsonElement = image.get(FORMAT); + JsonObject jsonObject = new JsonObject(); + jsonObject.add(FORMAT, jsonElement); + imageDao.updateQuestionnaireData(imageEntity.getVspId(), imageEntity.getVersion(), imageEntity + .getComponentId(),imageEntity.getId(), jsonObject.toString()); + image.remove(FORMAT); + } + } + + /** + * Move the required attributes from component to Compute Questionnaire + * @param json + * @param computeEntity + */ + private void populateComputeQuestionnaire(JsonObject json, ComputeEntity computeEntity) { + JsonObject compute = getJsonObject(json, COMPUTE); + JsonObject vmSizing = getJsonObject(compute, VM_SIZING); + if (compute != null && vmSizing != null) { + JsonElement ioOperationsPerSec = vmSizing.get(IO_OP_PER_SEC); + if (ioOperationsPerSec != null) { + vmSizing.addProperty(COMPUTE_IO_OP_PER_SEC, ioOperationsPerSec.getAsNumber()); + vmSizing.remove(IO_OP_PER_SEC); + } + + JsonObject numberOfVms = getJsonObject(compute, NUM_OF_VMS); + if (numberOfVms != null ) { + JsonElement cpuRatio = numberOfVms.get(CPU_OVER_SUBSCRIPTION_RATIO); + if (cpuRatio != null ) { + vmSizing.addProperty(COMPUTE_CPU_OVER_SUBSCRIPTION_RATIO, cpuRatio.getAsString()); + numberOfVms.remove(CPU_OVER_SUBSCRIPTION_RATIO); + } + JsonElement memoryRam = numberOfVms.get(MEMORY_RAM); + if (memoryRam != null ) { + vmSizing.addProperty(COMPUTE_MEMORY_RAM, memoryRam.getAsString()); + numberOfVms.remove(MEMORY_RAM); + } + } + + JsonObject computeQuestionnaireJsonObject = new JsonObject(); + computeQuestionnaireJsonObject.add(VM_SIZING, vmSizing); + String computeQuestionnaire = computeQuestionnaireJsonObject != null ? + computeQuestionnaireJsonObject.toString() : null; + computeDao.updateQuestionnaireData(computeEntity.getVspId(), computeEntity.getVersion(), + computeEntity.getComponentId(), computeEntity.getId(), computeQuestionnaire); + compute.remove(VM_SIZING); + + } + } + + private JsonObject getJsonObject(JsonObject json, String name) { + return json.getAsJsonObject(name); + } } 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 6fdf14451f..bdb7bc3a93 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 @@ -174,8 +174,8 @@ public class CompositionDataHealer implements Healer { Collection computeEntities = computeDao.listByVsp(vspId, version); Collection imageEntities = imageDao.listByVsp(vspId, version); - Collection deploymentFlavorEntities = deloymentFlavorDao.list(new - DeploymentFlavorEntity(vspId, version, null)); + //Collection deploymentFlavorEntities = deloymentFlavorDao.list(new + //DeploymentFlavorEntity(vspId, version, null)); if (CollectionUtils.isEmpty(computeEntities) && CollectionUtils.isEmpty(imageEntities)) { for (Component component : compositionData.getComponents()) { @@ -195,9 +195,9 @@ public class CompositionDataHealer implements Healer { } - if (CollectionUtils.isEmpty(deploymentFlavorEntities)) { + /*if (CollectionUtils.isEmpty(deploymentFlavorEntities)) { compositionEntityDataManager.saveDeploymentFlavors(vspId,version,compositionData); - } + }*/ } private CompositionData healCompositionData(String vspId, Version version, diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java index 5eb15bf9ba..6a82d8fa49 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; /** @@ -44,6 +45,11 @@ public class VlmVersionHealer implements Healer { VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version)); VersionedVendorLicenseModel vendorLicenseModel; + + if(!Objects.isNull(vspDetails.getVlmVersion())) { + return Optional.empty(); + } + try{ vendorLicenseModel = @@ -61,6 +67,7 @@ public class VlmVersionHealer implements Healer { new ArrayList<>( licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, vlmVersion, null))); + vspDetails.setVlmVersion(vlmVersion); vspDetails.setLicenseAgreement(laList.get(0).getId()); vspDetails.setFeatureGroups(new ArrayList<>(laList.get(0).getFeatureGroupIds())); diff --git a/openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup deleted file mode 100644 index 02ba7f140b..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-healing-lib - 1.0-SNAPSHOT - pom - - - openecomp-sdc-healing-api - openecomp-sdc-healing-core - openecomp-sdc-healing-impl - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup deleted file mode 100644 index f434a8e24c..0000000000 --- a/openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,50 +0,0 @@ - - 4.0.0 - - org.openecomp.core - openecomp-heat-lib - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - ch.qos.logback - logback-classic - ${logback.version} - - - junit - junit - RELEASE - test - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - - openecomp-heat-lib - - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup deleted file mode 100644 index a2786b2401..0000000000 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup +++ /dev/null @@ -1,57 +0,0 @@ - - - 4.0.0 - - - org.slf4j - slf4j-api - - - org.aspectj - aspectjrt - 1.8.9 - - - org.slf4j - slf4j-api - - - - - org.openecomp.sdc - openecomp-logging-lib - 1.0-SNAPSHOT - - - - openecomp-sdc-logging-api - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - - - \ No newline at end of file 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 f23a2c5352..de39cff30f 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 @@ -16,14 +16,24 @@ public class AuditMessages { public static final String CHECK_IN_VSP = "Check in VSP. VSP Id: "; public static final String CHECK_OUT_VSP = "Check out VSP. VSP Id: "; public static final String SUBMIT_VSP = "Submit VSP. VSP Id: "; + public static final String SUBMIT_VSP_FAIL = "Submit VSP failed!. VSP Id: "; + public static final String SUBMIT_VSP_ERROR = "Submit VSP error: %s. VSP Id: %s"; public static final String UPLOAD_HEAT = "Upload HEAT. VSP Id: "; public static final String UPLOAD_PROCESS_ARTIFACT = "Upload Process Artifact. VSP Id: "; - public static final String UPLOAD_MONITORING_FILE = "Upload Monitoring File of type %s " + - "" + ". VSP Id: %s, component id: %s"; -// public static final String UPLOAD_ARTIFACT_MIB_TRAP = "Upload Artifact SNMP TRAP. VSP Id: "; + public static final String UPLOAD_MONITORING_FILE = "Upload Monitoring File of type %s " + + ". VSP Id: %s, component id: %s"; public static final String IMPORT_SUCCESS = "VSP import to VF success. VSP Id: "; public static final String IMPORT_FAIL = "VSP import to VF fail. VSP Id: "; + 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 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"; + public static final String ENRICHMENT_COMPLETED = "Enrichment completed. VSP Id: "; + public static final String CREATE_PACKAGE = "Created package. VSP Id: "; + } diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup deleted file mode 100644 index 374de71273..0000000000 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - org.springframework - spring-context - 4.1.3.RELEASE - - - org.springframework - spring-webmvc - 4.1.3.RELEASE - provided - - - ch.qos.logback - logback-classic - ${logback.version} - - - javax.servlet - servlet-api - 2.5 - - - ch.qos.logback - logback-classic - 1.1.7 - - - - - - org.openecomp.sdc - openecomp-logging-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-core - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup deleted file mode 100644 index 77657139f0..0000000000 --- a/openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-logging-lib - openecomp-logging-lib - pom - - - /openecomp-sdc-logging-api - /openecomp-sdc-logging-core - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup deleted file mode 100644 index bca0cd32a3..0000000000 --- a/openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,151 +0,0 @@ - - - 4.0.0 - - - - 2.4.7 - 2.7.7 - - - - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-manager - 1.0-SNAPSHOT - - - - org.codehaus.groovy - groovy - ${groovy.version} - - - - org.openecomp.sdc.common - openecomp-configuration-management-core - 1707.0.0-SNAPSHOT - runtime - - - org.slf4j - slf4j-log4j12 - - - - - - org.codehaus.janino - janino - ${janino.version} - - - - org.codehaus.janino - commons-compiler - 3.0.6 - - - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - - - - openecomp-migration-lib - openecomp-migration-lib - 1.0-SNAPSHOT - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - install - - copy-dependencies - - - ${project.build.directory}/lib - false - false - true - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - package - - - - - - true - lib/ - org.openecomp.sdc.migration.ToscaNamespaceMigration - - - lib/ - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - ant-test - package - - - - - - - run - - - - - - maven-assembly-plugin - - - Generate assembly - install - - single - - - - - - ${basedir}/src/main/assembly/migration-lib-assembly.xml - - openecomp-migration-lib - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup deleted file mode 100644 index 5da20949fe..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-action-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-action-api - 1.0-SNAPSHOT - - - - - org.openecomp.core - openecomp-core-lib - pom - ${project.version} - - - org.openecomp.core - openecomp-facade-core - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-nosqldb-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-versioning-api - 1.0-SNAPSHOT - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.4 - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java index ee5e8830d4..86ae7510a6 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java @@ -41,7 +41,7 @@ public interface ActionDao extends VersionableDao, BaseDao { public Action getActionsByActionUuId(String uniqueId) throws ActionException; - public List getOpenEcompComponents() throws ActionException; + public List getEcompComponents() throws ActionException; public List getActionsByActionInvariantUuId(String actionInvariantUuId) throws ActionException; diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup deleted file mode 100644 index 274bdb04c7..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - org.openecomp.sdc - openecomp-sdc-action-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-action-lib - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - openecomp-sdc-action-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-versioning-api - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup deleted file mode 100644 index 447437fe33..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - org.openecomp.sdc - openecomp-sdc-action-lib - pom - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - - - - - openecomp-sdc-action-api - openecomp-sdc-action-core - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup deleted file mode 100644 index 9e29da0ee6..0000000000 --- a/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,39 +0,0 @@ - - 4.0.0 - - openecomp-sdc-datatypes-lib - - - org.apache.commons - commons-collections4 - 4.1 - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - - - io.swagger - swagger-annotations - 1.5.3 - - - commons-lang - commons-lang - 2.5 - - - org.openecomp.sdc.common - openecomp-configuration-management-api - 1707.0.0-SNAPSHOT - - - openecomp-sdc-datatypes-lib - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup deleted file mode 100644 index 493e4256a3..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup +++ /dev/null @@ -1,45 +0,0 @@ - - 4.0.0 - - openecomp-sdc-enrichment-api - openecomp-sdc-enrichment-api - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - io.swagger - swagger-annotations - 1.5.3 - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - 1.0-SNAPSHOT - - - ch.qos.logback - logback-classic - ${logback.version} - - - org.openecomp.sdc - openecomp-sdc-versioning-api - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup deleted file mode 100644 index d8f63f10e9..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup +++ /dev/null @@ -1,94 +0,0 @@ - - 4.0.0 - - openecomp-sdc-enrichment-core - openecomp-sdc-enrichment-core - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - RELEASE - test - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-enrichment-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-enrichment-impl - ${project.version} - - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - org.openecomp.sdc - openecomp-sdc-model-impl - 1.0-SNAPSHOT - test - - - org.openecomp.core - openecomp-tosca-lib - 1.0-SNAPSHOT - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup deleted file mode 100644 index 65e84d88dc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,127 +0,0 @@ - - 4.0.0 - - openecomp-sdc-enrichment-impl - openecomp-sdc-enrichment-impl - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - RELEASE - test - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-enrichment-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-model-core - ${project.version} - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-core - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-translator-core - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-config-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-api - 1.0-SNAPSHOT - - - runtime - org.openecomp.sdc - openecomp-sdc-vendor-software-product-core - 1.0-SNAPSHOT - - - test - org.openecomp.sdc - openecomp-sdc-model-impl - 1.0-SNAPSHOT - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup deleted file mode 100644 index b6e0173b77..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - - openecomp-sdc-enrichment-lib - openecomp-sdc-enrichment-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-sdc-enrichment-api - openecomp-sdc-enrichment-core - openecomp-sdc-enrichment-impl - - - - - org.openecomp.sdc - openecomp-sdc-enrichment-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-enrichment-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-core - ${project.version} - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup deleted file mode 100644 index eba0f207e4..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup +++ /dev/null @@ -1,51 +0,0 @@ - - 4.0.0 - - openecomp-sdc-model-api - openecomp-sdc-model-api - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-versioning-core - ${project.version} - - - io.swagger - swagger-annotations - 1.5.3 - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - ${project.version} - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup deleted file mode 100644 index d62437122a..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup +++ /dev/null @@ -1,56 +0,0 @@ - - 4.0.0 - - openecomp-sdc-model-core - openecomp-sdc-model-core - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-model-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-versioning-core - ${project.version} - - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup deleted file mode 100644 index b8db689bd5..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - - openecomp-sdc-model-impl - openecomp-sdc-model-impl - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-model-core - ${project.version} - - - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup deleted file mode 100644 index d49cbd7069..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - - openecomp-sdc-model-lib - openecomp-sdc-model-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-sdc-model-api - openecomp-sdc-model-core - openecomp-sdc-model-impl - - - - - org.openecomp.sdc - openecomp-sdc-model-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-model-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-model-impl - ${project.version} - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml index 047fe7f843..51399fbb7d 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml @@ -65,4 +65,4 @@ - + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java index 1fb1030dd3..025db1cafc 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java @@ -55,4 +55,79 @@ public class VspModelInfo { public void setNics(Map> nics) { this.nics = nics; } + + @Override + public int hashCode() { + int result = releaseVendor != null ? releaseVendor.hashCode() : 0; + result = 31 * result + (components != null ? components.hashCode() : 0); + result = 31 * result + (allowedFlavors != null ? allowedFlavors.hashCode() : 0); + result = 31 * result + (multiFlavorVfcImages != null ? multiFlavorVfcImages.hashCode() : 0); + result = 31 * result + (nics != null ? nics.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "VspModelInfo{" + + "releaseVendor='" + releaseVendor + '\'' + + ", components=" + components + + ", allowedFlavors=" + allowedFlavors + + ", multiFlavorVfcImages=" + multiFlavorVfcImages + + ", nics=" + nics + + '}'; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (getClass() != obj.getClass()) { + return false; + } + VspModelInfo other = (VspModelInfo) obj; + if (this.releaseVendor == null) { + if (other.releaseVendor != null) { + return false; + } + } else if (!releaseVendor.equals(other.releaseVendor)) { + return false; + } + if (this.components == null) { + if (other.components != null) { + return false; + } + } else if (!components.equals(other.components)) { + return false; + } + if (this.allowedFlavors == null) { + if (other.allowedFlavors != null) { + return false; + } + } else if (!allowedFlavors.equals(other.allowedFlavors)) { + return false; + } + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { + return false; + } + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { + return false; + } + if (this.nics == null) { + if (other.nics != null) { + return false; + } + } else if (!nics.equals(other.nics)) { + return false; + } + return true; + } } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java index b24a85d61c..5464627927 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java @@ -5,9 +5,10 @@ public class GeneratorConstants { public static final String IMAGES_PROPERTY = "images"; public static final String RELEASE_VENDOR = "releaseVendor"; public static final String VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX = "_VNF_Configuration"; - public static final String VFC_NODE_TEMPLATE_ID_SUFFIX = "_VFC"; public static final String VNF_NODE_TEMPLATE_ID_SUFFIX = "_VNF"; - public static final String PORT_NODE_TEMPLATE_ID_SUFFIX = "_wan_port"; + public static final String PORT_TYPE_INTERNAL_NODE_TEMPLATE_SUFFIX = "_lan"; + public static final String PORT_TYPE_EXTERNAL_NODE_TEMPLATE_SUFFIX = "_wan"; + public static final String PORT_NODE_TEMPLATE_ID_SUFFIX = "_port"; public static final String TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX = "ServiceTemplate.yaml"; diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java index 6d488c0221..6ec7bfca9f 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java @@ -9,9 +9,10 @@ import static org.openecomp.sdc.generator.util.GeneratorConstants.MEM_SIZE_PROP_ import static org.openecomp.sdc.generator.util.GeneratorConstants.NUM_CPUS; import static org.openecomp.sdc.generator.util.GeneratorConstants.NUM_CPUS_PROP_DESC_PREFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_NODE_TEMPLATE_ID_SUFFIX; +import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_TYPE_EXTERNAL_NODE_TEMPLATE_SUFFIX; +import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_TYPE_INTERNAL_NODE_TEMPLATE_SUFFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.RELEASE_VENDOR; import static org.openecomp.sdc.generator.util.GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX; -import static org.openecomp.sdc.generator.util.GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX; @@ -36,6 +37,7 @@ import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; import org.openecomp.sdc.translator.services.heattotosca.Constants; import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; import java.util.ArrayList; @@ -118,8 +120,7 @@ public class ManualVspToscaGenerationService { // May be need to revisited for supporting multiple components String componentId = components.entrySet().iterator().next().getKey(); createVnfConfigurationNodeTemplate(mainServiceTemplate, vspModelInfo); - createComponentNodeTemplate(mainServiceTemplate, vspModelInfo, componentId); - createVnfNodeTemplate(mainServiceTemplate, vspModelInfo); + createVnfNodeTemplate(mainServiceTemplate, vspModelInfo, componentId); } return mainServiceTemplate; } @@ -141,42 +142,16 @@ public class ManualVspToscaGenerationService { } } - private void createComponentNodeTemplate(ServiceTemplate mainServiceTemplate, - VspModelInfo vspModelInfo, - String componentId) { - Optional componentName = getComponentNameFromVspModel(vspModelInfo); - if (componentName.isPresent()) { - NodeTemplate vfcNodeTemplate = new NodeTemplate(); - vfcNodeTemplate.setType(ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE); - Map properties = new LinkedHashMap<>(); - if (MapUtils.isNotEmpty(vspModelInfo.getMultiFlavorVfcImages())) { - List componentImages = - vspModelInfo.getMultiFlavorVfcImages().get(componentId); - Map vfcImages = new HashMap<>(); - for (MultiFlavorVfcImage image : componentImages) { - vfcImages.put(image.getSoftware_version(), image); - } - properties.put(IMAGES_PROPERTY, vfcImages); - vfcNodeTemplate.setProperties(properties); - } - String nodeTemplateId = componentName.get() + VFC_NODE_TEMPLATE_ID_SUFFIX; - DataModelUtil.addNodeTemplate(mainServiceTemplate, nodeTemplateId, - vfcNodeTemplate); - } - } - private void createVnfNodeTemplate(ServiceTemplate mainServiceTemplate, - VspModelInfo vspModelInfo) { + VspModelInfo vspModelInfo, String componentId) { Optional componentName = getComponentNameFromVspModel(vspModelInfo); if (componentName.isPresent()) { NodeTemplate vnfNodeTemplate = new NodeTemplate(); - String vnfNodeTemplateType = - ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName.get(); - vnfNodeTemplate.setType(vnfNodeTemplateType); + vnfNodeTemplate.setType(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE); List directiveList = new ArrayList<>(); directiveList.add(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); vnfNodeTemplate.setDirectives(directiveList); - vnfNodeTemplate.setProperties(new LinkedHashMap<>()); + vnfNodeTemplate.setProperties(getVnfNodeTemplateProperties(vspModelInfo, componentId)); DataModelUtil .addSubstitutionFilteringProperty(getSubstitutionServiceTemplateFileName(componentName .get()), vnfNodeTemplate, 1); @@ -186,10 +161,28 @@ public class ManualVspToscaGenerationService { String nodeTemplateId = componentName.get() + VNF_NODE_TEMPLATE_ID_SUFFIX; DataModelUtil.addNodeTemplate(mainServiceTemplate, nodeTemplateId, vnfNodeTemplate); - abstractSubstitutionIdTypes.put(componentName.get(), vnfNodeTemplateType); + abstractSubstitutionIdTypes.put(componentName.get(), ToscaNodeType + .MULTIDEPLOYMENTFLAVOR_NODE_TYPE); } } + private Map getVnfNodeTemplateProperties(VspModelInfo vspModelInfo, + String componentId) { + Map properties = new LinkedHashMap<>(); + if (MapUtils.isNotEmpty(vspModelInfo.getMultiFlavorVfcImages())) { + List componentImages = + vspModelInfo.getMultiFlavorVfcImages().get(componentId); + if (Objects.nonNull(componentImages)) { + Map vfcImages = new HashMap<>(); + componentImages.stream() + .forEach(multiFlavorVfcImage -> + vfcImages.put(multiFlavorVfcImage.getSoftware_version(), multiFlavorVfcImage)); + properties.put(IMAGES_PROPERTY, vfcImages); + } + } + return properties; + } + private String getSubstitutionServiceTemplateFileName(String componentName) { return componentName + TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX; } @@ -276,7 +269,7 @@ public class ManualVspToscaGenerationService { nicNodeTemplate.setType(ToscaNodeType.NETWORK_PORT); DataModelUtil.addBindingReqFromPortToCompute(componentNodeTemplateId, nicNodeTemplate); DataModelUtil.addNodeTemplate(substitutionServiceTemplate, - getNicNodeTemplateId(nic.getName()), nicNodeTemplate); + getNicNodeTemplateId(nic.getName(), nic.getNetworkType()), nicNodeTemplate); } } } @@ -288,9 +281,14 @@ public class ManualVspToscaGenerationService { return componentName; } - private String getNicNodeTemplateId(String nicName) { + private String getNicNodeTemplateId(String nicName, NetworkType nicNetworkType) { StringBuilder builder = new StringBuilder(); builder.append(nicName); + if (nicNetworkType == NetworkType.External) { + builder.append(PORT_TYPE_EXTERNAL_NODE_TEMPLATE_SUFFIX); + } else if (nicNetworkType == NetworkType.Internal) { + builder.append(PORT_TYPE_INTERNAL_NODE_TEMPLATE_SUFFIX); + } builder.append(PORT_NODE_TEMPLATE_ID_SUFFIX); return builder.toString(); } @@ -337,7 +335,6 @@ public class ManualVspToscaGenerationService { createGlobalSubstitutionNodeType(substitutionServiceTemplate, componentName); DataModelUtil.addNodeType(globalSubstitutionServiceTemplate, substitutionNodeTypeId, substitutionNodeType); - Map>> substitutionMapping = GeneratorUtils.getSubstitutionNodeTypeExposedConnectionPoints(substitutionNodeType, substitutionServiceTemplate, toscaServiceModel); @@ -379,7 +376,7 @@ public class ManualVspToscaGenerationService { String componentName) { NodeType substitutionNodeType = new ToscaAnalyzerServiceImpl() .createInitSubstitutionNodeType(substitutionServiceTemplate, - ToscaNodeType.VFC_ABSTRACT_SUBSTITUTE); + ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE); substitutionNodeType.setProperties( getManualVspSubstitutionNodeTypeProperties(substitutionNodeType, componentName)); return substitutionNodeType; diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java index c13997b47c..59b06ba7a8 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java @@ -163,8 +163,8 @@ public class GeneratorUtils { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.GENERATE_MANUAL_VSP_TOSCA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Error occured in get node type exposed " - + "points"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), + "Error occured in get node type exposed points : " + ex.getMessage()); return null; } return substitutionMapping; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup deleted file mode 100644 index e44d37ff8f..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - - att-sdc-translator-impl - att-sdc-translator-impl - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - 1.1.2 - - - junit - junit - RELEASE - test - - - org.openecomp.sdc - openecomp-sdc-translator-api - ${project.version} - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - ${project.version} - - - - - - org.openecomp.sdc - openecomp-sdc-translator-core - ${project.version} - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup deleted file mode 100644 index d46dd3f442..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup +++ /dev/null @@ -1,68 +0,0 @@ - - 4.0.0 - - openecomp-sdc-translator-api - openecomp-sdc-translator-api - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-core - ${project.version} - runtime - - - io.swagger - swagger-annotations - 1.5.3 - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - ${project.version} - - - org.openecomp.sdc.common - openecomp-configuration-management-core - 1707.0.0-SNAPSHOT - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.openecomp.sdc.common - openecomp-configuration-management-api - 1707.0.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup deleted file mode 100644 index aea451e1ca..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - - openecomp-sdc-translator-core - openecomp-sdc-translator-core - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - junit - junit - RELEASE - test - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-translator-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-api - ${project.version} - - - org.openecomp.sdc - att-sdc-validation-impl - 1.0-SNAPSHOT - test - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup deleted file mode 100644 index 95c45309da..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,68 +0,0 @@ - - 4.0.0 - - openecomp-sdc-translator-impl - openecomp-sdc-translator-impl - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - 1.1.2 - - - junit - junit - RELEASE - test - - - org.openecomp.sdc - openecomp-sdc-translator-api - ${project.version} - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - ${project.version} - - - - - - org.openecomp.sdc - openecomp-sdc-translator-core - ${project.version} - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - - ${project.basedir}/configuration - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup deleted file mode 100644 index 2cb266a815..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup +++ /dev/null @@ -1,45 +0,0 @@ - - 4.0.0 - - openecomp-sdc-translator-sdk - openecomp-sdc-translator-sdk - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - 1.1.2 - - - junit - junit - RELEASE - test - - - org.openecomp.sdc - openecomp-sdc-translator-api - ${project.version} - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.core - openecomp-tosca-lib - ${project.version} - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup deleted file mode 100644 index 9d7224a2e1..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,26 +0,0 @@ - - 4.0.0 - - openecomp-sdc-translator-lib - openecomp-sdc-translator-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-sdc-translator-api - openecomp-sdc-translator-sdk - openecomp-sdc-translator-core - openecomp-sdc-translator-impl - att-sdc-translator-impl - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup deleted file mode 100644 index b53f4159fc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,92 +0,0 @@ - - 4.0.0 - - att-sdc-validation-impl - att-sdc-validation-impl - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - 1.0-SNAPSHOT - - - ch.qos.logback - logback-classic - ${logback.version} - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-validation-core - 1.0-SNAPSHOT - test - - - org.openecomp.sdc - openecomp-sdc-validation-impl - 1.0-SNAPSHOT - test - - - org.openecomp.core - openecomp-heat-lib - 1.0-SNAPSHOT - - - org.testng - testng - 6.9.10 - test - - - org.openecomp.sdc - openecomp-sdc-validation-sdk - 1.0-SNAPSHOT - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup deleted file mode 100644 index 5850819a7f..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup +++ /dev/null @@ -1,49 +0,0 @@ - - 4.0.0 - - openecomp-sdc-validation-api - openecomp-sdc-validation-api - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - io.swagger - swagger-annotations - 1.5.3 - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - 1.0-SNAPSHOT - - - ch.qos.logback - logback-classic - ${logback.version} - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup deleted file mode 100644 index 8731097f41..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup +++ /dev/null @@ -1,110 +0,0 @@ - - 4.0.0 - - openecomp-sdc-validation-core - openecomp-sdc-validation-core - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - RELEASE - test - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-sdk - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - org.openecomp.sdc.common - openecomp-configuration-management-core - 1707.0.0-SNAPSHOT - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.openecomp.core - openecomp-heat-lib - 1.0-SNAPSHOT - - - org.testng - testng - 6.9.10 - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup deleted file mode 100644 index e2927eb5b3..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,103 +0,0 @@ - - 4.0.0 - - openecomp-sdc-validation-impl - openecomp-sdc-validation-impl - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - junit - junit - RELEASE - test - - - org.openecomp.core - openecomp-utilities-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-validation-api - ${project.version} - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - org.mockito - mockito-all - test - 1.10.19 - - - org.openecomp.core - openecomp-heat-lib - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-logging-api - 1.0-SNAPSHOT - - - - commons-io - commons-io - 2.5 - test - - - org.openecomp.sdc - openecomp-sdc-validation-core - 1.0-SNAPSHOT - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index a0c25d44f8..6016ba0cb8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -230,9 +230,9 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal } if (network.contains("_net_id")) { return network.substring(0, network.indexOf("_net_id")); - } else if (network.contains("net_name")) { + } else if (network.contains("_net_name")) { return network.substring(0, network.indexOf("_net_name")); - } else if (network.contains("net_fqdn")) { + } else if (network.contains("_net_fqdn")) { return network.substring(0, network.indexOf("_net_fqdn")); } return null; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup deleted file mode 100644 index d179ae0469..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup +++ /dev/null @@ -1,42 +0,0 @@ - - 4.0.0 - - openecomp-sdc-validation-sdk - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.testng - testng - 6.9.10 - - - org.openecomp.sdc - openecomp-sdc-validation-api - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-heat-lib - 1.0-SNAPSHOT - - - commons-io - commons-io - 2.5 - - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup deleted file mode 100644 index 3188265847..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - openecomp-sdc-validation-lib - openecomp-sdc-validation-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-sdc-validation-api - openecomp-sdc-validation-core - openecomp-sdc-validation-impl - openecomp-sdc-validation-sdk - att-sdc-validation-impl - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup deleted file mode 100644 index fc22abcf38..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup +++ /dev/null @@ -1,55 +0,0 @@ - - 4.0.0 - - openecomp-sdc-vendor-license-api - openecomp-sdc-vendor-license-api - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-versioning-core - ${project.version} - - - org.openecomp.core - openecomp-nosqldb-core - ${project.version} - - - javax.el - javax.el-api - ${javax.el-api.version} - - - org.glassfish.web - javax.el - 2.2.4 - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.4 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - org.codehaus.woodstox - woodstox-core-asl - 4.4.1 - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java index ce225931f5..dce2939ae5 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java @@ -26,12 +26,10 @@ import com.datastax.driver.mapping.annotations.Enumerated; import com.datastax.driver.mapping.annotations.Frozen; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; @@ -65,25 +63,12 @@ public class EntitlementPoolEntity implements VersionableEntity { @Enumerated private ThresholdUnit thresholdUnit; - @Column(name = "entitlement_metric") - @Frozen - private ChoiceOrOther entitlementMetric; private String increments; - @Column(name = "aggregation_func") - @Frozen - private ChoiceOrOther aggregationFunction; - @Column(name = "operational_scope") @Frozen private MultiChoiceOrOther operationalScope; - @Frozen - private ChoiceOrOther time; - - @Column(name = "manufacturer_ref_num") - private String manufacturerReferenceNumber; - @Column(name = "ref_fg_ids") private Set referencingFeatureGroups = new HashSet<>(); @@ -96,6 +81,9 @@ public class EntitlementPoolEntity implements VersionableEntity { private Collection limits; + //Defined and used only for License Artifcat XMLs + private String manufacturerReferenceNumber; + public EntitlementPoolEntity() { } @@ -200,15 +188,6 @@ public class EntitlementPoolEntity implements VersionableEntity { this.thresholdUnit = thresholdUnits; } - public ChoiceOrOther getEntitlementMetric() { - return entitlementMetric; - } - - public void setEntitlementMetric(ChoiceOrOther entitlementMetric) { - entitlementMetric.resolveEnum(EntitlementMetric.class); - this.entitlementMetric = entitlementMetric; - } - public String getIncrements() { return increments; } @@ -217,15 +196,6 @@ public class EntitlementPoolEntity implements VersionableEntity { this.increments = increments; } - public ChoiceOrOther getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction(ChoiceOrOther aggregationFunction) { - aggregationFunction.resolveEnum(AggregationFunction.class); - this.aggregationFunction = aggregationFunction; - } - public MultiChoiceOrOther getOperationalScope() { return operationalScope; } @@ -237,23 +207,6 @@ public class EntitlementPoolEntity implements VersionableEntity { this.operationalScope = operationalScope; } - public ChoiceOrOther getTime() { - return time; - } - - public void setTime(ChoiceOrOther time) { - time.resolveEnum(EntitlementTime.class); - this.time = time; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - /** * Gets threshold for artifact. * @@ -274,35 +227,6 @@ public class EntitlementPoolEntity implements VersionableEntity { return version.toString(); } - /** - * Gets entitlement metric for artifact. - * - * @return the entitlement metric for artifact - */ - public EntitlementMetricForXml getEntitlementMetricForArtifact() { - EntitlementMetricForXml metric = new EntitlementMetricForXml(); - if (entitlementMetric != null) { - metric.setValue(entitlementMetric.getResult()); - } else { - metric.setValue(null); - } - return metric; - } - - /** - * Gets time for artifact. - * - * @return the time for artifact - */ - public EntitlementTimeForXml getTimeForArtifact() { - EntitlementTimeForXml timeForXml = new EntitlementTimeForXml(); - if (time != null) { - timeForXml.setValue(time.getResult()); - } - - return timeForXml; - } - public String getStartDate() { return startDate; } @@ -334,7 +258,7 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.ServiceProvider)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); + xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); @@ -357,7 +281,7 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.Vendor)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); + xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); @@ -378,8 +302,7 @@ public class EntitlementPoolEntity implements VersionableEntity { public int hashCode() { return Objects .hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit, - entitlementMetric, increments, aggregationFunction, operationalScope, time, - manufacturerReferenceNumber, referencingFeatureGroups, startDate, expiryDate); + increments, operationalScope, referencingFeatureGroups, startDate, expiryDate); } @Override @@ -397,12 +320,8 @@ public class EntitlementPoolEntity implements VersionableEntity { && Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(thresholdUnit, that.thresholdUnit) - && Objects.equals(entitlementMetric, that.entitlementMetric) && Objects.equals(increments, that.increments) - && Objects.equals(aggregationFunction, that.aggregationFunction) && Objects.equals(operationalScope, that.operationalScope) - && Objects.equals(time, that.time) - && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber) && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups) && Objects.equals(startDate, that.startDate) && Objects.equals(expiryDate, that.expiryDate); @@ -418,12 +337,8 @@ public class EntitlementPoolEntity implements VersionableEntity { + ", description='" + description + '\'' + ", thresholdValue=" + thresholdValue + ", thresholdUnit='" + thresholdUnit + '\'' - + ", entitlementMetric=" + entitlementMetric + ", increments='" + increments + '\'' - + ", aggregationFunction=" + aggregationFunction + ", operationalScope=" + operationalScope - + ", time=" + time - + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\'' + ", referencingFeatureGroups=" + referencingFeatureGroups + ", version_uuid=" + versionUuId + ", startDate=" + startDate @@ -431,31 +346,27 @@ public class EntitlementPoolEntity implements VersionableEntity { + '}'; } - /** - * Gets aggregation function for artifact. - * - * @return the aggregation function for artifact - */ - public AggregationFunctionForXml getAggregationFunctionForArtifact() { - AggregationFunctionForXml aggregationFunctionForXml = new AggregationFunctionForXml(); - if (entitlementMetric != null) { - aggregationFunctionForXml.setValue(aggregationFunction.getResult()); - } else { - aggregationFunctionForXml.setValue(null); - } - return aggregationFunctionForXml; - } - /** * Gets operational scope for artifact. * * @return the operational scope for artifact */ - public Set getOperationalScopeForArtifact() { + public OperationalScopeForXml getOperationalScopeForArtifact() { + OperationalScopeForXml obj = new OperationalScopeForXml(); if (operationalScope != null) { - return operationalScope.getResults(); - } else { - return null; + if(operationalScope.getResults().size() > 0) { + obj.setValue(operationalScope.getResults()); + } } + return obj; + } + + //Defined and used only for License Artifcat XMLs + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } + + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java index 654093de28..d5efd59a6b 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java @@ -29,6 +29,8 @@ import com.datastax.driver.mapping.annotations.Table; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; @@ -61,8 +63,17 @@ public class LicenseKeyGroupEntity implements VersionableEntity { private Set referencingFeatureGroups = new HashSet<>(); @Column(name = "version_uuid") private String versionUuId; + private Integer thresholdValue; + private ThresholdUnit thresholdUnits; + private String increments; private Collection limits; + private String startDate; + private String expiryDate; + + //Defined and used only for License Artifcat XMLs + private String manufacturerReferenceNumber; + public LicenseKeyGroupEntity() { } @@ -167,6 +178,37 @@ public class LicenseKeyGroupEntity implements VersionableEntity { this.referencingFeatureGroups = referencingFeatureGroups; } + public Integer getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(Integer thresholdValue) { + this.thresholdValue = thresholdValue; + } + + public ThresholdUnit getThresholdUnits() { + return thresholdUnits; + } + + public void setThresholdUnits(ThresholdUnit thresholdUnit) { + this.thresholdUnits = thresholdUnit; + } + + public String getIncrements() { + return increments; + } + + public void setIncrements(String increments) { + this.increments = increments; + } + + public ThresholdForXml getThresholdForArtifact() { + ThresholdForXml threshold = new ThresholdForXml(); + threshold.setUnit(getThresholdUnits() == null ? null : getThresholdUnits().name()); + threshold.setValue(getThresholdValue()); + return threshold; + } + public Collection getLimits() { return limits; } @@ -221,11 +263,28 @@ public class LicenseKeyGroupEntity implements VersionableEntity { return null; } + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + @Override public int hashCode() { return Objects .hash(vendorLicenseModelId, version, id, name, description, type, operationalScope, - referencingFeatureGroups); + referencingFeatureGroups, startDate, expiryDate, + thresholdValue, thresholdUnits, increments); } @Override @@ -243,7 +302,12 @@ public class LicenseKeyGroupEntity implements VersionableEntity { && Objects.equals(description, that.description) && type == that.type && Objects.equals(operationalScope, that.operationalScope) - && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups); + && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups) + && Objects.equals(startDate, that.startDate) + && Objects.equals(expiryDate, that.expiryDate) + && Objects.equals(thresholdValue, that.thresholdValue) + && Objects.equals(thresholdUnits, that.thresholdUnits) + && Objects.equals(increments, that.increments); } @Override @@ -257,6 +321,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity { + ", operationalScope=" + operationalScope + ", referencingFeatureGroups=" + referencingFeatureGroups + ", versionUuId='" + versionUuId + '\'' + + ", startDate=" + startDate + + ", expiryDate=" + expiryDate + + ", thresholdValue='" + thresholdValue + '\'' + + ", thresholdUnits='" + thresholdUnits + '\'' + + ", increments='" + increments + '\'' + '}'; } @@ -265,12 +334,14 @@ public class LicenseKeyGroupEntity implements VersionableEntity { * * @return the operational scope for artifact */ - public Set getOperationalScopeForArtifact() { + public OperationalScopeForXml getOperationalScopeForArtifact() { + OperationalScopeForXml obj = new OperationalScopeForXml(); if (operationalScope != null) { - return operationalScope.getResults(); - } else { - return null; + if(operationalScope.getResults().size() > 0) { + obj.setValue(operationalScope.getResults()); + } } + return obj; } /** @@ -295,4 +366,13 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } return typeXml; } + + //Defined and used only for License Artifcat XMLs + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java new file mode 100644 index 0000000000..f51a4127c0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java @@ -0,0 +1,38 @@ +/*- + * ============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.vendorlicense.dao.types.xml; + +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; + +import java.util.Set; + +public class OperationalScopeForXml { + Set value; + + @JacksonXmlElementWrapper(localName = "value", useWrapping = false) + public Set getValue() { + return value; + } + + public void setValue(Set value) { + this.value = value; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java index 9ab7c0c64d..3d27de3a88 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java @@ -76,6 +76,9 @@ public interface VendorLicenseFacade { LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement, String user); + Collection listFeatureGroups(String vlmId, Version version, + String user); + FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup, String user); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup deleted file mode 100644 index b1141fc5cd..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup +++ /dev/null @@ -1,53 +0,0 @@ - - 4.0.0 - - openecomp-sdc-vendor-license-core - openecomp-sdc-vendor-license-core - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - org.openecomp.sdc - openecomp-sdc-vendor-license-api - ${project.version} - - - - org.mockito - mockito-all - test - 1.10.19 - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - test - 4.11 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java index 4cccb6712a..b880c67cbc 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java @@ -11,11 +11,7 @@ import com.amdocs.zusammen.datatypes.item.Info; import org.openecomp.core.zusammen.api.ZusammenAdaptor; import org.openecomp.core.zusammen.api.ZusammenUtil; import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; -import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; -import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; @@ -214,15 +210,11 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { Info info = new Info(); info.setName(entitlementPool.getName()); info.setDescription(entitlementPool.getDescription()); + info.addProperty("version_uuid", entitlementPool.getVersionUuId()); info.addProperty("thresholdValue", entitlementPool.getThresholdValue()); info.addProperty("threshold_unit", entitlementPool.getThresholdUnit()); - info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); info.addProperty("increments", entitlementPool.getIncrements()); - info.addProperty("aggregation_func", entitlementPool.getAggregationFunction()); info.addProperty("operational_scope", entitlementPool.getOperationalScope()); - info.addProperty("EntitlementTime", entitlementPool.getTime()); - info.addProperty("manufacturerReferenceNumber", - entitlementPool.getManufacturerReferenceNumber()); info.addProperty("startDate", entitlementPool.getStartDate()); info.addProperty("expiryDate", entitlementPool.getExpiryDate()); entitlementPoolElement.setInfo(info); @@ -243,6 +235,7 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { new EntitlementPoolEntity(vlmId, version, elementInfo.getId().getValue()); entitlmentPool.setName(elementInfo.getInfo().getName()); entitlmentPool.setDescription(elementInfo.getInfo().getDescription()); + entitlmentPool.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid")); entitlmentPool .setThresholdValue(elementInfo.getInfo().getProperty("thresholdValue") != null ? VlmZusammenUtil.toInteger(elementInfo.getInfo().getProperty("thresholdValue")) : null); @@ -250,17 +243,9 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { Object threshold_unit = elementInfo.getInfo().getProperty("threshold_unit"); entitlmentPool.setThresholdUnit( threshold_unit != null ? ThresholdUnit.valueOf(elementInfo.getInfo().getProperty("threshold_unit")) : null); - entitlmentPool.setEntitlementMetric( - getEntitlementMetricCoiceOrOther(elementInfo.getInfo().getProperty("entitlement_metric"))); entitlmentPool.setIncrements(elementInfo.getInfo().getProperty("increments")); - entitlmentPool.setAggregationFunction( - getAggregationFuncCoiceOrOther(elementInfo.getInfo().getProperty("aggregation_func"))); entitlmentPool.setOperationalScope(getOperationalScopeMultiChoiceOrOther( elementInfo.getInfo().getProperty("operational_scope"))); - entitlmentPool.setTime( - getEntitlementTimeCoiceOrOther(elementInfo.getInfo().getProperty("EntitlementTime"))); - entitlmentPool.setManufacturerReferenceNumber( - elementInfo.getInfo().getProperty("manufacturerReferenceNumber")); entitlmentPool.setStartDate(elementInfo.getInfo().getProperty("startDate")); entitlmentPool.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate")); @@ -272,23 +257,6 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { return entitlmentPool; } - private ChoiceOrOther getAggregationFuncCoiceOrOther( - Map aggregationFunction) { - return new ChoiceOrOther<> - (AggregationFunction.valueOf((String) aggregationFunction.get("choice")), - (String) aggregationFunction.get("other")); - } - - private ChoiceOrOther getEntitlementMetricCoiceOrOther(Map entitlementMetric) { - return new ChoiceOrOther<>(EntitlementMetric.valueOf((String) entitlementMetric.get("choice") - ), (String) entitlementMetric.get("other")); - } - - private ChoiceOrOther getEntitlementTimeCoiceOrOther(Map entitlementTime) { - return new ChoiceOrOther<>(EntitlementTime.valueOf((String) entitlementTime.get("choice")), - (String) entitlementTime.get("other")); - } - private MultiChoiceOrOther getOperationalScopeMultiChoiceOrOther (Map operationalScope) { diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java index 95dfd79cb6..976db94f39 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java @@ -15,6 +15,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; @@ -212,8 +213,15 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { Info info = new Info(); info.setName(licenseKeyGroup.getName()); info.setDescription(licenseKeyGroup.getDescription()); + info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId()); info.addProperty("LicenseKeyType", licenseKeyGroup.getType()); + info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId()); info.addProperty("operational_scope", licenseKeyGroup.getOperationalScope()); + info.addProperty("startDate", licenseKeyGroup.getStartDate()); + info.addProperty("expiryDate", licenseKeyGroup.getExpiryDate()); + info.addProperty("thresholdValue", licenseKeyGroup.getThresholdValue()); + info.addProperty("thresholdUnits", licenseKeyGroup.getThresholdUnits()); + info.addProperty("increments", licenseKeyGroup.getIncrements()); lkgElement.setInfo(info); if (licenseKeyGroup.getReferencingFeatureGroups() != null @@ -233,11 +241,23 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { new LicenseKeyGroupEntity(vlmId, version, elementInfo.getId().getValue()); licenseKeyGroup.setName(elementInfo.getInfo().getName()); licenseKeyGroup.setDescription(elementInfo.getInfo().getDescription()); - + licenseKeyGroup.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid")); licenseKeyGroup .setType(LicenseKeyType.valueOf(elementInfo.getInfo().getProperty("LicenseKeyType"))); + licenseKeyGroup.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid")); licenseKeyGroup.setOperationalScope(getOperationalScopeMultiChoiceOrOther( elementInfo.getInfo().getProperty("operational_scope"))); + licenseKeyGroup.setStartDate(elementInfo.getInfo().getProperty("startDate")); + licenseKeyGroup.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate")); + if (elementInfo.getInfo().getProperty("thresholdUnits") != null ){ + licenseKeyGroup.setThresholdUnits(ThresholdUnit.valueOf(elementInfo + .getInfo().getProperty("thresholdUnits"))); + } + if (elementInfo.getInfo().getProperty("thresholdValue") != null ){ + licenseKeyGroup.setThresholdValue(toInteger(elementInfo.getInfo().getProperty + ("thresholdValue"))); + } + licenseKeyGroup.setIncrements(elementInfo.getInfo().getProperty("increments")); if (elementInfo.getRelations() != null && elementInfo.getRelations().size() > 0) { licenseKeyGroup @@ -259,4 +279,15 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { } return null; } + + private Integer toInteger(Object val) { + if (val instanceof Double) { + return ((Double) val).intValue(); + } else if (val instanceof String) { + return new Integer((String) val); + } else if (val instanceof Integer) { + return (Integer) val; + } + throw new RuntimeException("invalid value for integer:" + val.getClass()); + } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java index 857ee7f9fa..5f9dd10816 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java @@ -25,6 +25,7 @@ import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseMod import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG; import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA; +import org.apache.commons.collections4.CollectionUtils; import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; @@ -70,10 +71,7 @@ import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuil import org.openecomp.sdc.versioning.types.VersionInfo; import org.openecomp.sdc.versioning.types.VersionableEntityAction; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; public class VendorLicenseFacadeImpl implements VendorLicenseFacade { @@ -128,8 +126,6 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Read, user), user); featureGroup.setVersion(version); - - return getFeatureGroup(featureGroup); } @@ -137,19 +133,9 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup); VersioningUtil .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE); - if(retrieved.getManufacturerReferenceNumber() == null){ - Object[] entitlementPoolIdsList = retrieved.getEntitlementPoolIds().toArray(); - if(entitlementPoolIdsList != null && entitlementPoolIdsList.length > 0){ - String entitlementPoolId = entitlementPoolIdsList[0].toString(); - EntitlementPoolEntity entitlementPoolEntity = new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), - retrieved.getVersion(), entitlementPoolId); - entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity); - retrieved.setManufacturerReferenceNumber(entitlementPoolDao.getManufacturerReferenceNumber( - entitlementPoolEntity)); - featureGroupDao.update(retrieved); - } + if (retrieved.getManufacturerReferenceNumber() == null) { + updateManufacturerNumberInFeatureGroup(retrieved); } - return retrieved; } @@ -399,6 +385,20 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { return featureGroup; } + @Override + public Collection listFeatureGroups(String vlmId, Version version, + String user) { + Collection featureGroupEntities = + featureGroupDao.list(new FeatureGroupEntity(vlmId, VersioningUtil + .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), + user), null)); + featureGroupEntities.stream() + .filter(fgEntity -> Objects.isNull(fgEntity.getManufacturerReferenceNumber())) + .forEach(fgEntity -> updateManufacturerNumberInFeatureGroup(fgEntity)); + return featureGroupEntities; + } + + @Override public Collection validateLicensingData(String vlmId, Version version, String licenseAgreementId, @@ -503,41 +503,49 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { return retrieved; } - private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) { - Version version = VersioningUtil.resolveVersion(null, - getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); - Collection licenseAgreements = licenseAgreementDao - .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); - - if (licenseAgreements == null || licenseAgreements.isEmpty()) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA).build()); - } - - for (LicenseAgreementEntity licenseAgreement : licenseAgreements) { - if (licenseAgreement.getFeatureGroupIds() == null || licenseAgreement.getFeatureGroupIds().isEmpty()) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); + private void updateManufacturerNumberInFeatureGroup(FeatureGroupEntity featureGroupEntity) { + if (CollectionUtils.isNotEmpty(featureGroupEntity.getEntitlementPoolIds())) { + Object[] entitlementPoolIdsList = featureGroupEntity.getEntitlementPoolIds().toArray(); + if (entitlementPoolIdsList != null && entitlementPoolIdsList.length > 0) { + String entitlementPoolId = entitlementPoolIdsList[0].toString(); + EntitlementPoolEntity entitlementPoolEntity = + new EntitlementPoolEntity(featureGroupEntity.getVendorLicenseModelId(), + featureGroupEntity.getVersion(), entitlementPoolId); + entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity); + featureGroupEntity.setManufacturerReferenceNumber( + entitlementPoolDao.getManufacturerReferenceNumber(entitlementPoolEntity)); + featureGroupDao.update(featureGroupEntity); } } - - Collection featureGroupEntities = - featureGroupDao.list(new FeatureGroupEntity(vendorLicenseModelId, version, null)); - for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) { - if (featureGroupEntity.getEntitlementPoolIds() == null || featureGroupEntity.getEntitlementPoolIds().isEmpty()) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); + } + private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) { + Version version = VersioningUtil.resolveVersion(null, + getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); + Collection licenseAgreements = licenseAgreementDao + .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); + + if (CollectionUtils.isNotEmpty(licenseAgreements)) { + licenseAgreements.forEach(licenseAgreement -> { + if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); + } + }); + + Collection featureGroupEntities = featureGroupDao.list( + new FeatureGroupEntity(vendorLicenseModelId, version, null)); + featureGroupEntities.forEach(featureGroupEntity -> { + if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); + } + }); } - } - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java index d91a5107af..7d2cdc5474 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; @@ -41,6 +42,7 @@ import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -74,11 +76,15 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts for(EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities){ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, entitlementPoolEntity.getId(), user)); + entitlementPoolEntity.setManufacturerReferenceNumber(featureGroupModel. + getEntityManufacturerReferenceNumber()); } Set licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups(); for(LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities){ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, licenseKeyGroupEntity.getId(), user)); + licenseKeyGroupEntity.setManufacturerReferenceNumber(featureGroupModel. + getEntityManufacturerReferenceNumber()); } featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map( @@ -109,18 +115,29 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts for (Version finalVersion : finalVersions) { Collection coll = vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion, user); - for(EntitlementPoolEntity entitlementPoolEntity : coll){ + coll.stream().forEach( entitlementPoolEntity -> { entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, entitlementPoolEntity.getId(), user)); - } + Optional manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber + (entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion, user); + manufacturerReferenceNumber.ifPresent(mrn -> entitlementPoolEntity + .setManufacturerReferenceNumber(mrn)); + }); + entitlementPoolEntities.addAll(coll); Collection coll2 = vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion, user); - for(LicenseKeyGroupEntity licenseKeyGroupEntity : coll2){ + + coll2.stream().forEach( licenseKeyGroupEntity -> { licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, licenseKeyGroupEntity.getId(), user)); - } + Optional manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber + (licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion, user); + manufacturerReferenceNumber.ifPresent(mrn -> licenseKeyGroupEntity + .setManufacturerReferenceNumber(mrn)); + }); + licenseKeyGroupEntities.addAll(coll2); } @@ -138,6 +155,23 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts return vendorLicenseArtifact.toXml().getBytes(); } + private static Optional getFeatureGroupManufactureRefNumber(Set featureGroupIds, + String vlmId, Version finalVersion, String user) { + String manufactureReferenceNumber = null; + if (CollectionUtils.isNotEmpty(featureGroupIds)) { + Object[] featureGroupIdsList = featureGroupIds.toArray(); + if (featureGroupIdsList != null && featureGroupIdsList.length > 0) { + FeatureGroupEntity featureGroup = + vendorLicenseFacade.getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion, + featureGroupIdsList[0].toString()), user); + manufactureReferenceNumber = featureGroup != null ? featureGroup + .getManufacturerReferenceNumber() : null; + } + } + return manufactureReferenceNumber != null ? Optional.of(manufactureReferenceNumber) : + Optional.empty(); + } + /** * Create License Artifacts. diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java index 936f4da2a7..dc0db0d96c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java @@ -35,6 +35,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; @@ -64,10 +65,10 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact { @JsonProperty(value = "version") abstract String getVersionForArtifact(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "start-date") abstract String getStartDate(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "expiry-date") abstract String getExpiryDate(); @JsonIgnore @@ -93,9 +94,8 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact { @JsonIgnore abstract String getEntityType(); - @JacksonXmlProperty(localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore abstract ChoiceOrOther getOperationalScope(); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java index 1a29d5b2c9..8a2d17d9ff 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java @@ -34,6 +34,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; @@ -74,10 +75,10 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact { @JsonIgnore abstract float getThresholdValue(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "start-date") abstract String getStartDate(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "expiry-date") abstract String getExpiryDate(); @JsonIgnore @@ -92,9 +93,8 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact { @JsonIgnore abstract String getEntityType(); - @JacksonXmlProperty(isAttribute = false, localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore abstract ChoiceOrOther getOperationalScope(); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java index 75beee4c6a..b8c45ba4c6 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java @@ -41,9 +41,6 @@ public abstract class MixinFeatureGroupModel { @JacksonXmlProperty(isAttribute = false, localName = "part-number") abstract String getEntityPartNumber(); - @JacksonXmlProperty(isAttribute = false, localName = "manufacturer-reference-number") - abstract String getManufacturerReferenceNumber(); - @JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid") abstract String getEntityId(); @@ -60,5 +57,8 @@ public abstract class MixinFeatureGroupModel { @JsonIgnore abstract String getEntityType(); + @JsonIgnore + abstract String getEntityManufacturerReferenceNumber(); + } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java index 6238988ece..78bf531e82 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -28,6 +29,8 @@ import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import java.util.Collection; @@ -60,9 +63,8 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact { @JsonIgnore abstract ChoiceOrOther getOperationalScope(); - @JacksonXmlProperty(isAttribute = false, localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore @@ -80,4 +82,19 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact { @JsonIgnore abstract Collection getLimits(); + @JsonProperty(value = "start-date") + abstract String getStartDate(); + + @JsonProperty(value = "expiry-date") + abstract String getExpiryDate(); + + @JsonProperty(value = "threshold-value") + abstract ThresholdForXml getThresholdForArtifact(); + + @JsonIgnore + abstract String getThresholdUnits(); + + @JsonIgnore + abstract float getThresholdValue(); + } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java index 80ae054db0..b25b93ff7c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -29,6 +30,8 @@ import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import java.util.Collection; import java.util.Set; @@ -37,6 +40,9 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract String getId(); + @JsonProperty(value = "manufacturer-reference-number") + abstract String getManufacturerReferenceNumber(); + @JsonIgnore abstract Set getReferencingFeatureGroups(); @@ -63,9 +69,8 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract ChoiceOrOther getOperationalScope(); - @JacksonXmlProperty(isAttribute = false, localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore @@ -74,6 +79,8 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract String getVersionableId(); + @JsonProperty(value = "threshold-value") + abstract ThresholdForXml getThresholdForArtifact(); @JsonProperty(value = "sp-limits") abstract LimitForXml getSPLimits(); @@ -83,4 +90,15 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract Collection getLimits(); + @JsonProperty(value = "start-date") + abstract String getStartDate(); + + @JsonProperty(value = "expiry-date") + abstract String getExpiryDate(); + + @JsonIgnore + abstract String getThresholdUnits(); + + @JsonIgnore + abstract float getThresholdValue(); } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup deleted file mode 100644 index 0b6ebb62d8..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - - openecomp-sdc-vendor-license-lib - openecomp-sdc-vendor-license-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-sdc-vendor-license-api - openecomp-sdc-vendor-license-core - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup deleted file mode 100644 index 67f6a45c0d..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-lib - 1.0-SNAPSHOT - - - openecomp-sdc-vendor-software-product-api - 1.0-SNAPSHOT - - - - - org.openecomp.core - openecomp-core-lib - pom - ${project.version} - - - org.openecomp.core - openecomp-facade-core - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-nosqldb-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-versioning-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-translator-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-enrichment-api - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-model-core - 1.0-SNAPSHOT - - - org.freemarker - freemarker - 2.3.25-incubating - - - org.openecomp.core - openecomp-config-lib - 1.0-SNAPSHOT - - - - - \ 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/VendorSoftwareProductConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java index 42dd0086c7..8010c40023 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java @@ -29,7 +29,7 @@ public final class VendorSoftwareProductConstants { public static final String INFORMATION_ARTIFACT_NAME = "VSP_%s_Information.txt"; public static final String UNSUPPORTED_OPERATION_ERROR = "An error has occurred: Unsupported operation for 1707 release."; - + public static final String NAME_PATTERN = "^[a-zA-Z0-9_]*$"; public final class UniqueValues { public static final String VENDOR_SOFTWARE_PRODUCT_NAME = "Vendor Software Product name"; 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/composition/CompositionEntityDataManager.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/composition/CompositionEntityDataManager.java index 6c636fddf0..b77012e5cf 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/composition/CompositionEntityDataManager.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/composition/CompositionEntityDataManager.java @@ -87,7 +87,5 @@ public interface CompositionEntityDataManager { componentId); public void saveImagesByComponent(String vspId, Version version, Component component, String componentId); - public void saveDeploymentFlavors(String vspId, Version version, - CompositionData compositionData); } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml index 343f4aef62..afee456fc3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml @@ -116,6 +116,16 @@ openecomp-tosca-datatype ${openecomp.sdc.common.version} + + org.openecomp.sdc + openecomp-sdc-tosca-generator-api + 1.1.0-SNAPSHOT + + + org.openecomp.sdc + openecomp-sdc-vendor-license-api + 1.1.0-SNAPSHOT + diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup deleted file mode 100644 index 634e0874ac..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup +++ /dev/null @@ -1,108 +0,0 @@ - - - 4.0.0 - - openecomp-sdc-vendor-software-product-core - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-lib - 1.0-SNAPSHOT - - - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-api - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-nosqldb-api - 1.0-SNAPSHOT - - - org.freemarker - freemarker - 2.3.23 - - - org.testng - testng - ${testng.version} - test - - - org.openecomp.core - openecomp-config-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-model-impl - 1.0-SNAPSHOT - test - - - org.apache.xmlgraphics - fop - 2.1 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.7.4 - - - commons-io - commons-io - 2.5 - - - org.mockito - mockito-all - 1.10.19 - - - junit - junit - 4.12 - test - - - org.openecomp.sdc.common - openecomp-configuration-management-core - 1707.0.0-SNAPSHOT - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.openecomp.sdc.common - openecomp-configuration-management-api - 1707.0.0-SNAPSHOT - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - - \ No newline at end of file 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/errors/VendorSoftwareProductErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java index 5284b9a74f..d87059e89c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java @@ -64,6 +64,7 @@ public class VendorSoftwareProductErrorCodes { "VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED"; public static final String DUPLICATE_NIC_NAME_NOT_ALLOWED = "DUPLICATE_NIC_NAME_NOT_ALLOWED"; + public static final String NIC_NAME_FORMAT_NOT_ALLOWED = "NIC_NAME_FORMAT_NOT_ALLOWED"; public static final String NULL_NETWORKID_NOT_ALLOWED = "NULL_NETWORKID_NOT_ALLOWED"; @@ -102,6 +103,7 @@ public class VendorSoftwareProductErrorCodes { ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING = "ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING"; public static final String DUPLICATE_IMAGE_NAME_NOT_ALLOWED = "DUPLICATE_IMAGE_NAME_NOT_ALLOWED"; + public static final String IMAGE_NAME_FORMAT_NOT_ALLOWED = "IMAGE_NAME_FORMAT_NOT_ALLOWED"; public static final String VFC_IMAGE_INVALID_FORMAT = "VFC_IMAGE_INVALID_FORMAT"; public static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP = "FEATURE_GROUP_NOT_EXIST_FOR_VSP"; @@ -115,8 +117,11 @@ public class VendorSoftwareProductErrorCodes { = "SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED"; public static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED = "DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED"; + public static final String DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED = + "DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED"; public static final String INVALID_COMPUTE_FLAVOR_ID = "INVALID_COMPUTE_FLAVOR_ID"; public static final String DUPLICATE_COMPUTE_NAME_NOT_ALLOWED = "DUPLICATE_COMPUTE_NAME_NOT_ALLOWED"; + public static final String COMPUTE_NAME_FORMAT_NOT_ALLOWED = "COMPUTE_NAME_FORMAT_NOT_ALLOWED"; public static final String DELETE_IMAGE_NOT_ALLOWED = "DELETE_IMAGE_NOT_ALLOWED"; public static final String UPDATE_IMAGE_NOT_ALLOWED = "UPDATE_IMAGE_NOT_ALLOWED"; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.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/ManualVspDataCollectionService.java similarity index 71% rename from openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.java rename to openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java index 981bfe941a..1499bccec2 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.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/ManualVspDataCollectionService.java @@ -1,35 +1,40 @@ -package org.openecomp.sdc.vendorsoftwareproduct.utils; +package org.openecomp.sdc.vendorsoftwareproduct.services; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor; import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo; +import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerErrorCode; +import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager; -import org.openecomp.sdc.vendorsoftwareproduct.ComputeManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager; -import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.ImageManager; -import org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.NicManager; -import org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; -import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory; +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.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.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; @@ -50,18 +55,19 @@ import java.util.Optional; public class ManualVspDataCollectionService { - private static final DeploymentFlavorManager deploymentFlavorManager = - DeploymentFlavorManagerFactory.getInstance().createInterface(); - private static final ComputeManager computeManager = - ComputeManagerFactory.getInstance().createInterface(); - private static final ImageManager imageManager = - ImageManagerFactory.getInstance().createInterface(); - private static final ComponentManager componentManager = - ComponentManagerFactory.getInstance().createInterface(); - private static final VendorSoftwareProductManager vendorSoftwareProductManager = - VspManagerFactory.getInstance().createInterface(); - private static final NicManager nicManager = - NicManagerFactory.getInstance().createInterface(); + private static final VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao = + VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); + private static final ComputeDao computeDao = + ComputeDaoFactory.getInstance().createInterface(); + private static final ImageDao imageDao = + ImageDaoFactory.getInstance().createInterface(); + private static final ComponentDao componentDao = + ComponentDaoFactory.getInstance().createInterface(); + + private static final NicDao nicDao = + NicDaoFactory.getInstance().createInterface(); private static final VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance().createInterface(); @@ -76,7 +82,7 @@ public class ManualVspDataCollectionService { */ public Optional getReleaseVendor(String vspId, Version version, String user) { String vendorName = null; - VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version, user); + VspDetails vspDetails = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version)); if (Objects.nonNull(vspDetails)) { vendorName = vspDetails.getVendorName(); } @@ -95,13 +101,13 @@ public class ManualVspDataCollectionService { String user) { Map allowedFlavors = new HashMap<>(); Collection deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) { for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData(); - VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version, user); + VspDetails vspDetails = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version)); String vspVlmId; Version vlmVersion; if (Objects.nonNull(vspDetails)) { @@ -123,8 +129,9 @@ public class ManualVspDataCollectionService { user); partNumber.ifPresent(deploymentFlavorModel::setSp_part_number); //Gather and set Vendor Info - Optional vendorInfo = getVendorInfo(vspVlmId, vlmVersion, featureGroupId, - user); + String vendorModel = deploymentFlavorCompositionData.getModel(); + Optional vendorInfo = getVendorInfo(vspVlmId, vendorModel, vlmVersion, + featureGroupId, user); vendorInfo.ifPresent(deploymentFlavorModel::setVendor_info); //Gather and set Compute info List componentComputeAssociations = @@ -161,7 +168,7 @@ public class ManualVspDataCollectionService { String user) { Map> vspComponentImages = new HashMap<>(); Collection deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData(); @@ -194,7 +201,7 @@ public class ManualVspDataCollectionService { public Map getVspComponents(String vspId, Version version, String user) { Map componentIdNameMap = new HashMap<>(); Collection deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData(); @@ -224,7 +231,7 @@ public class ManualVspDataCollectionService { public Map> getVspComponentNics(String vspId, Version version, String user) { Map> vspComponentNics = new HashMap<>(); Collection deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) { for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = @@ -251,15 +258,14 @@ public class ManualVspDataCollectionService { private List getComponentNics(String vspId, Version version, String componentId, String user) { List componentNics = new ArrayList<>(); - Collection nics = nicManager.listNics(vspId, version, componentId, user); + Collection nics = nicDao.list(new NicEntity(vspId, version, componentId, null)); if (Objects.nonNull(nics)) { - for (NicEntity nicEntity : nics) { - String nicId = nicEntity.getId(); - CompositionEntityResponse nicCompositionEntityResponse = - nicManager.getNic(vspId, version, componentId, nicId, user); - if (Objects.nonNull(nicCompositionEntityResponse) - && Objects.nonNull(nicCompositionEntityResponse.getData())) { - componentNics.add(nicCompositionEntityResponse.getData()); + for (NicEntity nic : nics) { + String nicId = nic.getId(); + NicEntity nicEntity = nicDao.get(new NicEntity(vspId, version, componentId, nicId)); + if (Objects.nonNull(nicEntity) + && Objects.nonNull(nicEntity.getCompositionData())) { + componentNics.add(nicEntity.getNicCompositionData()); } } } @@ -281,7 +287,7 @@ public class ManualVspDataCollectionService { return Optional.empty(); } - private Optional getVendorInfo(String vlmId, Version version, + private Optional getVendorInfo(String vlmId, String vendorModel, Version version, String featureGroupId, String user) { VendorInfo vendorInfo = null; FeatureGroupModel featureGroup = getFeatureGroup(vlmId, version, featureGroupId, user); @@ -289,7 +295,7 @@ public class ManualVspDataCollectionService { //Process Feature group to get Manufacturer ref no. String manufacturerReferenceNumber = featureGroup.getEntityManufacturerReferenceNumber(); vendorInfo = new VendorInfo(); - vendorInfo.setVendor_model(vlmId); + vendorInfo.setVendor_model(vendorModel); if (Objects.nonNull(manufacturerReferenceNumber)) { vendorInfo.setManufacturer_reference_number(manufacturerReferenceNumber); } @@ -301,21 +307,29 @@ public class ManualVspDataCollectionService { String componentId, String computeFlavorId, String user) { ComputeFlavor computeFlavor = null; - QuestionnaireResponse computeQuestionnaire; + ComputeEntity computeQuestionnaire = null; try { - computeQuestionnaire = computeManager.getComputeQuestionnaire(vspId, version, componentId, - computeFlavorId, user); + computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, + computeFlavorId); } catch (Exception ex) { computeQuestionnaire = null; + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Failed to get compute questionnaire : " + + ex.getMessage()); } if (Objects.nonNull(computeQuestionnaire)) { - String computeQuestionnaireData = computeQuestionnaire.getData(); + String computeQuestionnaireData = computeQuestionnaire.getQuestionnaireData(); if (Objects.nonNull(computeQuestionnaireData)) { Compute compute; try { compute = JsonUtil.json2Object(computeQuestionnaireData, Compute.class); } catch (Exception ex) { compute = null; + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse compute questionnaire : " + + ex.getMessage()); } if (Objects.nonNull(compute.getVmSizing())) { computeFlavor = new ComputeFlavor(); @@ -323,10 +337,10 @@ public class ManualVspDataCollectionService { computeFlavor.setNum_cpus(compute.getVmSizing().getNumOfCPUs()); } if (Objects.nonNull(compute.getVmSizing().getFileSystemSizeGB())) { - computeFlavor.setDisk_size(compute.getVmSizing().getFileSystemSizeGB() + "GB"); + computeFlavor.setDisk_size(compute.getVmSizing().getFileSystemSizeGB() + " GB"); } if (Objects.nonNull(compute.getVmSizing().getMemoryRAM())) { - computeFlavor.setMem_size(compute.getVmSizing().getMemoryRAM() + "GB"); + computeFlavor.setMem_size(compute.getVmSizing().getMemoryRAM()); } } } @@ -345,74 +359,63 @@ public class ManualVspDataCollectionService { private Optional getComponentName(String vspId, Version version, String componentId, String user) { - CompositionEntityResponse component = - componentManager.getComponent(vspId, version, componentId, user); - if (Objects.nonNull(component.getData())) { - return Optional.ofNullable(component.getData().getDisplayName()); + + ComponentEntity componentEntity = + componentDao.get(new ComponentEntity(vspId, version, componentId)); + if (Objects.nonNull(componentEntity) + && Objects.nonNull(componentEntity.getComponentCompositionData())) { + ComponentData componentCompositionData = componentEntity.getComponentCompositionData(); + return Optional.ofNullable(componentCompositionData.getDisplayName()); } return Optional.empty(); } private List getComponentImages(String vspId, Version version, String componentId, String user) { - List componentImages = new ArrayList<>(); + List multiFlavorVfcImages = new ArrayList<>(); MultiFlavorVfcImage multiFlavorVfcImage = null; - Collection imageEntities = - imageManager.listImages(vspId, version, componentId, user); - if (Objects.nonNull(imageEntities)) { - for (ImageEntity imageEntity : imageEntities) { - String imageId = imageEntity.getId(); - QuestionnaireResponse imageQuestionnaire = - imageManager.getImageQuestionnaire(vspId, version, componentId, imageId, user); - CompositionEntityResponse imageCompositionData = - imageManager.getImage(vspId, version, componentId, imageId, user); - if (Objects.nonNull(imageQuestionnaire) - && Objects.nonNull(imageQuestionnaire.getData()) + Collection componentImages = + vendorSoftwareProductDao.listImages(vspId, version, componentId); + if (Objects.nonNull(componentImages)) { + for (ImageEntity componentImage : componentImages) { + String imageId = componentImage.getId(); + ImageEntity imageEntity = vendorSoftwareProductDao.getImage(vspId, version, componentId, + imageId); + ImageEntity imageQuestionnaireDataEntity = imageDao.getQuestionnaireData(vspId, version, + componentId, imageId); + Image imageCompositionData = imageEntity.getImageCompositionData(); + if (Objects.nonNull(imageEntity) + && Objects.nonNull(imageQuestionnaireDataEntity) && Objects.nonNull(imageCompositionData)) { ImageDetails imageDetails; try { - imageDetails = JsonUtil.json2Object(imageQuestionnaire.getData(), - ImageDetails.class); + imageDetails = JsonUtil.json2Object(imageQuestionnaireDataEntity + .getQuestionnaireData(), ImageDetails.class); } catch (Exception ex) { imageDetails = null; + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse image questionnaire : " + + ex.getMessage()); } if (Objects.nonNull(imageDetails) && Objects.nonNull(imageDetails.getVersion())) { //Image version is used as a key for the image block //So excluding the population if questionnaire data is absent or invalid multiFlavorVfcImage = new MultiFlavorVfcImage(); - Image image = imageCompositionData.getData(); - Optional toscaImageFileName = getToscaImageFileName(image, imageDetails); - toscaImageFileName.ifPresent(multiFlavorVfcImage::setFile_name); multiFlavorVfcImage.setSoftware_version(imageDetails.getVersion()); + if (Objects.nonNull(imageCompositionData.getFileName())) { + multiFlavorVfcImage.setFile_name(imageCompositionData.getFileName()); + } if (Objects.nonNull(imageDetails.getMd5())) { multiFlavorVfcImage.setFile_hash(imageDetails.getMd5()); } multiFlavorVfcImage.setFile_hash_type("md5"); - componentImages.add(multiFlavorVfcImage); + multiFlavorVfcImages.add(multiFlavorVfcImage); } } } } - return componentImages; - } - - private Optional getToscaImageFileName(Image image, ImageDetails imageDetails) { - String toscaImageFileName = null; - StringBuilder builder = new StringBuilder(); - if (Objects.nonNull(image.getFileName())) { - builder.append(image.getFileName()); - builder.append("-"); - builder.append(imageDetails.getVersion()); - if (Objects.nonNull(imageDetails.getFormat())) { - builder.append("."); - builder.append(imageDetails.getFormat()); - } - } - toscaImageFileName = builder.toString(); - if (toscaImageFileName.isEmpty()) { - return Optional.empty(); - } - return Optional.ofNullable(toscaImageFileName); + return multiFlavorVfcImages; } } 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/composition/CompositionDataExtractorImpl.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/composition/CompositionDataExtractorImpl.java index 6b55ffc714..a16fea19ab 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/composition/CompositionDataExtractorImpl.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/composition/CompositionDataExtractorImpl.java @@ -338,7 +338,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { if (obj instanceof String) { images.add((String) obj); } else { - HashMap objMap = new ObjectMapper().convertValue(obj,HashMap.class); + Map objMap = new ObjectMapper().convertValue(obj,Map.class); images.add(getInputs(toscaServiceModel,objMap.get("get_input"))); } } @@ -364,7 +364,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { if (obj instanceof String) { computes.add((String) obj); } else { - HashMap objMap = new ObjectMapper().convertValue(obj, HashMap.class); + Map objMap = new ObjectMapper().convertValue(obj, Map.class); computes.add(getInputs(toscaServiceModel, objMap.get("get_input"))); } } @@ -387,7 +387,13 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { for (Map.Entry inputEntry : serviceTemplate .getTopology_template().getInputs().entrySet()) { if (inputEntry.getKey().equals(inputValue)) { - return (String)inputEntry.getValue().get_default(); + String value; + try { + value= (String) inputEntry.getValue().get_default(); + } catch (Exception e) { + value = inputEntry.getValue().get_default().toString(); + } + return value; } } } 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/composition/CompositionEntityDataManagerImpl.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/composition/CompositionEntityDataManagerImpl.java index 71f5fa1d41..7d5d57dc37 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/composition/CompositionEntityDataManagerImpl.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/composition/CompositionEntityDataManagerImpl.java @@ -224,7 +224,6 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa Map networkIdByName = saveNetworks(vspId, version, compositionData); saveComponents(vspId, version, compositionData, networkIdByName); - saveDeploymentFlavors(vspId, version, compositionData); mdcDataDebugMessage.debugExitMessage(null); } @@ -688,38 +687,4 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa } } - public void saveDeploymentFlavors(String vspId, Version version, - CompositionData compositionData) { - - mdcDataDebugMessage.debugEntryMessage(null, null); - - if (CollectionUtils.isNotEmpty(compositionData.getComponents())) { - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, - null); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - VspDetails vendorSoftwareProductInfo = - vspInfoDao.get(new VspDetails(vspId, version)); - if (vendorSoftwareProductInfo.getName() != null) { - deploymentFlavor.setModel(vendorSoftwareProductInfo.getName()); - List componentComputeAssociationList = new ArrayList<>(); - Collection computes= vendorSoftwareProductDao.listComputesByVsp(vspId, - version); - for (ComputeEntity compute : computes) { - ComponentComputeAssociation componentComputeAssociation = new - ComponentComputeAssociation(); - if (compute.getComponentId() != null && compute.getId() != null){ - componentComputeAssociation.setComponentId(compute.getComponentId()); - componentComputeAssociation.setComputeFlavorId(compute.getId()); - componentComputeAssociationList.add(componentComputeAssociation); - } - } - deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList); - } - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - createDeploymentFlavor(deploymentFlavorEntity); - } - - mdcDataDebugMessage.debugExitMessage(null, null); - } - } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup deleted file mode 100644 index a1ee8d3985..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - openecomp-sdc-vendor-software-product-lib - pom - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - - - - - openecomp-sdc-vendor-software-product-api - openecomp-sdc-vendor-software-product-core - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup deleted file mode 100644 index 3c9a34a189..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - - openecomp-sdc-versioning-api - openecomp-sdc-versioning-api - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - org.openecomp.core - openecomp-facade-core - ${project.version} - - - org.openecomp.core - openecomp-facade-api - ${project.version} - - - org.openecomp.core - openecomp-nosqldb-core - ${project.version} - - - org.hibernate - hibernate-validator - ${hibernate.validator.version} - - - javax.el - javax.el-api - ${javax.el-api.version} - - - org.glassfish.web - javax.el - 2.2.4 - - - org.mockito - mockito-all - test - 1.10.19 - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - test - 4.11 - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup deleted file mode 100644 index ce41a59e20..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - - openecomp-sdc-versioning-core - openecomp-sdc-versioning-core - - - - org.openecomp.sdc - openecomp-sdc-lib - 1.0-SNAPSHOT - ../.. - - - - org.openecomp.sdc - openecomp-sdc-versioning-api - ${project.version} - - - - org.mockito - mockito-all - test - 1.10.19 - - - org.testng - testng - test - 6.8.5 - - - snakeyaml - org.yaml - - - - - junit - junit - test - 4.11 - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup deleted file mode 100644 index 7804ebfabc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - openecomp-sdc-versioning-lib - openecomp-sdc-versioning-lib - - pom - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-sdc-versioning-api - openecomp-sdc-versioning-core - - - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup deleted file mode 100644 index be3c3509ad..0000000000 --- a/openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,87 +0,0 @@ - - 4.0.0 - - org.openecomp.core - openecomp-tosca-lib - - - org.openecomp.core - openecomp-utilities-lib - 1.0-SNAPSHOT - - - org.openecomp.sdc - openecomp-sdc-datatypes-lib - 1.0-SNAPSHOT - - - org.openecomp.core - openecomp-common-lib - ${project.version} - - - ch.qos.logback - logback-classic - ${logback.version} - - - junit - junit - RELEASE - test - - - org.openecomp.sdc - openecomp-sdc-logging-core - 1.0-SNAPSHOT - - - org.openecomp.sdc.common - openecomp-configuration-management-core - 1707.0.0-SNAPSHOT - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.openecomp.sdc.common - openecomp-configuration-management-api - 1707.0.0-SNAPSHOT - - - org.openecomp.sdc.common - openecomp-tosca-datatype - 1707.0.0-SNAPSHOT - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - false - true - - - - - - - openecomp-tosca-lib - - - openecomp-sdc-lib - org.openecomp.sdc - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java index b5b3e172fe..745f77f7f5 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java @@ -87,6 +87,6 @@ public class ToscaNodeType { public static String VNF_CONFIG_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "VnfConfiguration"; public static String MULTIFLAVOR_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "MultiFlavorVFC"; public static String MULTIDEPLOYMENTFLAVOR_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX - + "MultiDeploymentFlavor"; + + "MultiDeploymentFlavor.CVFC"; } diff --git a/openecomp-be/lib/pom.xml.versionsBackup b/openecomp-be/lib/pom.xml.versionsBackup deleted file mode 100644 index 18594461f4..0000000000 --- a/openecomp-be/lib/pom.xml.versionsBackup +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - openecomp-sdc-lib - openecomp-sdc-lib - - pom - - openecomp-sdc - org.openecomp.sdc - 1.0-SNAPSHOT - - - - openecomp-core-lib - openecomp-common-lib - openecomp-sdc-versioning-lib - openecomp-sdc-vendor-license-lib - openecomp-sdc-vendor-software-product-lib - openecomp-sdc-translator-lib - openecomp-sdc-model-lib - openecomp-sdc-validation-lib - openecomp-sdc-datatypes-lib - openecomp-heat-lib - openecomp-tosca-lib - openecomp-sdc-action-lib - openecomp-sdc-enrichment-lib - openecomp-logging-lib - openecomp-healing-lib - openecomp-migration-lib - - \ No newline at end of file diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl index 3dc85cf192..748f4da23e 100644 --- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl +++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl @@ -40,12 +40,12 @@ "memoryRAM": { "type": "string", "enum": [ - "1", - "2", - "4", - "8" + "1 GB", + "2 GB", + "4 GB", + "8 GB" ], - "default": "1" + "default": "1 GB" } }, "additionalProperties": false diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java index c8037cecf4..86faf15837 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java @@ -77,13 +77,10 @@ public class EntitlementPoolConvertor { info.setDescription(entitlementPool.getDescription()); info.addProperty("thresholdValue", entitlementPool.getThresholdValue()); info.addProperty("threshold_unit", entitlementPool.getThresholdUnit()); - info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); + //info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); info.addProperty("increments", entitlementPool.getIncrements()); - info.addProperty("aggregation_func", entitlementPool.getAggregationFunction()); info.addProperty("operational_scope", entitlementPool.getOperationalScope()); - info.addProperty("EntitlementTime", entitlementPool.getTime()); - info.addProperty("manufacturerReferenceNumber", - entitlementPool.getManufacturerReferenceNumber()); + return info; } diff --git a/openecomp-be/tools/migration/cassandra2zusammen.sh b/openecomp-be/tools/migration/cassandra2zusammen.sh index 6ef90ad3bf..99853b8336 100644 --- a/openecomp-be/tools/migration/cassandra2zusammen.sh +++ b/openecomp-be/tools/migration/cassandra2zusammen.sh @@ -9,7 +9,6 @@ # change exist package and service templates in db -java -Dlog.home=/apps/jetty/base/be/logs -Dconfiguration.yaml=/apps/jetty/base/be/config/catalog-be/configuration.yaml -jar openecomp-zusammen-migration-1.0-SNAPSHOT.jar org.openecomp.core.migration.MigrationMain - -STATUS="${?}" -echo "${STATUS}" +## Code removed but script is kept for future hook use ## +##STATUS="${?}" +##echo "${STATUS}" diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java index b92ba52000..685f70db98 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java @@ -18,6 +18,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import static java.nio.file.Files.createDirectories; public class ExportDataCommand { @@ -25,6 +29,8 @@ public class ExportDataCommand { public static void exportData(SessionContext context, String filterItem) { try { + Set filteredItem = new HashSet<>(); + filteredItem.add(filterItem); ImportProperties.initParams(); CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem(); Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY); @@ -32,10 +38,10 @@ public class ExportDataCommand { if (filterItem != null) { filterItem = filterItem.replaceAll("\\r", ""); } - new ItemHandler().createItemsData(context, filterItem); - new VersionHandler().loadVersions(filterItem); - new ElementHandler().loadElements(filterItem); - zipPath(rootDir,filterItem); + new ItemHandler().createItemsData(context, filteredItem); + new VersionHandler().loadVersions(filteredItem); + new ElementHandler().loadElements(filteredItem); + zipPath(rootDir,filteredItem); FileUtils.forceDelete(rootDir.toFile()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); @@ -43,12 +49,14 @@ public class ExportDataCommand { } } - private static void zipPath(Path rootDir,String filterItem ) throws Exception{ + private static void zipPath(Path rootDir,Set filterItem ) throws Exception{ LocalDateTime date = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; String dateStr = date.format(formatter); String zipFile = System.getProperty("user.home")+ File.separatorChar+"onboarding_import"+ dateStr + ".zip"; ZipUtils.createZip(zipFile, rootDir,filterItem); + logger.info("Exported file :" + zipFile); + System.out.println("Exported file :" + zipFile); } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java index ebce90fb4a..49eaaeaa76 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java @@ -10,6 +10,7 @@ import java.nio.ByteBuffer; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Objects; +import java.util.Set; import static java.io.File.separator; import static java.nio.file.Files.*; @@ -22,15 +23,16 @@ public class ElementHandler { public ElementHandler() { } - public void loadElements(String filteredItem) { + public void loadElements(Set filteredItem) { ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader(); - elementCassandraLoader.list().forEach(elementEntity -> handleElementEntity(elementEntity,filteredItem)); + elementCassandraLoader.list().forEach(elementEntity -> handleElementEntity(elementEntity,filteredItem)); } - private void handleElementEntity(ElementEntity elementEntity, String filteredItem) { + private void handleElementEntity(ElementEntity elementEntity, Set filteredItem) { try { String itemId = elementEntity.getItemId(); - if (filteredItem != null && !itemId.contains(filteredItem)){ + + if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)){ return; } String versionId = elementEntity.getVersionId(); @@ -42,11 +44,18 @@ public class ElementHandler { if (!isNull(namespace)){ namespacePath = namespace.replace(ELEMENT_NAMESPACE_SPLITTER,separator)+separator; } - Path elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId - + separator + versionId + separator + space + separator + namespacePath+ separator + elementId); + Path elementDirectoryPath; + if (!isNull(namespace)){ + elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId + + separator + versionId + separator + space + separator + namespacePath+ separator + elementId); + } else { + elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId + + separator + versionId + separator + space + separator + elementId); + } + if (notExists(elementDirectoryPath)) { - createDirectories(elementDirectoryPath); - } + Path created = createDirectories(elementDirectoryPath); + } String info = elementEntity.getInfo(); if (!isNull(info)) { diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java index 9eea182609..710b731f8b 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java @@ -1,9 +1,11 @@ package org.openecomp.core.tools.Commands.exportdata; +import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.Item; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDao; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDaoFactory; +import com.google.common.base.Strings; import org.openecomp.core.tools.Commands.ExportDataCommand; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.logging.api.Logger; @@ -13,11 +15,14 @@ import java.io.IOException; import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import java.util.Set; -import static java.nio.file.Files.*; import static java.io.File.separator; -import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*; +import static java.nio.file.Files.*; +import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX; public class ItemHandler { private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class); @@ -27,21 +32,42 @@ public class ItemHandler { ImportProperties.initParams(); } - public void createItemsData(SessionContext context, String filteredItem) throws URISyntaxException, IOException { + public void createItemsData(SessionContext context, Set filteredItem) throws URISyntaxException, IOException { + final List items = new ArrayList<>(); + if (filteredItem.isEmpty()) { + items.addAll(getItemDao(context).list(context)); + } else { + Optional item = addItem(context, filteredItem.iterator().next(), items); + item.ifPresent(foundedItem -> { + Object vendorId = foundedItem.getInfo().getProperty("vendorId"); + if (vendorId != null) { + String vendorIdStr = vendorId.toString(); + addItem(context, vendorIdStr, items); + filteredItem.add(vendorIdStr); + } + }); + } + + items.parallelStream().forEach(item -> createItemDirectoryAndFiles(item, filteredItem)); + + } + - List items = getItemDao(context).list(context); - items.parallelStream().forEach(item -> createItemDirectoryAndFiles(item,filteredItem)); + private Optional addItem(SessionContext context, String filteredItem, List items) { + Optional item = getItemDao(context).get(context, new Id(filteredItem)); + item.ifPresent(itemData -> items.add(itemData)); + return item; } - private final void createItemDirectoryAndFiles(Item item,String filteredItem) { + private final void createItemDirectoryAndFiles(Item item, Set filteredItem) { try { String itemId = item.getId().getValue(); - if (filteredItem != null && !itemId.contains(filteredItem)){ + if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)) { return; } - Path itemPath = Paths.get( ImportProperties.ROOT_DIRECTORY + separator + itemId); - Path itemFilePath = Paths.get( ImportProperties.ROOT_DIRECTORY + separator + + Path itemPath = Paths.get(ImportProperties.ROOT_DIRECTORY + separator + itemId); + Path itemFilePath = Paths.get(ImportProperties.ROOT_DIRECTORY + separator + itemId + separator + itemId + JSON_POSTFIX); if (notExists(itemPath)) { createDirectories(itemPath); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java index b8d82958c9..e8e703bff0 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java @@ -17,6 +17,7 @@ import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.ROOT import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Set; public class VersionHandler { private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class); @@ -24,17 +25,17 @@ public class VersionHandler { public VersionHandler() { } - public void loadVersions(String filteredItem) { + public void loadVersions(Set filteredItem) { VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader(); versionCassandraLoader.list().forEach(versionEntity -> handleVersionEntity(versionEntity,filteredItem)); VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader(); versionInfoCassandraLoader.list().forEach(versionInfoEntity -> handleVersionInfo(versionInfoEntity,filteredItem)); } - private void handleVersionEntity(VersionEntity versionEntity, String filteredItem) { + private void handleVersionEntity(VersionEntity versionEntity, Set filteredItem) { try { String itemId = versionEntity.getItemId(); - if (filteredItem != null && !itemId.contains(filteredItem)){ + if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)){ return; } String versionId = versionEntity.getVersionId(); @@ -55,7 +56,7 @@ public class VersionHandler { } - private void handleVersionInfo(VersionInfoEntity versionInfoEntity, String filteredItem) { + private void handleVersionInfo(VersionInfoEntity versionInfoEntity, Set filteredItem) { try { String itemId = versionInfoEntity.getEntityId(); Path itemDirectory = Paths.get( ROOT_DIRECTORY + separator + itemId); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java index 7ba830906c..d51458aff1 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java @@ -1,5 +1,6 @@ package org.openecomp.core.tools.Commands.importdata; +import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import org.openecomp.core.tools.store.ElementCassandraLoader; import org.openecomp.core.tools.store.ElementNamespaceHandler; @@ -15,21 +16,26 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; +import java.util.HashSet; import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static java.io.File.separator; import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*; public class ElementImport { private static final Logger logger = LoggerFactory.getLogger(ElementImport.class); + public static final String ROOT_ITEM = Id.ZERO.getValue(); + private ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader(); private ElementNamespaceHandler cassandraElementRepository = new ElementNamespaceHandler(); private VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader(); - public void loadPath(SessionContext sessionContext, Path elementDir, String elementId, String[] pathObjects) { + public void loadPath(SessionContext sessionContext, Path elementDir, String elementId, String[] + pathObjects) { try { + if (!Files.isDirectory(elementDir)){ + return; + } // load info file ElementEntity elementEntity = new ElementEntity(); Path infoFilePath = Paths.get(elementDir.toString() + separator + ELEMENT_INFO_PREFIX @@ -38,7 +44,6 @@ public class ElementImport { String info = new String(Files.readAllBytes(infoFilePath)); elementEntity.setInfo(info); } - // load relation file Path realtionsFilePath = Paths.get(elementDir.toString() + separator + ELEMENT_RELATION_PREFIX + elementId + JSON_POSTFIX); @@ -58,7 +63,7 @@ public class ElementImport { //load visualization Path visualFilePath = Paths.get(elementDir.toString() + separator - + ELEMENT_VISUALIZATION_PREFIX + elementId ); + + ELEMENT_VISUALIZATION_PREFIX + elementId); if (Files.exists(visualFilePath)) { byte[] bytes = Files.readAllBytes(visualFilePath); ByteBuffer visualization = ByteBuffer.wrap(bytes); @@ -67,45 +72,60 @@ public class ElementImport { //load searchable Path searchableFilePath = Paths.get(elementDir.toString() + separator - + ELEMENT_SEARCHABLE_PREFIX + elementId ); + + ELEMENT_SEARCHABLE_PREFIX + elementId); if (Files.exists(searchableFilePath)) { byte[] bytes = Files.readAllBytes(searchableFilePath); ByteBuffer searchable = ByteBuffer.wrap(bytes); elementEntity.setSearchableData(searchable); } - + String element_Id = pathObjects[pathObjects.length - 1]; elementEntity.setSpace(pathObjects[2]); elementEntity.setItemId(pathObjects[0]); elementEntity.setVersionId(pathObjects[1]); - elementEntity.setElement_id(pathObjects[pathObjects.length - 1]); + elementEntity.setElement_id(element_Id); elementEntity.setNamespace(getNameSpace(pathObjects)); elementEntity.setParentId(getParentId(pathObjects)); - elementEntity.setSubElementIds(getAllSubElementsIds(elementDir)); + elementEntity.setSubElementIds(getAllSubElementsIds(elementDir, element_Id)); elementCassandraLoader.createEntity(elementEntity); cassandraElementRepository.createElementNamespace(elementEntity); versionCassandraLoader.insertElementToVersion(elementEntity); } catch (Exception ex) { logger.error(ex.getMessage(), ex); + ex.printStackTrace(); } } private String getParentId(String[] pathObjects) { - if (pathObjects.length <= 4) { + + if (pathObjects[pathObjects.length - 1].equals(ROOT_ITEM)) { return null; } + if (pathObjects.length == 4) { + return ROOT_ITEM; + } return pathObjects[pathObjects.length - 2]; } - private Set getAllSubElementsIds(Path root) throws IOException { - try (Stream walk = Files.walk(root)) { - return walk.filter(path -> Files.isDirectory(path)) - .map(path -> path.toFile().getName() ).collect(Collectors.toSet()); + private Set getAllSubElementsIds(Path root, String elementId) throws IOException { + if (elementId.equals(ROOT_ITEM)) { + root = root.getParent(); + } + File file = root.toFile(); + Set retVal = new HashSet<>(); + File[] files = file.listFiles(); + for (File f : files){ + if (f.isDirectory()){ + retVal.add(f.getName()); + } } + retVal.remove(ROOT_ITEM); + return retVal; + } private String getNameSpace(String[] pathObjects) { if (pathObjects.length <= 4) { - return null; + return ""; } if (pathObjects.length == 5) { return pathObjects[3]; diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java index c7042743c2..9ec5d639c2 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java @@ -31,8 +31,11 @@ public class ItemImport { Item item = JsonUtil.json2Object(itemJson, Item.class); ItemDao itemDao = getItemDao(sessionContext); itemDao.create(sessionContext, item.getId(), item.getInfo(), item.getCreationTime()); + logger.info("Item Created :"+item.getInfo().getName()+" , "+item.getId()); + System.out.println("Item Created :"+item.getInfo().getName()+" , "+item.getId()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); + ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java index 020b2f3c47..15f8b02e2b 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java @@ -4,10 +4,14 @@ import com.amdocs.zusammen.datatypes.SessionContext; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import javax.validation.constraints.Min; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.stream.Stream; public class TreeWalker { @@ -21,7 +25,10 @@ public class TreeWalker { } private static final void handlePath(SessionContext sessionContext, Path path, Path root,String filterItem) { - String logicalPath = path.toString().replace(root.toString()+File.separator, ""); + String logicalPath = path.toString().replace(root.toString(), ""); + if (logicalPath.startsWith(File.separator)){ + logicalPath = logicalPath.substring(1); + } String[] splitted = logicalPath.split(File.separator); if(filterItem != null && splitted.length > 0 && !splitted[0].contains(filterItem)){ return; @@ -42,7 +49,7 @@ public class TreeWalker { break; default: //handle elements - new ElementImport().loadPath(sessionContext,path,splitted[splitted.length -1],splitted); + new ElementImport().loadPath(sessionContext,path,splitted[splitted.length -1],splitted); break; } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java index 6447f85ea7..2f6693d133 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java @@ -10,12 +10,14 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Objects; import java.util.Scanner; +import java.util.Set; +import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; public class ZipUtils { - public static void createZip(String zipFileName, Path dir, String filterItem) throws Exception { + public static void createZip(String zipFileName, Path dir, Set filterItem) throws Exception { File dirObj = dir.toFile(); try ( FileOutputStream fileOutputStream = new FileOutputStream(zipFileName); @@ -24,29 +26,34 @@ public class ZipUtils { } } - public static final String cleanStr(String inFilterStr) { - if (Objects.isNull(inFilterStr)) { - return inFilterStr; - } - Scanner scan = new Scanner(inFilterStr); - while (scan.hasNextLine()) { - inFilterStr = scan.nextLine().replaceAll("[^a-zA-Z0-9]", ""); - } - return inFilterStr; + public static final Set cleanStr(Set inFilterStrs) { + return inFilterStrs.stream().map(inFilterStr -> { + if (Objects.isNull(inFilterStr)) { + return inFilterStr; + } + Scanner scan = new Scanner(inFilterStr); + while (scan.hasNextLine()) { + inFilterStr = scan.nextLine().replaceAll("[^a-zA-Z0-9]", ""); + } + return inFilterStr; + } + ).collect(Collectors.toSet()); } - static void addDir(File dirObj, ZipOutputStream out, String root, String filterItem) throws IOException { + static void addDir(File dirObj, ZipOutputStream out, String root, Set filterItem) throws IOException { File[] files = dirObj.listFiles(); filterItem = cleanStr(filterItem); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { addDir(files[i], out, root, filterItem); + String filePath = files[i].getAbsolutePath().replace(root + File.separator, "") + "/"; + out.putNextEntry(new ZipEntry(filePath)); continue; } try (FileInputStream in = new FileInputStream((files[i].getAbsolutePath()))) { String filePath = files[i].getAbsolutePath().replace(root + File.separator, ""); - if (filterItem == null || filePath.contains(filterItem)) { + if (filterItem.isEmpty() || filterItem.stream().anyMatch(s -> filePath.contains(s))) { out.putNextEntry(new ZipEntry(filePath)); try { ByteStreams.copy(in, out); @@ -74,9 +81,16 @@ public class ZipUtils { while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFolder.toString() + File.separator + fileName); - new File(newFile.getParent()).mkdirs(); - try (FileOutputStream fos = new FileOutputStream(newFile)) { - ByteStreams.copy(zis, fos); + if (ze.isDirectory()) { + Path path = newFile.toPath(); + if (!Files.exists(path)) { + Files.createDirectories(path); + } + } else { + new File(newFile.getParent()).mkdirs(); + try (FileOutputStream fos = new FileOutputStream(newFile)) { + ByteStreams.copy(zis, fos); + } } ze = zis.getNextEntry(); } diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml index b1c1335302..a13dc82e22 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml +++ b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml @@ -1,282 +1,17 @@ - - + - - - - - - - - - - - - - - - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i - - 1 - 10 - - - - 20MB - - - ${default-log-pattern} - - - - - - - - - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log - - - - - - AUDIT_MARKER - - NEUTRAL - DENY - - - - - - TRANSACTION_MARKER - - NEUTRAL - DENY - - - - - INFO - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log.%i - - 1 - 10 - - - - 20MB - + + - ${default-log-pattern} + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log - - - - - - - TRANSACTION_MARKER - - NEUTRAL - DENY - - - - - - e.level.toInt() <= DEBUG.toInt() - - - DENY - NEUTRAL - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i - - 1 - 10 - - - - 20MB - - - ${default-log-pattern} - - - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/cassandra2zusammen_migration_debug.log - - - - - - - TRANSACTION_MARKER - - NEUTRAL - DENY - - - - - - - e.level.toInt() <= DEBUG.toInt() - - - DENY - NEUTRAL - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log.%i - - 1 - 10 - - - - 20MB - - - ${asdc-debug-log-pattern} - - - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log - - - - - - AUDIT_MARKER - - DENY - ACCEPT - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i - - 1 - 10 - - - - 20MB - - - ${default-log-pattern} - - - - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log - - - - - - TRANSACTION_MARKER - - DENY - ACCEPT - - - - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log.%i - - 1 - 10 - - - - 20MB - - - ${default-log-pattern} - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + \ No newline at end of file diff --git a/openecomp-ui/.gitignore b/openecomp-ui/.gitignore index 2a11210d95..13e532c095 100644 --- a/openecomp-ui/.gitignore +++ b/openecomp-ui/.gitignore @@ -6,6 +6,9 @@ debug.log dist node_modules devConfig.json +proxy-server.js +runLocalFE.cmd +runLocalFE.js .npmrc test/coverage npm-debug.log diff --git a/openecomp-ui/devConfig.defaults.json b/openecomp-ui/devConfig.defaults.json index 46f0d189e8..99380b1e50 100644 --- a/openecomp-ui/devConfig.defaults.json +++ b/openecomp-ui/devConfig.defaults.json @@ -1,6 +1,6 @@ { "port": 9000, - "proxyATTTarget": null, + "proxyCatalogTarget": null, "proxyTarget": null, "bundles": { "bundle": ["sdc-app/sdc.app.jsx"], diff --git a/openecomp-ui/package.json b/openecomp-ui/package.json index 0e1e66b80e..ef44bfb2b8 100644 --- a/openecomp-ui/package.json +++ b/openecomp-ui/package.json @@ -8,8 +8,8 @@ "start": "gulp dev && webpack-dev-server --progress", "build": "gulp build", "css-usage": "gulp css-usage", - "static-keys-bundle" : "gulp static-keys-bundle", - "check-keys-against-bundles" : "gulp static-keys-bundle-with-report", + "static-keys-bundle": "gulp static-keys-bundle", + "check-keys-against-bundles": "gulp static-keys-bundle-with-report", "test": "jest", "test-failedTestReport": "jest --json | node test-utils/failedTestReport.js", "test-dev": "jest --watch", @@ -18,9 +18,10 @@ "storyshots": "jest storyshots.test.js", "build-storybook": "build-storybook -c .storybook -o .storybook-dist && gulp copy-storybook-fonts && gulp copy-storybook-resources-prod" }, - "dependencies": { + "dependencies": { "classnames": "^2.2.5", "core-js": "^2.4.0", + "d3": "^3.5.16", "dox-sequence-diagram-ui": "file:../dox-sequence-diagram-ui", "intl": "^1.0.1", "intl-format-cache": "^2.0.5", @@ -39,7 +40,7 @@ "react-sortable": "^1.2.0", "redux": "^3.3.1", "restful-js": "^0.7.0", - "sdc-ui": "^1.5.12", + "sdc-ui": "1.6.0", "uuid-js": "^0.7.5", "validator": "^4.3.0" }, diff --git a/openecomp-ui/proxy-server.js b/openecomp-ui/proxy-server.js deleted file mode 100644 index 4733d38a89..0000000000 --- a/openecomp-ui/proxy-server.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -const proxy = require('http-proxy-middleware'); - -let localDevConfig = {}; -try { - localDevConfig = require('./devConfig'); -} catch (e) {} -const devConfig = Object.assign({}, require('./devConfig.defaults'), localDevConfig); -let devPort = process.env.PORT || devConfig.port; - -let jsonConfig = { - "appContextPath" : "/onboarding" -}; - -try { - jsonConfig = require('./src/sdc-app/config/config.json'); -} catch (e) { - console.log('could not load config. using deault value instead'); -} - -module.exports = function (server) { - let proxyConfigDefaults = { - changeOrigin: true, - secure: false, - onProxyRes: (proxyRes, req, res) => { - let setCookie = proxyRes.headers['set-cookie']; - if (setCookie) { - setCookie[0] = setCookie[0].replace(/\bSecure\b(; )?/, ''); - } - if (proxyRes.statusCode === 302 && proxyRes.headers.location.indexOf('login') > -1) { - proxyRes.headers.location = `http://localhost:${devPort}/sdc1#/onboardVendor`; - res.setHeader('Set-Cookie', [ - 'HTTP_CSP_EMAIL=csantana@sdc.com', - 'HTTP_CSP_FIRSTNAME=Carlos', - 'HTTP_CSP_LASTNAME=Santana', - 'HTTP_CSP_WSTYPE=Intranet', - 'HTTP_IV_REMOTE_ADDRESS=0.0.0.0', - 'HTTP_IV_USER=cs0008', - 'USER_ID=cs0008' - ]); - } - } - }; - - let middlewares = [ - (req, res, next) => { - if (req.url.indexOf('/proxy-designer1') > -1) { - req.url = req.url.replace('/proxy-designer1', ''); - } - - if (req.url.indexOf(jsonConfig.appContextPath + '/resources') > -1) { - req.url = req.url.replace(jsonConfig.appContextPath, ''); - } - - let match = req.url.match(/^(.*)_en.js$/); - let newUrl = match && match[1] + '.js'; - if (newUrl) { - console.log(`REWRITING URL: ${req.url} -> ${newUrl}`); - req.url = newUrl; - } - next(); - } - ]; - - // standalon back-end (proxyTarget) has higher priority, so it should be first - if (devConfig.proxyTarget) { - middlewares.push( - proxy(['/api', '/onboarding-api', '/sdc1/feProxy/onboarding-api'], Object.assign({}, proxyConfigDefaults, { - target: devConfig.proxyTarget, - pathRewrite: { - '/sdc1/feProxy/onboarding-api': '/onboarding-api' - } - })) - ); - } - - // ATT environment (proxyATTTarget) has lower priority, so it should be second - if (devConfig.proxyATTTarget) { - middlewares.push( - proxy(['/sdc1', '/onboarding-api', '/scripts', '/styles'], Object.assign({}, proxyConfigDefaults, { - target: devConfig.proxyATTTarget, - pathRewrite: { - // Workaround for some weird proxy issue - '/sdc1/feProxy/onboarding-api': '/sdc1/feProxy/onboarding-api', - '/onboarding-api': '/sdc1/feProxy/onboarding-api' - } - })) - ); - } - server.use(middlewares); -}; diff --git a/openecomp-ui/resources/scss/_modules.scss b/openecomp-ui/resources/scss/_modules.scss index 317f90800f..405e91a61b 100644 --- a/openecomp-ui/resources/scss/_modules.scss +++ b/openecomp-ui/resources/scss/_modules.scss @@ -1,4 +1,5 @@ @import "modules/licenseModelOverview"; +@import "modules/licenseModelLimits"; @import "modules/licenseAgreement"; @import "modules/featureGroup"; @import "modules/entitlementPools"; diff --git a/openecomp-ui/resources/scss/bootstrap-cust/_modals.scss b/openecomp-ui/resources/scss/bootstrap-cust/_modals.scss index 9301f1ed39..ad6b4f8aca 100644 --- a/openecomp-ui/resources/scss/bootstrap-cust/_modals.scss +++ b/openecomp-ui/resources/scss/bootstrap-cust/_modals.scss @@ -1,6 +1,7 @@ .modal-content { .modal-header { border-top: 3px solid $blue; + padding-left: 50px; .modal-title { @extend .heading-2; } diff --git a/openecomp-ui/resources/scss/common/_utils.scss b/openecomp-ui/resources/scss/common/_utils.scss index dce623e15d..54f8b977a3 100644 --- a/openecomp-ui/resources/scss/common/_utils.scss +++ b/openecomp-ui/resources/scss/common/_utils.scss @@ -219,14 +219,10 @@ $browserPrefixes: webkit moz o ms; width: $size; height: $size; background: $bgcolor; - border: 3px solid $bgcolor; - &:after { - content: $content; - position: relative; - left: 9px; - top: 9px; - @extend .circle-icon-text; - } + border: 3px solid $bgcolor; + display: flex; + align-items: center; + justify-content: center; } /**/ @@ -306,3 +302,12 @@ $browserPrefixes: webkit moz o ms; @mixin border-shadow($xShadow: 0.545px, $yShadow: 0.839px, $blur: 4px, $spread: 0, $color: $light-gray, $opacity: 0.2) { @include box-shadow($xShadow $yShadow $blur $spread rgba($color, $opacity)); } + +/* percent-plus-value */ +// @mixin +// Calculate length property (e.g. width, margin) by adding a value (e.g. in pixels) +// to a percentage of container height/width +@mixin percent-plus-value($property, $value, $percent: 100%) { + $string: 'calc(' + $percent + ' + ' + $value + ')'; + #{$property}: unquote($string); +} diff --git a/openecomp-ui/resources/scss/components/_datepicker.scss b/openecomp-ui/resources/scss/components/_datepicker.scss index 593bb09d7d..d51a1b690e 100644 --- a/openecomp-ui/resources/scss/components/_datepicker.scss +++ b/openecomp-ui/resources/scss/components/_datepicker.scss @@ -1,5 +1,6 @@ .customized-date-picker { margin-bottom: 24px; + display: flex; .date-picker-label { &.required { &:before { @@ -13,27 +14,38 @@ color: $dark-gray; margin-bottom: 8px; } + .react-datepicker__input-container { + flex: 1; + cursor: pointer; + } .datepicker-custom-input { display: flex; justify-content: space-between; - width: 243px; + align-items: center; height: 30px; border-radius: 2px; color: $dark-gray; border: 1px solid $light-gray; - padding: 6px 12px; + padding: 6px 8px 6px 12px; + .clear-input { + margin-left: auto; + margin-right: 8px; + .svg-icon { + fill: transparent; + height: 8px; + width: 8px; + } + } &:hover { border-color: $gray; .clear-input { - &:before { - cursor: pointer; - content: 'x'; + .svg-icon { + fill: initial; } } } .datepicker-text { cursor: pointer; - width: 170px; @extend .body-1; &.placeholder { color: $light-gray; @@ -43,9 +55,13 @@ .calendar-input { fill: $light-gray; } + .svg-icon-wrapper.calendar { + .svg-icon { + fill: $dark-gray; + width: 17px; + height: 17px; + } + } } - - - } diff --git a/openecomp-ui/resources/scss/components/_dualListBox.scss b/openecomp-ui/resources/scss/components/_dualListBox.scss index 4a1a940c34..4353ab39e8 100644 --- a/openecomp-ui/resources/scss/components/_dualListBox.scss +++ b/openecomp-ui/resources/scss/components/_dualListBox.scss @@ -7,8 +7,7 @@ } .dual-search-multi-select-section { - $multi-select-box-width: 398px; - width: $multi-select-box-width; + flex: 1; .dual-text-box-search-title, .dual-list-box-multi-select-text { @extend .body-1; color: $dark-gray; diff --git a/openecomp-ui/resources/scss/components/_notifications.scss b/openecomp-ui/resources/scss/components/_notifications.scss index 7165e57ef9..5b10dee0ee 100644 --- a/openecomp-ui/resources/scss/components/_notifications.scss +++ b/openecomp-ui/resources/scss/components/_notifications.scss @@ -15,6 +15,12 @@ } &.danger { + .modal-content .modal-header { + border-top: 3px solid $red; + } + } + + &.negative { .modal-content .modal-header { border-top: 3px solid $red; } diff --git a/openecomp-ui/resources/scss/components/_selectActionTable.scss b/openecomp-ui/resources/scss/components/_selectActionTable.scss index 4e42b6ce5b..79a5432ef1 100644 --- a/openecomp-ui/resources/scss/components/_selectActionTable.scss +++ b/openecomp-ui/resources/scss/components/_selectActionTable.scss @@ -72,6 +72,11 @@ fill: $green; } } + .svg-icon-wrapper.hideDelete { + .svg-icon { + fill: $white; + } + } .select-action-table-row { display: flex; flex: 1; @@ -80,6 +85,7 @@ &.has-error { border-color: $red; } + .select-action-table-cell { flex: 1; border-right: 1px solid; @@ -127,10 +133,9 @@ border-bottom: 1px solid $blue; overflow: auto; .Select-menu { - display: inline-block; .Select-option { - width: 100%; - display: inline-block; + overflow: hidden; + text-overflow: ellipsis; border-bottom: 1px solid $light-gray; &:hover { background-color: $blue; diff --git a/openecomp-ui/resources/scss/components/_validationForm.scss b/openecomp-ui/resources/scss/components/_validationForm.scss index 46269ad699..e4aac32b74 100644 --- a/openecomp-ui/resources/scss/components/_validationForm.scss +++ b/openecomp-ui/resources/scss/components/_validationForm.scss @@ -7,12 +7,10 @@ form { .validation-radio-wrapper { position: relative; } - .nav-tabs { + .sdc-tabs { position: relative; - .invalid-tab:not(.active) { - a { + .invalid-tab:not(.sdc-tab-active) { color: $red; - } } } .validation-error-message { diff --git a/openecomp-ui/resources/scss/modules/_entitlementPools.scss b/openecomp-ui/resources/scss/modules/_entitlementPools.scss index 0e0a72a387..ad0bb77e8d 100644 --- a/openecomp-ui/resources/scss/modules/_entitlementPools.scss +++ b/openecomp-ui/resources/scss/modules/_entitlementPools.scss @@ -1,6 +1,5 @@ -.entitlement-pools-list-editor { - +.entitlement-pools-list-editor { .list-editor-view-list { .list-editor-item-view { min-height: 110px; @@ -8,13 +7,9 @@ } .list-editor-item-view-field { - .entitlement-pools-count, .entitlement-parameters, .contract-number, .type{ + .entitlement-pools-count, .contract-number, .type{ color: $purple; } - .entitlement-parameters { - @include ellipsis; - margin-bottom: 2px; - } .entitlement-pools-count { @extend .heading-1; margin-top: -10px; @@ -25,22 +20,29 @@ } .entitlement-pools-modal { - .validation-form-content { - padding: 50px; - } .modal-body { padding: 0; } + .sdc-tab-content { + margin: 0; + } .entitlement-pools-form { - .tab-content { - padding: 50px; - } .threshold-section { display: flex; justify-content: space-between; .validation-input-wrapper { flex: 0 0 46%; } + } + .date-section { + display: flex; + justify-content: space-between; + .validation-input-wrapper { + flex: 0 0 46%; + } + } + .validation-form-content { + padding: 20px 50px; } } .validation-buttons { diff --git a/openecomp-ui/resources/scss/modules/_featureGroup.scss b/openecomp-ui/resources/scss/modules/_featureGroup.scss index 8c45d8ec58..9d395f98c8 100644 --- a/openecomp-ui/resources/scss/modules/_featureGroup.scss +++ b/openecomp-ui/resources/scss/modules/_featureGroup.scss @@ -32,6 +32,14 @@ margin-top: 55px; color: $dark-gray; } + .validation-form-content { + padding: 0; + } + + .nav.nav-tabs { + padding-left: 50px; + } + .tab-content { padding: 50px; .field-section { diff --git a/openecomp-ui/resources/scss/modules/_licenseKeyGroup.scss b/openecomp-ui/resources/scss/modules/_licenseKeyGroup.scss index 5de757bf64..d072849c08 100644 --- a/openecomp-ui/resources/scss/modules/_licenseKeyGroup.scss +++ b/openecomp-ui/resources/scss/modules/_licenseKeyGroup.scss @@ -16,23 +16,3 @@ } } } - -.license-key-groups-modal { - .modal-body { - padding: 0; - } - .license-key-groups-form { - .validation-form-content { - padding: 50px; - .field-section { - @extend .body-2-semibold; - margin-bottom: 23px; - width: 400px; - color: $black; - } - } - .validation-buttons { - padding: 20px 50px; - } - } -} diff --git a/openecomp-ui/resources/scss/modules/_licenseModel.scss b/openecomp-ui/resources/scss/modules/_licenseModel.scss index 3d65be6274..fab091fe67 100644 --- a/openecomp-ui/resources/scss/modules/_licenseModel.scss +++ b/openecomp-ui/resources/scss/modules/_licenseModel.scss @@ -1,20 +1,53 @@ -.license-model-type-modal { +.license-model-modal { .modal-body { padding: 0; } - .validation-form-content { - padding: 50px; - .field-section { - @extend .body-2-semibold; - margin-bottom: 23px; - width: 400px; - color: $black; + .modal-header { + border-bottom: none; + padding-bottom: 30px; + } + .modal-body { + padding: 0; + } + .sdc-tabs-list { + padding-left: 50px; + border-bottom: 1px solid $tlv-light-gray; + display: flex; + align-items: baseline; + } + .sdc-tab-content { + margin-top: 0; + } + .add-limit-button { + margin-left: auto; + margin-right: 50px; + padding-right: 0; + text-align: end; + } + .license-model-form { + .validation-form-content { + padding: 20px 50px; + } + .validation-buttons { + padding: 20px 50px; } - textarea { - height: 107px; + &.license-agreement-form, &.feature-group-form { + .validation-form-content { + padding: 0; + } + .sdc-tab-content { + padding: 20px 50px; + } + } + } + .license-model-modal-buttons { + padding: 21px 50px; + display: flex; + justify-content: flex-end; + background-color: $tlv-gray; + margin-top: 2px; + .sdc-button { + margin-left: 20px; } - } - .validation-buttons { - padding: 20px 50px; - } + } } diff --git a/openecomp-ui/resources/scss/modules/_licenseModelLimits.scss b/openecomp-ui/resources/scss/modules/_licenseModelLimits.scss new file mode 100644 index 0000000000..32fd128f2e --- /dev/null +++ b/openecomp-ui/resources/scss/modules/_licenseModelLimits.scss @@ -0,0 +1,121 @@ +.license-model-limits-view { + max-height: 490px; + overflow: auto; + + .limit-editor-title { + padding: 10px 50px; + background-color: $blue; + color: $white; + + } + .list-editor-view-add-title { + margin-right: 20px; + } + + .no-limits-text { + padding-left: 50px; + } + + .list-editor-view { + .list-editor-view-header { + border-bottom: none; + padding-top: 30px; + padding-bottom: 0; + } + + .list-editor-view-list-scroller { + margin-top: 0; + margin-bottom: 30px; + } + .list-editor-view-list { + width: 100%; + .list-editor-item-view { + min-height: 50px; + height: 50px; + background-color: $tlv-light-gray; + border-color: transparent; + margin: 1px 0; + .list-editor-item-view-content { + padding-left: 0; + } + .svg-icon-wrapper.trashO { + margin-bottom: 0; + margin-right: 50px; + .svg-icon { + fill: $gray; + height: 16px; + width: 16px; + &:hover { + fill: $dark-gray; + } + } + } + &.selectable { + &:hover { + background-color: darken($tlv-light-gray, 4%); + cursor: pointer; + } + } + &:hover { + border-color: transparent; + cursor: default; + } + .list-editor-item-view-content { + .list-editor-item-view-field { + display: flex; + align-items: center; + white-space: nowrap; + + &.limit-name { + .text.name { + @extend .body-1-semibold; + color: $blue; + text-transform: uppercase; + padding: 0px 10px; + } + + border-right: 1px solid $light-gray; + margin-right: 22px; + flex: 0.4; + display: flex; + justify-content: center; + } + + &.limit-description { + max-width: 300px; + margin-right: 22px; + } + + &.limit-metric-details { + max-width: 300px; + } + + .text.description, .text.name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + + } + } + } + } + .limit-editor{ + .limit-editor-form { + .limit-editor-form-grid-section { + padding-bottom: 0; + } + .validation-form-content { + padding: 21px 45px; + } + .limit-editor-buttons { + display: flex; + justify-content: flex-end; + .sdc-button { + margin-left: 20px; + } + } + } + } +} \ No newline at end of file diff --git a/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss b/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss index 5c74e82d83..1c133a1dce 100644 --- a/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss +++ b/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss @@ -1,3 +1,21 @@ +$list-indentation: 20px; +$arrow-margin: 30px; +$icon-margin: 30px; +$arrow-element-width: 30px; +$list-item-padding: 15px; + +@mixin overview-tile-shadow() { + @include box-shadow(0.5px 0.8px 4px 0 rgba(24, 24, 25, 0.05)); +} + +// @mixin vlm-list-item-inset($color) { +// @include box-shadow(inset 6px 0 0 0 $color); +// } + +$la-color: $dark-blue; +$fg-color: $blue; +$lkg-ep-color: $light-blue; + .license-model-overview { .overview-top-section { .overview-title{ @@ -20,60 +38,61 @@ .vendor-data-view { @extend .flex-column; background-color: $tlv-gray; - padding: 20px 30px; + padding: 13px 30px; border: 1px solid $tlv-light-gray; - @include border-shadow(); + @include overview-tile-shadow(); .vendor-title { margin-top:5px; } .vendor-name { @extend .heading-4-semibold; text-transform: none; - padding-bottom: 15px; + padding-bottom: 10px; border-bottom: 1px solid $tlv-light-gray; } - .vendor-description { + .vendor-description, .vendor-description-readonly { @extend .flex; @extend .body-1; justify-content: space-between; - margin-top: 10px; overflow: hidden; + position: relative; + flex: initial; + } + + &:not(.read-only) .vendor-description { border: 1px solid transparent; - position: relative; - left: -6px; - width: 101%; + padding: 2px 0 2px 6px; + margin-top: 10px; + $hover-padding-right: 16px; + @include percent-plus-value($property: width, $percent: 100%, $value: -$hover-padding-right); // compensate for padding added on hover &:hover { - border: 1px solid $tlv-light-gray; - background-position: 99% 12%; - background-size: 15px; - padding-right: 20px; + padding-right: $hover-padding-right; + width: 100%; + border: 1px solid $light-gray; + cursor: pointer; + + background-position: calc(100% - 4px) 4px; + background-size: 14px; background-image: url($pencil-icon); background-repeat: no-repeat; - cursor: pointer; - } - &.read-only { - border: none; + background-color: white; + + .description-data:after { + background: white; + } } - .description-data { - @include multiline-ellipsis($lineCount: 3, $bgColor: $tlv-gray); - } } .vendor-description-readonly { - @extend .flex; - @extend .body-1; - justify-content: space-between; - margin-top: 10px; - overflow: hidden; - border: none; - height: 49px; - margin-bottom: 15px; - padding: 6px; - position: relative; - left:-6px; + margin-top: 16px; } + .description-data { + @include multiline-ellipsis($lineCount: 3, $bgColor: $tlv-gray); + flex: initial; + } + .vendor-description-edit { @extend .flex; flex-direction: column; @@ -84,6 +103,7 @@ width: 101%; textarea { padding-left: 6px; + resize: vertical; } .buttons-row { @extend .flex; @@ -133,12 +153,12 @@ margin-left: 20px; justify-content: space-between; border: 1px solid $tlv-light-gray; - @include border-shadow(); + @include overview-tile-shadow(); background-color: $tlv-gray; .summary-count-item { @extend .flex; - @extend .heading-5-semibold; - padding-top: 5px; + @extend .heading-5-semibold; + align-items: center; padding-left: 45px; padding-right: 45px; border-bottom: 1px solid $tlv-light-gray; @@ -184,9 +204,10 @@ } } } - .vlm-list-tab-panel - { - @extend .flex; + .vlm-list-tab-panel { + + @extend .flex; + margin-bottom: 7px; .section-title { flex: 1; } @@ -236,81 +257,33 @@ } .vlm-list-view { .vlm-list { - .vlm-list-item { - @include border-shadow(); - .list-item-icon-col { - display: flex; - flex-direction: column; - justify-content: center; - margin-left: 5px; - } - &.vlm-list-item-la { - margin-left: 0; - .list-item-icon-col { - padding-left: 22px; + .vlm-list-item.orphan-list-item { + @include overview-tile-shadow(); + margin-left: 0; + + .vlm-list-item-title { - } - .la-icon { - background-color: $gray; - border-color: $gray; - } - .list-item-section { - &:first-child { - background-color: gray; - } - } - } - &.vlm-list-item-fg { - cursor: default; - margin-left: 0; - border-left: 10px solid $gray; - .list-item-arrow-col { - margin-left: 0px; - } - .list-item-icon-col { - padding-left: 22px; - } - .fg-icon { - background-color: $gray; - border-color: $gray; - } - } - &.vlm-list-item-ep { - margin-left: 0; - border-left: 10px solid $gray; - .list-item-icon-col { - padding-left: 22px; - } - .ep-icon { - background-color: $gray; - border-color: $gray; - } - .list-item-section { - &:first-child { - display: flex; - color: $white; - min-width: 34px; - } - } - } - &.vlm-list-item-lkg { - margin-left: 0; - border-left: 10px solid $gray; - .list-item-icon-col { - padding-left: 22px; - } - .lkg-icon { - background-color: $gray; - border-color: $gray; - } - .list-item-section { - &:first-child { - display: flex; - color: $white; - min-width: 34px; - } - } - } + .item-name { + color: $dark-gray; + } + } + .list-item-icon-col { + .overview-list-icon { + background-color: $gray; + border-color: $gray; + } + } + .list-item-section { + &:first-child { + display: flex; + color: $white; + min-width: $arrow-element-width; + } + &.list-item-icon-col { + margin-left: 65px; + margin-right: 65px - $list-item-padding; + } + } } } } @@ -328,18 +301,32 @@ @extend .flex; border: 1px solid $tlv-light-gray; margin-bottom: 0px; - cursor: pointer; - .list-item-icon-col { - display: flex; - flex-direction: column; - justify-content: center; - - } + .clickable { + cursor: pointer; + } + .list-item-section { - padding: 10px; + .count-value { + @extend .body-3; + } + &.list-item-icon-col { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 0; + margin-right: 40px - $list-item-padding; + margin-left: $icon-margin; + .overview-list-icon { + @extend .body-2; + } + } + padding: 15px; + &.list-item-arrow-col { + padding: 0; + } .children-count { @extend .body-1; - line-height: 20px; color: $gray; padding-left: 5px; .count-value { @@ -347,9 +334,18 @@ } } .additional-data { - padding-left: 50px; + padding-left: 60px; + display: flex; + flex-direction: column; + justify-content: space-between; + *:last-child { + margin-top: 20px; + } + *:only-child { + margin-top: 0; + } .additional-data-name { - @extend .body-1-semibold; + @extend .body-2-semibold; } } .additional-data-col-border { @@ -359,128 +355,140 @@ } } .list-item-additional-data-col { - @extend .body-1; + @extend .body-2; @extend .flex; - align-items: center; - flex: 0.8; + align-items: stretch; + flex: 0.8; + margin-left: 30px; + padding-top: 17px; + padding-bottom: 11px; } .arrow-icon { - align-self: center; + align-self: center; + } .vlm-item-info { flex: 1; } .vlm-list-item-title { - @extend .flex; + @extend .flex; + align-items: baseline; .item-name { @extend .heading-5-semibold; flex: 0 1 auto; - margin-bottom: 4px; + margin-bottom: 4px; + text-transform: uppercase; } } .vlm-list-item-description { @extend .body-1; - overflow: hidden; + @include multiline-ellipsis($lineCount: 3, $bgColor: $tlv-gray); max-height: 38px; } &.vlm-list-item-la { margin-top: 10px; - border-left: 10px solid $dark-blue; .la-icon { - @include create-circle($circle-icon-size,$dark-blue,'LA'); + @include create-circle($circle-icon-size,$la-color,'LA'); color: $white; - } + } + .vlm-list-item-title { + .item-name { + color: $la-color; + } + } .list-item-section { &:first-child { display: flex; - color: $dark-blue; - min-width: 34px; + color: $la-color; + min-width: $arrow-element-width; } } .list-item-arrow-col { flex: 0.01; - margin-left: 14px; - } - .list-item-icon-col { - padding-left: 14px; - padding-right: 30px; - align-items: center; + margin-left: $arrow-margin; + justify-content: center; } - } &.vlm-list-item-fg { - border-left: 10px solid $blue; - margin-left: 20px; - margin-top: 10px; + margin-left: $list-indentation; + margin-top: 10px; + .fg-pipeline-separator { + color: $dark-gray; + padding: 0 5px; + } + .list-item-icon-col { + margin-left: 29px; + } .fg-icon { - @include create-circle($circle-icon-size,$blue,'FG'); + @include create-circle($circle-icon-size,$fg-color,'FG'); color: $white; - } + } + + .vlm-list-item-title { + .item-name { + color: $fg-color; + } + } .list-item-section { &:first-child { display: flex; - color: $blue; - min-width: 34px; + color: $fg-color; + min-width: $arrow-element-width; } } .list-item-arrow-col { flex: 0.01; - margin-left: 26px; - } - .list-item-icon-col { - padding-left: 22px; - padding-right: 30px; - align-items: center; + margin-left: $arrow-margin - $list-indentation; + padding-left: $list-indentation; } } &.vlm-list-item-ep { - margin-left: 40px; + margin-left: $list-indentation * 2; margin-top: 10px; - border-left: 10px solid $light-blue; cursor: default; .ep-icon { - @include create-circle($circle-icon-size,$light-blue,'EP'); + @include create-circle($circle-icon-size,$lkg-ep-color,'EP'); color: $white; - } - .list-item-icon-col { - padding-left: 72px; - padding-right: 30px; - align-items: center; - } + } + .vlm-list-item-title { + .item-name { + color: $lkg-ep-color; + } + } .list-item-section { &:first-child { display: none; - } - } - .list-item-additional-data-col { - margin-right: 20px; + } + &.list-item-icon-col { + margin-left: 52px; + } } + } &.vlm-list-item-lkg { margin-top: 10px; - margin-left: 40px; - border-left: 10px solid $light-blue; + margin-left: $list-indentation * 2; cursor: default; .lkg-icon { - @include create-circle($circle-icon-size,$light-blue,'KG'); + @include create-circle($circle-icon-size,$lkg-ep-color,'KG'); color: $white; - } - .list-item-icon-col { - padding-left: 72px; - padding-right: 30px; - align-items: center; - } + } + .vlm-list-item-title { + .item-name { + color: $lkg-ep-color; + } + } .list-item-section { &:first-child { display: none; - } + } + &.list-item-icon-col { + margin-left: 52px; + } } - .list-item-additional-data-col { - margin-right: 20px; - } } } diff --git a/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss b/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss index 07f86aba2a..87a852f755 100644 --- a/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss +++ b/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogTile.scss @@ -48,6 +48,9 @@ align-self: baseline; color: $gray; line-height: 10px; + &:first-letter { + text-transform: capitalize; + } @include ellipsis(auto, inline-block, 178px); } @@ -56,7 +59,10 @@ @extend .heading-5-semibold; color: $black; @include ellipsis(auto, inline-block, 175px); - line-height: inherit; + line-height: inherit; + &:first-letter { + text-transform: capitalize; + } } } .catalog-tile-icon { diff --git a/openecomp-ui/resources/scss/modules/onboardingCatalog/_vendorTile.scss b/openecomp-ui/resources/scss/modules/onboardingCatalog/_vendorTile.scss index 5972bb2d67..d490fd6e1c 100644 --- a/openecomp-ui/resources/scss/modules/onboardingCatalog/_vendorTile.scss +++ b/openecomp-ui/resources/scss/modules/onboardingCatalog/_vendorTile.scss @@ -24,7 +24,10 @@ .catalog-tile-top { .catalog-tile-item-name { margin-top: 21px; - line-height: inherit; + line-height: inherit; + &:first-letter { + text-transform: capitalize; + } } .catalog-tile-vsp-count { @extend .body-3-semibold; diff --git a/openecomp-ui/resources/scss/onboarding.scss b/openecomp-ui/resources/scss/onboarding.scss index d7d4586354..b49a7cb423 100644 --- a/openecomp-ui/resources/scss/onboarding.scss +++ b/openecomp-ui/resources/scss/onboarding.scss @@ -12,53 +12,73 @@ div[data-reactroot].customized-date-picker-calendar { @import "common/variables"; @import "common/typography"; - border-radius: 2px; border-color: $light-gray; margin-top: -8px; + color: $black; .react-datepicker__triangle { margin-top: 0px; } .react-datepicker__navigation--previous { - border: none; - width: 15px; - height: 15px; + border: none; + width: 12px; + height: 12px; margin-top: 2px; - content: url(../images/angle-left.svg); + content: url(../images/angle-left.svg); } .react-datepicker__navigation--next { - border: none; - width: 15px; - height: 15px; - margin-top: 2px; - content: url(../images/angle-right.svg); + border: none; + width: 12px; + height: 12px; + margin-top: 2px; + content: url(../images/angle-right.svg); } - .react-datepicker__month-container { + .react-datepicker__month-container { .react-datepicker__header { background-color: $background-gray; border-bottom: none; .react-datepicker__current-month { - @extend .heading-5; + @extend .body-1-semibold; background-color: $background-gray; - margin-bottom: 10px; + margin-bottom: 10px; } .react-datepicker__day-names { - @extend .heading-5; + @extend .body-1; background-color: $white; } } - .react-datepicker__day--selected { - @extend .heading-5; - border-radius: 20px; + .react-datepicker__day--selected, .react-datepicker__day--keyboard-selected { + @extend .body-1; background-color: $blue; - &:hover { - background-color: $dark-blue; - } + color: $white; } .react-datepicker__day { - @extend .heading-5; - &:hover { - border-radius: 20px; - } + border-radius: 0px; + margin: 0; + flex: 1; + @extend .body-1; + } + + .react-datepicker__day--in-range, .react-datepicker__day--in-selecting-range { + background-color: $tlv-hover; + color: $black; + &.react-datepicker__day--selected, &.react-datepicker__day--keyboard-selected, &.react-datepicker__day--range-start, &.react-datepicker__day--range-end { + background-color: $blue; + color: $white; + } + &.react-datepicker__day--selecting-range-start, &.react-datepicker__day--selecting-range-end { + background-color: lighten($blue, 40%); + color: $black; + } + &.react-datepicker__day--selecting-range-start.react-datepicker__day--range-start, + &.react-datepicker__day--selecting-range-end.react-datepicker__day--range-end, + &.react-datepicker__day--selecting-range-start.react-datepicker__day--keyboard-selected { + background-color: $blue; + color: $white; + } + } + + .react-datepicker__week { + display: flex; } } } @@ -69,7 +89,7 @@ div[data-reactroot].tooltip { @import "common/typography"; &.in { - opacity: 1; + opacity: 1; } &.validation-error-message { &.bottom { @@ -94,28 +114,33 @@ div[data-reactroot].tooltip { } } &.bottom { - .tooltip-arrow { - border-bottom-color: $dark-gray !important; - } + .tooltip-arrow { + border-bottom-color: $dark-gray !important; + } } &.top { - .tooltip-arrow { - border-top-color: $dark-gray !important; - } + .tooltip-arrow { + border-top-color: $dark-gray !important; + } } .tooltip-inner { - max-width: 100%; - background-color: $dark-gray; + @extend .body-1; + max-width: 100%; + background-color: $dark-gray; + padding: 6px 9px; + &:first-letter { + text-transform: capitalize; + } } // activity log tooltip &.activity-log-message-tooltip { - @include base-font-regular; - font-size: $body-font-2; - .message-block { - text-align: left; - padding: 3px 12px; - } + @include base-font-regular; + font-size: $body-font-2; + .message-block { + text-align: left; + padding: 3px 12px; + } } //dependency table error tooltip &.select-action-table-error-tooltip{ @@ -136,4 +161,11 @@ div[data-reactroot].tooltip { font-size: $body-font-2; } } + + // for read-only mode, vendor description in VLM overview + &.vendor-description-tooltip { + .tooltip-inner { + max-width: 600px; + } + } } diff --git a/openecomp-ui/runLocalFE.cmd b/openecomp-ui/runLocalFE.cmd deleted file mode 100644 index ee718f2a0b..0000000000 --- a/openecomp-ui/runLocalFE.cmd +++ /dev/null @@ -1,38 +0,0 @@ -@REM /*! -@REM * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -@REM * -@REM * Licensed under the Apache License, Version 2.0 (the "License"); -@REM * you may not use this file except in compliance with the License. -@REM * You may obtain a copy of the License at -@REM * -@REM * http://www.apache.org/licenses/LICENSE-2.0 -@REM * -@REM * Unless required by applicable law or agreed to in writing, software -@REM * distributed under the License is distributed on an "AS IS" BASIS, -@REM * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -@REM * or implied. See the License for the specific language governing -@REM * permissions and limitations under the License. -@REM */ - -@echo off - -SETLOCAL - -set uiDir=%cd% -set currentDir=%cd% -if not ("%1" == "") set uiDir=%1 - -echo check npm version: -call npm -version -if errorlevel 1 ( - echo install node with npm from https://nodejs.org/en/download/ - goto done -) -echo npm is installed -echo one more check... -call npm list prompt -if errorlevel 1 ( - npm install prompt -) -echo ready to run -call node runLocalFE.js diff --git a/openecomp-ui/runLocalFE.js b/openecomp-ui/runLocalFE.js deleted file mode 100644 index 1205aa48f9..0000000000 --- a/openecomp-ui/runLocalFE.js +++ /dev/null @@ -1,104 +0,0 @@ -/*! - * 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. - */ - -var exec = require('child_process'); -var prompt = require('prompt'); -var fs = require('fs'); - - -function runNpm(target, dir) { - console.log('\n---> npm ' + target); - let options = {stdio:[0,1,2]}; - if (dir) options.cwd = dir; - exec.execSync("npm " + target,options); -} - -function npmInstallAll() { - setNpmconfig(); - if (!fs.existsSync('../dox-sequence-diagram-ui/node_modules')) { - console.log('--> first time installing dox-sequence-diagram-ui'); - runNpm('install', '../dox-sequence-diagram-ui'); - }; - runNpm('install'); - // just to make sure restful js is installed properly - runNpm('install jquery', 'node_modules/restful-js'); -} - -function getDevConfig() { - var content=fs.readFileSync('./devConfig.json'); - var data=JSON.parse(content); - console.log('Current ATT server is set to: ' + data.proxyATTTarget); - if (!data.proxyTarget) { - console.log('Current onboarding server defaults to the ATT server'); - } else { - console.log('Current onboarding server set to: ' + data.proxyTarget); - } - return data; -} - -function setNpmconfig() { - exec.execSync("npm config set proxy http://genproxy.amdocs.com:8080"); - exec.execSync("npm config set https_proxy http://genproxy.amdocs.com:8080"); -} - -// getting the run details before starting to work -prompt.start(); -prompt.get([{ - name:'runType', - type:'number', - default:1, - description: 'Choose run: 1-test and build, 2- run frontend server ' - }], function (err, result) { - if (result.runType === 2) { - console.log('--> Reading the configuration for the local server'); - if (!fs.existsSync('./devConfig.json')) { - console.log('First time - setting up the devConfig.json file'); - fs.writeFileSync('./devConfig.json', fs.readFileSync('./devConfig.defaults.json')); - } - let data = getDevConfig(); - let attProxyField = { - name:'attProxyTarget', - description:'ATT server' - }; - let proxyField = { - name:'proxyTarget', - description:'onboarding server, \'null\' to reset' - }; - if (data.proxyATTTarget) attProxyField.default = data.proxyATTTarget; - if (data.proxyTarget) proxyField.default = data.proxyTarget; - prompt.get([ attProxyField, proxyField], function (err,result) { - data.proxyATTTarget = result.attProxyTarget; - if(result.proxyTarget) { - if (result.proxyTarget === 'null') { - if (data.proxyTarget) delete data.proxyTarget; - } else { - data.proxyTarget = result.proxyTarget; - } - } - fs.writeFileSync('./devConfig.json', JSON.stringify(data, null, 2)); - getDevConfig(); - console.log('FE server will be answering on: http://localhost:9000/sdc1/proxy-designer1#/onboardVendor'); - npmInstallAll(); - runNpm("start"); - } - ); - } else { - npmInstallAll(); - runNpm("run build"); - runNpm("run test"); - } -}); - diff --git a/openecomp-ui/src/index.html b/openecomp-ui/src/index.html index d4fab4dcb2..6a9265c984 100644 --- a/openecomp-ui/src/index.html +++ b/openecomp-ui/src/index.html @@ -11,4 +11,4 @@ -npm + diff --git a/openecomp-ui/src/nfvo-components/datepicker/Datepicker.jsx b/openecomp-ui/src/nfvo-components/datepicker/Datepicker.jsx index cd39376bda..f4673c1c93 100644 --- a/openecomp-ui/src/nfvo-components/datepicker/Datepicker.jsx +++ b/openecomp-ui/src/nfvo-components/datepicker/Datepicker.jsx @@ -17,10 +17,10 @@ class CustomInput extends React.Component { const text = date ? date : placeholderText; const textStyle = date ? '' : 'placeholder'; return ( -
-
{text}
-
- +
+
{text}
+ {date && {e.stopPropagation(); onClear();}} name='close' className='clear-input'/>} +
); } diff --git a/openecomp-ui/src/nfvo-components/input/validation/InputOptions.jsx b/openecomp-ui/src/nfvo-components/input/validation/InputOptions.jsx index 6e54254eb0..9b11d27c2b 100644 --- a/openecomp-ui/src/nfvo-components/input/validation/InputOptions.jsx +++ b/openecomp-ui/src/nfvo-components/input/validation/InputOptions.jsx @@ -64,7 +64,8 @@ class InputOptions extends React.Component { const dataTestId = this.props['data-test-id'] ? {'data-test-id': this.props['data-test-id']} : {}; let currentMultiSelectedEnum = []; let currentSelectedEnum = ''; - let {otherInputDisabled} = this.state; + let otherInputDisabled = (isMultiSelect && (multiSelectedEnum === undefined || multiSelectedEnum.length === 0 || multiSelectedEnum[0] !== other.OTHER)) + || (!isMultiSelect && (selectedEnum === undefined || selectedEnum !== other.OTHER)); if (isMultiSelect) { currentMultiSelectedEnum = multiSelectedEnum; if(!otherInputDisabled) { diff --git a/openecomp-ui/src/nfvo-components/input/validation/Tabs.jsx b/openecomp-ui/src/nfvo-components/input/validation/Tabs.jsx index 95144b1468..6f33536b04 100644 --- a/openecomp-ui/src/nfvo-components/input/validation/Tabs.jsx +++ b/openecomp-ui/src/nfvo-components/input/validation/Tabs.jsx @@ -15,7 +15,7 @@ */ import React from 'react'; import ReactDOM from 'react-dom'; -import {default as BTabs} from 'react-bootstrap/lib/Tabs.js'; +import {default as SDCTabs} from 'sdc-ui/lib/react/Tabs.js'; import Overlay from 'react-bootstrap/lib/Overlay.js'; import Tooltip from 'react-bootstrap/lib/Tooltip.js'; @@ -33,15 +33,15 @@ class Tabs extends React.Component { return React.cloneElement( element, { - key: element.props.eventKey, - tabClassName: invalidTabs.indexOf(element.props.eventKey) > -1 ? 'invalid-tab' : 'valid-tab' + key: element.props.tabId, + className: invalidTabs.indexOf(element.props.tabId) > -1 ? 'invalid-tab' : 'valid-tab' } ); } showTabsError() { const {invalidTabs} = this.props; - const showError = ((invalidTabs.length === 1 && invalidTabs[0] !== this.props.activeKey) || (invalidTabs.length > 1)); + const showError = ((invalidTabs.length === 1 && invalidTabs[0] !== this.props.activeTab) || (invalidTabs.length > 1)); return showError; } @@ -50,21 +50,20 @@ class Tabs extends React.Component { let {invalidTabs, ...tabProps} = this.props; return (
- + {this.props.children.map(element => this.cloneTab(element))} - + { - let target = ReactDOM.findDOMNode(this.refs.tabsList).querySelector('ul > li.invalid-tab:not(.active):nth-of-type(n)'); + let target = ReactDOM.findDOMNode(this.refs.tabsList).querySelector('ul > li.invalid-tab:not(.sdc-tab-active):nth-of-type(n)'); return target && target.offsetParent ? target : undefined; } } container={() => { - let target = ReactDOM.findDOMNode(this.refs.tabsList).querySelector('ul > li.invalid-tab:not(.active):nth-of-type(n)'); + let target = ReactDOM.findDOMNode(this.refs.tabsList).querySelector('ul > li.invalid-tab:not(.sdc-tab-active):nth-of-type(n)'); return target && target.offsetParent ? target.offsetParent : this; }}> {(onEdit || onDelete) &&
{onEdit && this.onClickedItem(onEdit)}/>} - {onDelete && isAbilityToDelete && this.onClickedItem(onDelete)}/>} + {onDelete && isAbilityToDelete && this.onClickedItem(onDelete)}/>}
}
); diff --git a/openecomp-ui/src/nfvo-components/panel/versionController/VersionControllerConstants.js b/openecomp-ui/src/nfvo-components/panel/versionController/VersionControllerConstants.js index 9af142433c..c2548e4fb4 100644 --- a/openecomp-ui/src/nfvo-components/panel/versionController/VersionControllerConstants.js +++ b/openecomp-ui/src/nfvo-components/panel/versionController/VersionControllerConstants.js @@ -33,7 +33,7 @@ export const statusEnum = keyMirror({ export const statusBarTextMap = keyMirror({ 'Locked': 'Checked Out', - 'LockedByUser': '', + 'LockedByUser': 'Locked', 'Available': 'Checked In', 'Final': 'Submitted', 'READ ONLY': 'Locked' diff --git a/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx b/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx index 6c04ad74fd..12e9a06623 100644 --- a/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx +++ b/openecomp-ui/src/nfvo-components/table/SelectActionTable.jsx @@ -16,7 +16,7 @@ export default class SelectActionTable extends React.Component {
{columns.map(column =>
{i18n(column)}
)} - {Array(numOfIcons).fill().map(() => )} + {Array(numOfIcons).fill().map((e, i) => )}
{children} diff --git a/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx b/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx index a711b42918..7df7d532e8 100644 --- a/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx +++ b/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx @@ -27,12 +27,12 @@ function renderErrorOrCheck({hasError, overlayMsg}) { return ; } -const SelectActionTableRow = ({children, onDelete, hasError, hasErrorIndication, overlayMsg}) => ( +const SelectActionTableRow = ({children, onDelete, hasError, hasErrorIndication, overlayMsg, showDelete}) => (
{children}
- {onDelete && } + {onDelete && } {hasErrorIndication && renderErrorOrCheck({hasError, overlayMsg})}
); diff --git a/openecomp-ui/src/nfvo-utils/Validator.js b/openecomp-ui/src/nfvo-utils/Validator.js index 8fcf24a714..1df82a2ada 100644 --- a/openecomp-ui/src/nfvo-utils/Validator.js +++ b/openecomp-ui/src/nfvo-utils/Validator.js @@ -20,7 +20,9 @@ import i18n from 'nfvo-utils/i18n/i18n.js'; class Validator { static get globalValidationFunctions() { return { - required: value => value !== '', + required: value => { + return typeof value === 'string' ? value.replace(/\s+/g, '') !== '' : value !== ''; + }, requiredChooseOption: value => value !== '', maxLength: (value, length) => ValidatorJS.isLength(value, {max: length}), minLength: (value, length) => ValidatorJS.isLength(value, {min: length}), @@ -107,6 +109,7 @@ class Validator { } static isItemNameAlreadyExistsInList({itemId, itemName, list}) { + itemName = itemName.toLowerCase(); return list[itemName] && list[itemName] !== itemId; } } diff --git a/openecomp-ui/src/nfvo-utils/getValue.js b/openecomp-ui/src/nfvo-utils/getValue.js new file mode 100644 index 0000000000..e6871c094d --- /dev/null +++ b/openecomp-ui/src/nfvo-utils/getValue.js @@ -0,0 +1,32 @@ +/*! + * 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 {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; + +function getValueFromObject(element) { + return element.choices && element.choices.length > 0 && element.choices[0] !== '' && element.choices[0] !== optionInputOther.OTHER || + element.other && element.choices[0] === optionInputOther.OTHER ? + element : undefined; +} + +function getValueFromVariable(variable) { + return variable ? variable : undefined; +} + + let getValue = element => { + return typeof element === 'object' ? getValueFromObject(element) : getValueFromVariable(element); + }; + + export default getValue; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js b/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js index 0bbb5e63be..2276984f7a 100644 --- a/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js +++ b/openecomp-ui/src/sdc-app/common/reducers/PlainDataReducer.js @@ -16,6 +16,7 @@ import {actionTypes} from './PlainDataReducerConstants.js'; import Validator from 'nfvo-utils/Validator.js'; import forOwn from 'lodash/forOwn.js'; +import {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; function updateDataAndValidateReducer(state = {}, action) { let genericFieldInfoCopy; @@ -46,6 +47,12 @@ function updateDataAndValidateReducer(state = {}, action) { forOwn(state.genericFieldInfo,(value, key) => { let val = state.data && state.data[key] ? state.data[key] : ''; let result = Validator.validate(key, val, state.genericFieldInfo[key].validations, state, {}); + if(val.choice !== undefined) { + result = Validator.validate(key, val.choice, state.genericFieldInfo[key].validations, state, {}); + } + if(val.choice !== undefined && val.choice === optionInputOther.OTHER) { + result = Validator.validate(key, val.other, state.genericFieldInfo[key].validations, state, {}); + } genericFieldInfoCopy[key] = {...genericFieldInfoCopy[key], isValid: result.isValid, errorText: result.errorText}; if (!result.isValid) { formReady = false; diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js index 2b59361eef..dad930127b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js @@ -31,8 +31,7 @@ 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, - onboardingMethod as onboardingMethodTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; +import {navigationItems as SoftwareProductNavigationItems, actionTypes as SoftwareProductActionTypes} 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'; @@ -164,18 +163,10 @@ export default { const newVersion = response[0].version ? response[0].version : version; SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion}); - let isFetchImageDetails = (response[0].onboardingMethod === onboardingMethodTypes.HEAT); - if (isFetchImageDetails) { - // will only continue after we can properly build the navigation bar with the images links - SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version: newVersion, isFetchImageDetails}).then(() => { - SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: newVersion}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version: newVersion}); - }); - } else { - SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version: newVersion, isFetchImageDetails}); - SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: newVersion}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version: newVersion}); - } + + SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version: newVersion}); + SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: newVersion}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version: newVersion}); }); }, diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx index 1f0bef7a9f..aea5fc6406 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx @@ -415,9 +415,9 @@ export default class OnboardingPunchOut { handleStoreChange() { let {currentScreen, licenseModelList, softwareProductList, softwareProduct: {softwareProductEditor: {data = {onboardingMethod: ''}}, - softwareProductComponents: {componentsList, images: {imagesNavigationList}}, softwareProductAttachments: {heatSetup}}} = store.getState(); + softwareProductComponents: {componentsList}, softwareProductAttachments: {heatSetup}}} = store.getState(); let {onboardingMethod} = data; - let breadcrumbsData = {onboardingMethod, currentScreen, licenseModelList, softwareProductList, componentsList, heatSetup, imagesNavigationList}; + let breadcrumbsData = {onboardingMethod, currentScreen, licenseModelList, softwareProductList, componentsList, heatSetup}; if (currentScreen.forceBreadCrumbsUpdate || !isEqual(breadcrumbsData, this.prevBreadcrumbsData) || this.breadcrumbsPrefixSelected) { this.prevBreadcrumbsData = breadcrumbsData; this.breadcrumbsPrefixSelected = false; @@ -434,7 +434,7 @@ export default class OnboardingPunchOut { } } - buildBreadcrumbs({currentScreen: {screen, props}, onboardingMethod, licenseModelList, softwareProductList, componentsList, heatSetup, imagesNavigationList}) { + buildBreadcrumbs({currentScreen: {screen, props}, onboardingMethod, licenseModelList, softwareProductList, componentsList, heatSetup}) { let screenToBreadcrumb; switch (screen) { case enums.SCREEN.ONBOARDING_CATALOG: @@ -646,15 +646,7 @@ export default class OnboardingPunchOut { }, { key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_MONITORING, displayText: i18n('Monitoring') - }].filter(item => { - switch (item.key) { - case enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_IMAGES: - return (onboardingMethod === onboardingMethodTypes.MANUAL || - (imagesNavigationList && imagesNavigationList[props.componentId] === true)); - default: - return true; - } - }) + }] }] ]; } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js index 4ba10c3a68..960090c2d8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js @@ -14,6 +14,7 @@ * permissions and limitations under the License. */ import keyMirror from 'nfvo-utils/KeyMirror.js'; +import i18n from 'nfvo-utils/i18n/i18n.js'; export const actionTypes = keyMirror({ LICENSE_MODEL_LOADED: null, @@ -31,3 +32,16 @@ export const navigationItems = keyMirror({ LICENSE_KEY_GROUPS: 'license-key-groups', ACTIVITY_LOG: 'activity-log' }); + +export const thresholdUnitType = { + ABSOLUTE: 'Absolute', + PERCENTAGE: 'Percentage' +}; + +export const optionsInputValues = { + THRESHOLD_UNITS: [ + {enum: '', title: i18n('please select…')}, + {enum: thresholdUnitType.ABSOLUTE, title: 'Absolute'}, + {enum: thresholdUnitType.PERCENTAGE, title: '%'} + ] +}; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js index bd060a4c28..80beda22b5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js @@ -35,6 +35,7 @@ import licenseKeyGroupsListReducer from './licenseKeyGroups/LicenseKeyGroupsList import {createPlainDataReducer} from 'sdc-app/common/reducers/PlainDataReducer.js'; import {actionTypes as licenseModelOverviewConstants, selectedButton, VLM_DESCRIPTION_FORM} from './overview/LicenseModelOverviewConstants.js'; +import limitEditorReducer from './limits/LimitEditorReducer.js'; export default combineReducers({ licenseModelCreation: createPlainDataReducer(licenseModelCreationReducer), @@ -81,5 +82,6 @@ export default combineReducers({ } } )}), + limitEditor: createPlainDataReducer(limitEditorReducer), activityLog: activityLogReducer }); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelValidations.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelValidations.js new file mode 100644 index 0000000000..64bae3b6a0 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelValidations.js @@ -0,0 +1,41 @@ +/*! + * 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 i18n from 'nfvo-utils/i18n/i18n.js'; +import {thresholdUnitType} from './LicenseModelConstants.js'; +import Validator from 'nfvo-utils/Validator.js'; + +export function validateStartDate(value, state) { + if (state.data.expiryDate) { + if (!value) { + return {isValid: false, errorText: i18n('Start date has to be specified if expiry date is specified')}; + } + } + return {isValid: true, errorText: ''}; +} + +export function thresholdValueValidation(value, state) { + let unit = state.data.thresholdUnits; + if (unit === thresholdUnitType.PERCENTAGE) { + return Validator.validate('thresholdValue', value, [ + {type: 'numeric', data: true}, + {type: 'maximum', data: 100}, + {type: 'minimum', data: 0}]); + } else { + return Validator.validate('thresholdValue', value, [ + {type: 'numeric', data: true}, + ]); + } +} diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js index d85618c85f..39b3c15c6a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js @@ -26,7 +26,7 @@ export const mapStateToProps = ({licenseModelList, licenseModel: {licenseModelCr let VLMNames = {}; for (let i = 0; i < licenseModelList.length; i++) { - VLMNames[licenseModelList[i].vendorName] = licenseModelList[i].id; + VLMNames[licenseModelList[i].vendorName.toLowerCase()] = licenseModelList[i].id; } return {...licenseModelCreation, isFormValid: isFormValid, VLMNames}; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js index a7c95f608d..a371d5635e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js @@ -17,6 +17,8 @@ import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js'; import Configuration from 'sdc-app/config/Configuration.js'; import {actionTypes as entitlementPoolsActionTypes } from './EntitlementPoolsConstants.js'; import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js'; +import {actionTypes as limitEditorActions} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js'; +import getValue from 'nfvo-utils/getValue.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -28,18 +30,16 @@ function fetchEntitlementPoolsList(licenseModelId, version) { return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}`); } -function postEntitlementPool(licenseModelId, entitlementPool, version) { +function postEntitlementPool(licenseModelId, entitlementPool, version) { return RestAPIUtil.post(baseUrl(licenseModelId, version), { name: entitlementPool.name, description: entitlementPool.description, thresholdValue: entitlementPool.thresholdValue, - thresholdUnits: entitlementPool.thresholdUnits, + thresholdUnits: getValue(entitlementPool.thresholdUnits), entitlementMetric: entitlementPool.entitlementMetric, increments: entitlementPool.increments, - aggregationFunction: entitlementPool.aggregationFunction, - operationalScope: entitlementPool.operationalScope, + operationalScope: getValue(entitlementPool.operationalScope), time: entitlementPool.time, - manufacturerReferenceNumber: entitlementPool.manufacturerReferenceNumber, startDate: entitlementPool.startDate, expiryDate: entitlementPool.expiryDate }); @@ -47,17 +47,16 @@ function postEntitlementPool(licenseModelId, entitlementPool, version) { function putEntitlementPool(licenseModelId, previousEntitlementPool, entitlementPool, version) { + return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${entitlementPool.id}`, { name: entitlementPool.name, description: entitlementPool.description, thresholdValue: entitlementPool.thresholdValue, - thresholdUnits: entitlementPool.thresholdUnits, + thresholdUnits: getValue(entitlementPool.thresholdUnits), entitlementMetric: entitlementPool.entitlementMetric, increments: entitlementPool.increments, - aggregationFunction: entitlementPool.aggregationFunction, - operationalScope: entitlementPool.operationalScope, + operationalScope: getValue(entitlementPool.operationalScope), time: entitlementPool.time, - manufacturerReferenceNumber: entitlementPool.manufacturerReferenceNumber, startDate: entitlementPool.startDate, expiryDate: entitlementPool.expiryDate }); @@ -67,8 +66,43 @@ function deleteEntitlementPool(licenseModelId, entitlementPoolId, version) { return RestAPIUtil.destroy(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}`); } +function fetchLimitsList(licenseModelId, entitlementPoolId, version) { + return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits`); +} + +function deleteLimit(licenseModelId, entitlementPoolId, version, limitId) { + return RestAPIUtil.destroy(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits/${limitId}`); +} + +function postLimit(licenseModelId, entitlementPoolId, version, limit) { + return RestAPIUtil.post(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits`, { + name: limit.name, + type: limit.type, + description: limit.description, + metric: limit.metric, + value: limit.value, + unit: limit.unit, + aggregationFunction: getValue(limit.aggregationFunction), + time: getValue(limit.time) + }); +} + +function putLimit(licenseModelId, entitlementPoolId, version, limit) { + + return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${entitlementPoolId}/limits/${limit.id}`, { + name: limit.name, + type: limit.type, + description: limit.description, + metric: limit.metric, + value: limit.value, + unit: limit.unit, + aggregationFunction: getValue(limit.aggregationFunction), + time: getValue(limit.time) + }); +} export default { + fetchEntitlementPoolsList(dispatch, {licenseModelId, version}) { return fetchEntitlementPoolsList(licenseModelId, version).then(response => dispatch({ type: entitlementPoolsActionTypes.ENTITLEMENT_POOLS_LIST_LOADED, @@ -76,7 +110,10 @@ export default { })); }, - openEntitlementPoolsEditor(dispatch, {entitlementPool} = {}) { + openEntitlementPoolsEditor(dispatch, {entitlementPool, licenseModelId, version} = {}) { + if (licenseModelId && version) { + this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); + } dispatch({ type: entitlementPoolsActionTypes.entitlementPoolsEditor.OPEN, entitlementPool @@ -145,5 +182,32 @@ export default { LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => { this.fetchEntitlementPoolsList(dispatch, {licenseModelId, version}); }); + }, + + + fetchLimits(dispatch, {licenseModelId, version, entitlementPool}) { + return fetchLimitsList(licenseModelId, entitlementPool.id, version). then (response => { + dispatch({ + type: entitlementPoolsActionTypes.entitlementPoolsEditor.LIMITS_LIST_LOADED, + response + }); + }); + }, + + submitLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { + const propmise = limit.id ? putLimit(licenseModelId,entitlementPool.id, version, limit) + : postLimit(licenseModelId,entitlementPool.id, version, limit); + return propmise.then(() => { + dispatch({ + type: limitEditorActions.CLOSE + }); + this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); + }); + }, + + deleteLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { + return deleteLimit(licenseModelId,entitlementPool.id, version, limit.id).then(() => { + this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); + }); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsConstants.js index 761614dfeb..de2a87ceaf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsConstants.js @@ -15,7 +15,7 @@ */ import keyMirror from 'nfvo-utils/KeyMirror.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions, {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; export const actionTypes = keyMirror({ @@ -28,6 +28,7 @@ export const actionTypes = keyMirror({ OPEN: null, CLOSE: null, DATA_CHANGED: null, + LIMITS_LIST_LOADED: null } }); @@ -94,11 +95,6 @@ export const optionsInputValues = { {enum: 'Units_TB', title: 'Units-TB'}, {enum: 'Units_GB', title: 'Units-GB'}, {enum: 'Units_MB', title: 'Units-MB'} - ], - THRESHOLD_UNITS: [ - {enum: '', title: i18n('please select…')}, - {enum: thresholdUnitType.ABSOLUTE, title: 'Absolute'}, - {enum: thresholdUnitType.PERCENTAGE, title: '%'} ] }; @@ -112,6 +108,11 @@ export const extractUnits = (units) => { return units === 'Absolute' ? '' : '%'; }; -export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL'; +export const tabIds = { + GENERAL: 'GENERAL', + SP_LIMITS: 'SP_LIMITS', + VENDOR_LIMITS: 'VENDOR_LIMITS', + ADD_LIMIT_BUTTON: 'ADD_LIMIT_BUTTON' +}; -export const EP_TIME_FORMAT = 'MM/DD/YYYY'; +export const SP_ENTITLEMENT_POOL_FORM = 'SPENTITLEMENTPOOL'; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditor.js index f89cf8fbb5..23c260f793 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditor.js @@ -18,10 +18,12 @@ import EntitlementPoolsActionHelper from './EntitlementPoolsActionHelper.js'; import EntitlementPoolsEditorView from './EntitlementPoolsEditorView.jsx'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; +import LimitEditorActionHelper from '../limits/LimitEditorActionHelper.js'; + const mapStateToProps = ({licenseModel: {entitlementPool}}) => { - let {data, genericFieldInfo, formReady} = entitlementPool.entitlementPoolEditor; + let {data, genericFieldInfo, formReady, limitsList} = entitlementPool.entitlementPoolEditor; let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); @@ -33,7 +35,7 @@ const mapStateToProps = ({licenseModel: {entitlementPool}}) => { const list = entitlementPool.entitlementPoolsList; for (let i = 0; i < list.length; i++) { - EPNames[list[i].name] = list[i].id; + EPNames[list[i].name.toLowerCase()] = list[i].id; } return { @@ -42,7 +44,8 @@ const mapStateToProps = ({licenseModel: {entitlementPool}}) => { previousData, isFormValid, formReady, - EPNames + EPNames, + limitsList }; }; @@ -50,11 +53,13 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => { return { onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}), onCancel: () => EntitlementPoolsActionHelper.closeEntitlementPoolsEditor(dispatch), - onSubmit: ({previousEntitlementPool, entitlementPool}) => { - EntitlementPoolsActionHelper.closeEntitlementPoolsEditor(dispatch); + onSubmit: ({previousEntitlementPool, entitlementPool, keepOpen}) => { + if (!keepOpen) {EntitlementPoolsActionHelper.closeEntitlementPoolsEditor(dispatch);} EntitlementPoolsActionHelper.saveEntitlementPool(dispatch, {licenseModelId, previousEntitlementPool, entitlementPool, version}); }, - onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName) + onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName), + onCloseLimitEditor: () => LimitEditorActionHelper.closeLimitsEditor(dispatch), + onOpenLimitEditor: (limit) => LimitEditorActionHelper.openLimitsEditor(dispatch, {limit}) }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js index bc9549765f..be100f6802 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js @@ -41,12 +41,7 @@ export default (state = {}, action) => { 'description' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}] - }, - 'manufacturerReferenceNumber' : { - isValid: true, - errorText: '', - validations: [{type: 'required', data: true}, {type: 'maxLength', data: 100}] + validations: [{type: 'maxLength', data: 1000}] }, 'increments' : { isValid: true, @@ -56,33 +51,18 @@ export default (state = {}, action) => { 'operationalScope' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}] + validations: [] }, 'thresholdUnits' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}] + validations: [] }, 'thresholdValue' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}] - }, - 'entitlementMetric' : { - isValid: true, - errorText: '', - validations: [{type: 'required', data: true}] - }, - 'aggregationFunction' : { - isValid: true, - errorText: '', - validations: [{type: 'required', data: true}] - }, - 'time' : { - isValid: true, - errorText: '', - validations: [{type: 'required', data: true}] - }, + validations: [] + }, 'startDate': { isValid: true, errorText: '', @@ -106,6 +86,12 @@ export default (state = {}, action) => { }; case actionTypes.entitlementPoolsEditor.CLOSE: return {}; + + case actionTypes.entitlementPoolsEditor.LIMITS_LIST_LOADED: + return { + ...state, + limitsList: action.response.results + }; default: return state; } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx index e4b52fc439..aa1321c24a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx @@ -21,41 +21,39 @@ import Validator from 'nfvo-utils/Validator.js'; import Input from 'nfvo-components/input/validation/Input.jsx'; import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; import Form from 'nfvo-components/input/validation/Form.jsx'; +import Button from 'sdc-ui/lib/react/Button.js'; import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; -import {optionsInputValues as EntitlementPoolsOptionsInputValues, thresholdUnitType, SP_ENTITLEMENT_POOL_FORM, EP_TIME_FORMAT} from './EntitlementPoolsConstants.js'; -import {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import {optionsInputValues as EntitlementPoolsOptionsInputValues, SP_ENTITLEMENT_POOL_FORM, tabIds} from './EntitlementPoolsConstants.js'; +import {optionsInputValues as LicenseModelOptionsInputValues} from '../LicenseModelConstants.js'; +import {validateStartDate, thresholdValueValidation} from '../LicenseModelValidations.js'; +import {DATE_FORMAT} from 'sdc-app/onboarding/OnboardingConstants.js'; +import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; +import Tabs from 'sdc-ui/lib/react/Tabs.js'; +import Tab from 'sdc-ui/lib/react/Tab.js'; +import EntitlementPoolsLimits from './EntitlementPoolsLimits.js'; +import {limitType, NEW_LIMIT_TEMP_ID} from '../limits/LimitEditorConstants.js'; const EntitlementPoolPropType = React.PropTypes.shape({ id: React.PropTypes.string, name: React.PropTypes.string, description: React.PropTypes.string, - manufacturerReferenceNumber: React.PropTypes.string, operationalScope: React.PropTypes.shape({ choices: React.PropTypes.array, other: React.PropTypes.string }), - aggregationFunction: React.PropTypes.shape({ - choice: React.PropTypes.string, - other: React.PropTypes.string - }), + thresholdUnits: React.PropTypes.string, + thresholdValue: React.PropTypes.number, increments: React.PropTypes.string, - time: React.PropTypes.shape({ - choice: React.PropTypes.string, - other: React.PropTypes.string - }), - entitlementMetric: React.PropTypes.shape({ - choice: React.PropTypes.string, - other: React.PropTypes.string - }) + startDate: React.PropTypes.string, + expiryDate: React.PropTypes.string }); -const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, validateName, validateChoiceWithOther, validateTimeOtherValue, +const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, validateName, thresholdValueValidation, validateStartDate}) => { - let { - name, description, manufacturerReferenceNumber, operationalScope , aggregationFunction, thresholdUnits, thresholdValue, - increments, time, entitlementMetric, startDate, expiryDate} = data; + let {name, description, operationalScope, thresholdUnits, thresholdValue, + increments, startDate, expiryDate} = data; return ( @@ -73,12 +71,10 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val {}} isMultiSelect={true} - - isRequired={true} onEnumChange={operationalScope => onDataChanged({operationalScope:{choices: operationalScope, other: ''}}, - SP_ENTITLEMENT_POOL_FORM, {operationalScope: validateChoiceWithOther})} + SP_ENTITLEMENT_POOL_FORM)} onOtherChange={operationalScope => onDataChanged({operationalScope:{choices: [optionInputOther.OTHER], - other: operationalScope}}, SP_ENTITLEMENT_POOL_FORM, {operationalScope: validateChoiceWithOther})} + other: operationalScope}}, SP_ENTITLEMENT_POOL_FORM)} label={i18n('Operational Scope')} data-test-id='create-ep-operational-scope' type='select' @@ -95,21 +91,21 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val errorText={genericFieldInfo.description.errorText} label={i18n('Description')} value={description} - isRequired={true} data-test-id='create-ep-description' type='textarea'/>
{ // setting the unit to the correct value const selectedIndex = e.target.selectedIndex; const val = e.target.options[selectedIndex].value; onDataChanged({thresholdUnits: val}, SP_ENTITLEMENT_POOL_FORM); // TODO make sure that the value is valid too - onDataChanged({thresholdValue: thresholdValue}, SP_ENTITLEMENT_POOL_FORM,{thresholdValue : thresholdValueValidation});} + if(thresholdValue && thresholdValue !== '') { + onDataChanged({thresholdValue: thresholdValue}, SP_ENTITLEMENT_POOL_FORM,{thresholdValue : thresholdValueValidation}); + }} } value={thresholdUnits} @@ -120,7 +116,7 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val groupClassName='bootstrap-input-options' className='input-options-select' type='select' > - {EntitlementPoolsOptionsInputValues.THRESHOLD_UNITS.map(mtype => + {LicenseModelOptionsInputValues.THRESHOLD_UNITS.map(mtype => )} @@ -133,116 +129,46 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val errorText={genericFieldInfo.thresholdValue.errorText} data-test-id='create-ep-threshold-value' value={thresholdValue} - isRequired={true} type='text'/>
- {}} - isMultiSelect={false} - isRequired={true} - onEnumChange={entitlementMetric => onDataChanged({entitlementMetric:{choice: entitlementMetric, other: ''}}, - SP_ENTITLEMENT_POOL_FORM, {entitlementMetric: validateChoiceWithOther})} - onOtherChange={entitlementMetric => onDataChanged({entitlementMetric:{choice: optionInputOther.OTHER, - other: entitlementMetric}}, SP_ENTITLEMENT_POOL_FORM, {entitlementMetric: validateChoiceWithOther})} - label={i18n('Entitlement Metric')} - data-test-id='create-ep-entitlement-metric' - type='select' - required={true} - selectedEnum={entitlementMetric && entitlementMetric.choice} - otherValue={entitlementMetric && entitlementMetric.other} - values={EntitlementPoolsOptionsInputValues.ENTITLEMENT_METRIC} - isValid={genericFieldInfo.entitlementMetric.isValid} - errorText={genericFieldInfo.entitlementMetric.errorText} /> - {}} - isMultiSelect={false} - isRequired={true} - onEnumChange={aggregationFunction => onDataChanged({aggregationFunction:{choice: aggregationFunction, other: ''}}, - SP_ENTITLEMENT_POOL_FORM, {aggregationFunction: validateChoiceWithOther})} - onOtherChange={aggregationFunction => onDataChanged({aggregationFunction:{choice: optionInputOther.OTHER, - other: aggregationFunction}}, SP_ENTITLEMENT_POOL_FORM, {aggregationFunction: validateChoiceWithOther})} - label={i18n('Aggregate Function')} - data-test-id='create-ep-aggregate-function' - type='select' - required={true} - selectedEnum={aggregationFunction && aggregationFunction.choice} - otherValue={aggregationFunction && aggregationFunction.other} - values={EntitlementPoolsOptionsInputValues.AGGREGATE_FUNCTION} - isValid={genericFieldInfo.aggregationFunction.isValid} - errorText={genericFieldInfo.aggregationFunction.errorText} /> -
- - onDataChanged({manufacturerReferenceNumber}, SP_ENTITLEMENT_POOL_FORM)} - label={i18n('Manufacturer Reference Number')} - value={manufacturerReferenceNumber} - isValid={genericFieldInfo.manufacturerReferenceNumber.isValid} - errorText={genericFieldInfo.manufacturerReferenceNumber.errorText} - isRequired={true} - data-test-id='create-ep-reference-number' - type='text'/> - - - {}} - isMultiSelect={false} - isRequired={true} - onEnumChange={time => onDataChanged({time:{choice: time, other: ''}}, - SP_ENTITLEMENT_POOL_FORM, {time: validateChoiceWithOther})} - onOtherChange={time => onDataChanged({time:{choice: optionInputOther.OTHER, - other: time}}, SP_ENTITLEMENT_POOL_FORM, {time: validateTimeOtherValue})} - label={i18n('Time')} - data-test-id='create-ep-time' - type='select' - required={true} - selectedEnum={time && time.choice} - otherValue={time && time.other} - values={EntitlementPoolsOptionsInputValues.TIME} - isValid={genericFieldInfo.time.isValid} - errorText={genericFieldInfo.time.errorText} /> - - onDataChanged({increments}, SP_ENTITLEMENT_POOL_FORM)} label={i18n('Increments')} value={increments} data-test-id='create-ep-increments' type='text'/> - - - - onDataChanged( - {startDate: startDate ? startDate.format(EP_TIME_FORMAT) : ''}, - SP_ENTITLEMENT_POOL_FORM, - {startDate: validateStartDate} - )} - isValid={genericFieldInfo.startDate.isValid} - errorText={genericFieldInfo.startDate.errorText} - selectsStart/> - - - { - onDataChanged({expiryDate: expiryDate ? expiryDate.format(EP_TIME_FORMAT) : ''}, SP_ENTITLEMENT_POOL_FORM); - onDataChanged({startDate}, SP_ENTITLEMENT_POOL_FORM, {startDate: validateStartDate}); - }} - isValid={genericFieldInfo.expiryDate.isValid} - errorText={genericFieldInfo.expiryDate.errorText} - selectsEnd/> - +
+ onDataChanged( + {startDate: startDate ? startDate.format(DATE_FORMAT) : ''}, + SP_ENTITLEMENT_POOL_FORM, + {startDate: validateStartDate} + )} + isValid={genericFieldInfo.startDate.isValid} + errorText={genericFieldInfo.startDate.errorText} + selectsStart/> + { + onDataChanged({expiryDate: expiryDate ? expiryDate.format(DATE_FORMAT) : ''}, SP_ENTITLEMENT_POOL_FORM); + onDataChanged({startDate}, SP_ENTITLEMENT_POOL_FORM, {startDate: validateStartDate}); + }} + isValid={genericFieldInfo.expiryDate.isValid} + errorText={genericFieldInfo.expiryDate.errorText} + selectsEnd/> +
+
); }; @@ -263,42 +189,102 @@ class EntitlementPoolsEditorView extends React.Component { data: {} }; - render() { - let {data = {}, onDataChanged, isReadOnlyMode, genericFieldInfo} = this.props; + componentDidUpdate(prevProps) { + if (this.props.formReady && this.props.formReady !== prevProps.formReady) { // if form validation succeeded -> continue with submit + this.submit(); + } + } + + state = { + selectedTab: tabIds.GENERAL, + selectedLimit: '' + }; + render() { + let {data = {}, onDataChanged, isReadOnlyMode, genericFieldInfo, onCloseLimitEditor, limitsList = []} = this.props; + const {selectedTab} = this.state; + const isTabsDisabled = !data.id || !this.props.isFormValid; return (
- { - genericFieldInfo &&
this.submit() } - onReset={ () => this.props.onCancel() } - labledButtons={true} - isReadOnlyMode={isReadOnlyMode} - isValid={this.props.isFormValid} - formReady={this.props.formReady} - onValidateForm={() => this.props.onValidateForm(SP_ENTITLEMENT_POOL_FORM) } - className='entitlement-pools-form'> - this.validateName(value)} - validateTimeOtherValue ={(value)=> this.validateTimeOtherValue(value)} - validateChoiceWithOther={(value)=> this.validateChoiceWithOther(value)} - validateStartDate={(value, state)=> this.validateStartDate(value, state)} - thresholdValueValidation={(value, state)=> this.thresholdValueValidation(value, state)}/> - + { + if (tabIndex === tabIds.ADD_LIMIT_BUTTON) { + this.onAddLimit(); + } else { + this.setState({selectedTab: tabIndex}); + this.setState({selectedLimit: ''}); + onCloseLimitEditor(); + } + + }} + invalidTabs={[]}> + + { + genericFieldInfo &&
this.props.onValidateForm(SP_ENTITLEMENT_POOL_FORM) } + className='license-model-form entitlement-pools-form'> + this.validateName(value)} + validateStartDate={(value, state) => validateStartDate(value, state)} + thresholdValueValidation={(value, state) => thresholdValueValidation(value, state)}/> + + } +
+ + {selectedTab === tabIds.SP_LIMITS && + item.type === limitType.SERVICE_PROVIDER)} + selectedLimit={this.state.selectedLimit} + onCloseLimitEditor={() => this.onCloseLimitEditor()} + onSelectLimit={limit => this.onSelectLimit(limit)}/>} + + + {selectedTab === tabIds.VENDOR_LIMITS && + item.type === limitType.VENDOR)} + selectedLimit={this.state.selectedLimit} + onCloseLimitEditor={() => this.onCloseLimitEditor()} + onSelectLimit={limit => this.onSelectLimit(limit)}/>} + + {selectedTab !== tabIds.GENERAL ? + : +
// Render empty div to not break tabs } +
+ + {!this.state.selectedLimit && } + +
); } submit() { - const {data: entitlementPool, previousData: previousEntitlementPool} = this.props; - this.props.onSubmit({entitlementPool, previousEntitlementPool}); + const {data: entitlementPool, previousData: previousEntitlementPool, formReady} = this.props; + + if (!formReady) { + this.props.onValidateForm(SP_ENTITLEMENT_POOL_FORM); + } else { + this.props.onSubmit({entitlementPool, previousEntitlementPool}); + } + + } validateName(value) { @@ -309,52 +295,26 @@ class EntitlementPoolsEditorView extends React.Component { {isValid: false, errorText: i18n('Entitlement pool by the name \'' + value + '\' already exists. Entitlement pool name must be unique')}; } - validateStartDate(value, state) { - if (state.data.expiryDate) { - if (!value) { - return {isValid: false, errorText: i18n('Start date has to be specified if expiry date is specified')}; - } + onSelectLimit(limit) { + if (limit.id === this.state.selectedLimit) { + this.setState({selectedLimit: ''}); + return; } - return {isValid: true, errorText: ''}; + this.setState({selectedLimit: limit.id}); + this.props.onOpenLimitEditor(limit); } - validateTimeOtherValue(value) { - return Validator.validate('time', value.other, [{type: 'required', data: true}, {type: 'numeric', data: true}]); + onCloseLimitEditor() { + this.setState({selectedLimit: ''}); + this.props.onCloseLimitEditor(); } - validateChoiceWithOther(value) { - let chosen = value.choice; - // if we have an empty multiple select we have a problem since it's required - if (value.choices) { - if (value.choices.length === 0) { - return Validator.validate('field', '', [{type: 'required', data: true}]); - } else { - // continuing validation with the first chosen value in case we have the 'Other' field - chosen = value.choices[0]; - } - } - if (chosen !== optionInputOther.OTHER) { - return Validator.validate('field', chosen, [{type: 'required', data: true}]); - } else { // when 'Other' was chosen, validate other value - return Validator.validate('field', value.other, [{type: 'required', data: true}]); - } + onAddLimit() { + this.setState({selectedLimit: NEW_LIMIT_TEMP_ID}); + this.props.onOpenLimitEditor(); } - thresholdValueValidation(value, state) { - let unit = state.data.thresholdUnits; - if (unit === thresholdUnitType.PERCENTAGE) { - return Validator.validate('thresholdValue', value, [ - {type: 'required', data: true}, - {type: 'numeric', data: true}, - {type: 'maximum', data: 100}, - {type: 'minimum', data: 0}]); - } else { - return Validator.validate('thresholdValue', value, [ - {type: 'numeric', data: true}, - {type: 'required', data: true}]); - } - } } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js new file mode 100644 index 0000000000..ae53a753c0 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js @@ -0,0 +1,56 @@ +/*! + * 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 {connect} from 'react-redux'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; +import Limits from 'sdc-app/onboarding/licenseModel/limits/Limits.jsx'; +import {actionTypes as globalModalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; +import EntitlementPoolsActionHelper from './EntitlementPoolsActionHelper.js'; + +const mapStateToProps = ({licenseModel: {entitlementPool: {entitlementPoolEditor: {data}}, limitEditor}, currentScreen}) => { + let {props: {licenseModelId, version}} = currentScreen; + return { + parent: data, + limitEditor, + licenseModelId, + version + }; +}; + +const mapActionsToProps = (dispatch) => { + return { + onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}), + onSubmit: (limit, entitlementPool, licenseModelId, version) => EntitlementPoolsActionHelper.submitLimit(dispatch, + { + limit, + entitlementPool, + licenseModelId, + version}), + onDelete: ({limit, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit}) => dispatch({ + type: globalModalActionTypes.GLOBAL_MODAL_WARNING, + data:{ + msg: i18n(`Are you sure you want to delete ${limit.name}?`), + confirmationButtonText: i18n('Delete'), + title: i18n('Warning'), + onConfirmed: ()=> EntitlementPoolsActionHelper.deleteLimit(dispatch, {limit, entitlementPool: parent, licenseModelId, version}).then(() => + selectedLimit === limit.id && onCloseLimitEditor() + ) + } + }) + }; +}; + +export default connect(mapStateToProps, mapActionsToProps)(Limits); \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js index 993ed48f2b..62c6663833 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js @@ -39,7 +39,7 @@ const mapStateToProps = ({licenseModel: {entitlementPool, licenseModelEditor}}) const mapActionsToProps = (dispatch, {licenseModelId, version}) => { return { onAddEntitlementPoolClick: () => EntitlementPoolsActionHelper.openEntitlementPoolsEditor(dispatch), - onEditEntitlementPoolClick: entitlementPool => EntitlementPoolsActionHelper.openEntitlementPoolsEditor(dispatch, {entitlementPool}), + onEditEntitlementPoolClick: entitlementPool => EntitlementPoolsActionHelper.openEntitlementPoolsEditor(dispatch, {entitlementPool, licenseModelId, version}), onDeleteEntitlementPool: entitlementPool => dispatch({ type: globalMoadlActions.GLOBAL_MODAL_WARNING, data:{ diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx index 55fd11b8bb..c730d669c7 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx @@ -21,7 +21,7 @@ import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; import EntitlementPoolsEditor from './EntitlementPoolsEditor.js'; -import {extractUnits, extractValue} from './EntitlementPoolsConstants'; +import {extractUnits} from './EntitlementPoolsConstants'; class EntitlementPoolsListEditorView extends React.Component { static propTypes = { @@ -60,7 +60,7 @@ class EntitlementPoolsListEditorView extends React.Component { isReadOnlyMode={isReadOnlyMode}> {this.filterList().map(entitlementPool => this.renderEntitlementPoolListItem(entitlementPool, isReadOnlyMode))} - + {`${isModalInEditMode ? i18n('Edit Entitlement Pool') : i18n('Create New Entitlement Pool')}`} @@ -91,8 +91,7 @@ class EntitlementPoolsListEditorView extends React.Component { } renderEntitlementPoolListItem(entitlementPool, isReadOnlyMode) { - let {id, name, description, thresholdValue, thresholdUnits, entitlementMetric, aggregationFunction, - manufacturerReferenceNumber, time} = entitlementPool; + let {id, name, description, thresholdValue, thresholdUnits} = entitlementPool; let {onEditEntitlementPoolClick, onDeleteEntitlementPool} = this.props; return (
{i18n('Entitlement')}
-
{`${extractValue(aggregationFunction)} ${extractValue(entitlementMetric)} per ${extractValue(time)}`}
-
{`${thresholdValue ? thresholdValue : ''} ${extractUnits(thresholdUnits)}`}
-
- -
-
{i18n('Manufacturer Reference Number')}
-
{manufacturerReferenceNumber}
+
{thresholdValue && `${thresholdValue} ${extractUnits(thresholdUnits)}`}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js index c6249c98ca..6edb1e1f0c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js @@ -34,7 +34,7 @@ export const mapStateToProps = ({licenseModel: {featureGroup, entitlementPool, l } for (let i = 0; i < list.length; i++) { - FGNames[list[i].name] = list[i].id; + FGNames[list[i].name.toLowerCase()] = list[i].id; } for (let field in genericFieldInfo) { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx index d69548442c..6a5ee4617c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx @@ -15,7 +15,7 @@ */ import React from 'react'; import Tabs from 'nfvo-components/input/validation/Tabs.jsx'; -import Tab from 'react-bootstrap/lib/Tab.js'; +import Tab from 'sdc-ui/lib/react/Tab.js'; import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; import {TabsForm as Form} from 'nfvo-components/input/validation/Form.jsx'; @@ -31,12 +31,13 @@ const FeatureGroupsPropType = React.PropTypes.shape({ name: React.PropTypes.string, description: React.PropTypes.string, partNumber: React.PropTypes.string, + manufacturerReferenceNumber: React.PropTypes.string, entitlementPoolsIds: React.PropTypes.arrayOf(React.PropTypes.string), licenseKeyGroupsIds: React.PropTypes.arrayOf(React.PropTypes.string) }); const GeneralTab = ({data = {}, onDataChanged, genericFieldInfo, validateName}) => { - let {name, description, partNumber} = data; + let {name, description, partNumber, manufacturerReferenceNumber} = data; return ( @@ -51,6 +52,8 @@ const GeneralTab = ({data = {}, onDataChanged, genericFieldInfo, validateName}) isRequired={true} isValid={genericFieldInfo.name.isValid} errorText={genericFieldInfo.name.errorText} /> + + + + onDataChanged({partNumber}, FG_EDITOR_FORM)} @@ -74,6 +78,18 @@ const GeneralTab = ({data = {}, onDataChanged, genericFieldInfo, validateName}) isValid={genericFieldInfo.partNumber.isValid} errorText={genericFieldInfo.partNumber.errorText} /> + + onDataChanged({manufacturerReferenceNumber}, FG_EDITOR_FORM)} + label={i18n('Manufacturer Reference Number')} + data-test-id='create-fg-reference-number' + value={manufacturerReferenceNumber} + isRequired={true} + type='text' + isValid={genericFieldInfo.manufacturerReferenceNumber.isValid} + errorText={genericFieldInfo.manufacturerReferenceNumber.errorText} /> + ); }; @@ -94,7 +110,7 @@ const EntitlementPoolsTab = ({entitlementPoolsList, data, onDataChanged, isReadO ); } else { return ( -

{i18n('There is no available entitlement pools')}

+

{i18n('There are no available entitlement pools')}

); } }; @@ -115,7 +131,7 @@ const LKGTab = ({licenseKeyGroupsList, data, onDataChanged, isReadOnlyMode}) => ); } else { return ( -

{i18n('There is no available licsense key groups')}

+

{i18n('There are no available license key groups')}

); } }; @@ -166,22 +182,22 @@ class FeatureGroupEditorView extends React.Component { labledButtons={true} isReadOnlyMode={isReadOnlyMode} name='feature-group-validation-form' - className='feature-group-form'> - - + className='license-model-form feature-group-form'> + +
this.validateName(value)}/>
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx index f883bd7a14..9844290a25 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx @@ -65,7 +65,7 @@ class FeatureGroupListEditorView extends React.Component { {this.filterList().map(listItem => this.renderFeatureGroupListItem(listItem, isReadOnlyMode, version))} {featureGroupsModal.show && + className='onborading-modal license-model-modal feature-group-modal'> {`${featureGroupsModal.editMode ? i18n('Edit Feature Group') : i18n('Create New Feature Group')}`} @@ -84,7 +84,7 @@ class FeatureGroupListEditorView extends React.Component { renderFeatureGroupListItem(listItem, isReadOnlyMode, version) { - let {name, description, entitlementPoolsIds = [], licenseKeyGroupsIds = []} = listItem; + let {name, description, manufacturerReferenceNumber, entitlementPoolsIds = [], licenseKeyGroupsIds = []} = listItem; return (
+
+
+
{i18n('Manufacturer Reference')}
+
{i18n('Number')}
+
{manufacturerReferenceNumber}
+
+
+
{i18n('Description')}
{description}
+ + ); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js index a2015787a6..b8c03750fb 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js @@ -39,6 +39,7 @@ function addFeatureGroup(licenseModelId, featureGroup, version) { name: featureGroup.name, description: featureGroup.description, partNumber: featureGroup.partNumber, + manufacturerReferenceNumber: featureGroup.manufacturerReferenceNumber, addedLicenseKeyGroupsIds: featureGroup.licenseKeyGroupsIds, addedEntitlementPoolsIds: featureGroup.entitlementPoolsIds }); @@ -54,6 +55,7 @@ function updateFeatureGroup(licenseModelId, previousFeatureGroup, featureGroup, name: featureGroup.name, description: featureGroup.description, partNumber: featureGroup.partNumber, + manufacturerReferenceNumber: featureGroup.manufacturerReferenceNumber, addedLicenseKeyGroupsIds: licenseKeyGroupsIds.filter(licenseKeyGroupId => prevLicenseKeyGroupsIds.indexOf(licenseKeyGroupId) === -1), removedLicenseKeyGroupsIds: prevLicenseKeyGroupsIds.filter(prevLicenseKeyGroupId => licenseKeyGroupsIds.indexOf(prevLicenseKeyGroupId) === -1), addedEntitlementPoolsIds: entitlementPoolsIds.filter(entitlementPoolId => prevEntitlementPoolsIds.indexOf(entitlementPoolId) === -1), diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js index 001bd20d44..5688fc0f16 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js @@ -30,7 +30,7 @@ export default (state = {}, action) => { 'description': { isValid: true, errorText: '', - validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}], + validations: [{type: 'maxLength', data: 1000}], tabId: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL }, 'partNumber': { @@ -39,6 +39,12 @@ export default (state = {}, action) => { validations: [{type: 'required', data: true}], tabId: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL }, + 'manufacturerReferenceNumber': { + isValid: true, + errorText: '', + validations: [{type: 'required', data: true}, {type: 'maxLength', data: 100}], + tabId: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL + }, 'name': { isValid: true, errorText: '', diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementConstants.js index 998d5f0e8d..40bef2c181 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementConstants.js @@ -15,7 +15,7 @@ */ import keyMirror from 'nfvo-utils/KeyMirror.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions, {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; export const actionTypes = keyMirror({ LICENSE_AGREEMENT_LIST_LOADED: null, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditor.js index aada8ddca1..7d70da6ea5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditor.js @@ -32,7 +32,7 @@ export const mapStateToProps = ({licenseModel: {licenseAgreement, featureGroup}} } for (let i = 0; i < list.length; i++) { - LANames[list[i].name] = list[i].id; + LANames[list[i].name.toLowerCase()] = list[i].id; } const {featureGroupsList = []} = featureGroup; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js index e02935c579..5be140550a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js @@ -26,7 +26,7 @@ export default (state = {}, action) => { 'description' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}], + validations: [{type: 'maxLength', data: 1000}], tabId: LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB.GENERAL }, 'requirementsAndConstrains' : { @@ -38,7 +38,7 @@ export default (state = {}, action) => { 'licenseTerm' : { isValid: true, errorText: '', - validations: [], + validations: [{type: 'required', data: true}], tabId: LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB.GENERAL }, 'name' : { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx index 42a33fd509..a15e5daa4e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx @@ -19,7 +19,7 @@ import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; import {TabsForm as Form} from 'nfvo-components/input/validation/Form.jsx'; import Tabs from 'nfvo-components/input/validation/Tabs.jsx'; -import Tab from 'react-bootstrap/lib/Tab.js'; +import Tab from 'sdc-ui/lib/react/Tab.js'; import Input from 'nfvo-components/input/validation/Input.jsx'; import DualListboxView from 'nfvo-components/input/dualListbox/DualListboxView.jsx'; import i18n from 'nfvo-utils/i18n/i18n.js'; @@ -96,7 +96,6 @@ const GeneralTabContent = ({data, genericFieldInfo, onDataChanged, validateName, overlayPos='bottom' data-test-id='create-la-description' name='license-agreement-description' - isRequired={true} type='textarea'/> @@ -145,10 +144,10 @@ class LicenseAgreementEditorView extends React.Component { isValid={this.props.isFormValid} formReady={this.props.formReady} onValidateForm={() => this.props.onValidateForm(LA_EDITOR_FORM) } - className='license-agreement-form'> - + className='license-model-form license-agreement-form'> +
@@ -157,7 +156,7 @@ class LicenseAgreementEditorView extends React.Component {
@@ -168,7 +167,7 @@ class LicenseAgreementEditorView extends React.Component { selectedValuesList={data.featureGroupsIds} availableList={featureGroupsList} onChange={ selectedValuesList => onDataChanged( { featureGroupsIds: selectedValuesList }, LA_EDITOR_FORM )}/> : -

{i18n('There is no available feature groups')}

} +

{i18n('There are no available feature groups')}

}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx index 192d2ded99..6247723d72 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx @@ -59,7 +59,7 @@ class LicenseAgreementListEditorView extends React.Component { isReadOnlyMode={isReadOnlyMode}> {this.filterList().map(licenseAgreement => this.renderLicenseAgreementListItem(licenseAgreement, isReadOnlyMode, version))} - + {`${isModalInEditMode ? i18n('Edit License Agreement') : i18n('Create New License Agreement')}`} diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js index dd2a5c6003..f5017f6d7a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js @@ -17,6 +17,8 @@ import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js'; import Configuration from 'sdc-app/config/Configuration.js'; import {actionTypes as licenseKeyGroupsConstants} from './LicenseKeyGroupsConstants.js'; import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js'; +import {actionTypes as limitEditorActions} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js'; +import getValue from 'nfvo-utils/getValue.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -36,8 +38,13 @@ function postLicenseKeyGroup(licenseModelId, licenseKeyGroup, version) { return RestAPIUtil.post(baseUrl(licenseModelId, version), { name: licenseKeyGroup.name, description: licenseKeyGroup.description, - operationalScope: licenseKeyGroup.operationalScope, - type: licenseKeyGroup.type + operationalScope: getValue(licenseKeyGroup.operationalScope), + type: licenseKeyGroup.type, + increments: licenseKeyGroup.increments, + thresholdValue: licenseKeyGroup.thresholdValue, + thresholdUnits: getValue(licenseKeyGroup.thresholdUnits), + startDate: licenseKeyGroup.startDate, + expiryDate: licenseKeyGroup.expiryDate }); } @@ -45,11 +52,50 @@ function putLicenseKeyGroup(licenseModelId, licenseKeyGroup, version) { return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${licenseKeyGroup.id}`, { name: licenseKeyGroup.name, description: licenseKeyGroup.description, - operationalScope: licenseKeyGroup.operationalScope, - type: licenseKeyGroup.type + operationalScope: getValue(licenseKeyGroup.operationalScope), + type: licenseKeyGroup.type, + increments: licenseKeyGroup.increments, + thresholdValue: licenseKeyGroup.thresholdValue, + thresholdUnits: getValue(licenseKeyGroup.thresholdUnits), + startDate: licenseKeyGroup.startDate, + expiryDate: licenseKeyGroup.expiryDate }); } +function fetchLimitsList(licenseModelId, licenseKeyGroupId, version) { + return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}/${licenseKeyGroupId}/limits`); +} + +function deleteLimit(licenseModelId, licenseKeyGroupId, version, limitId) { + return RestAPIUtil.destroy(`${baseUrl(licenseModelId, version)}/${licenseKeyGroupId}/limits/${limitId}`); +} + +function postLimit(licenseModelId, licenseKeyGroupId, version, limit) { + return RestAPIUtil.post(`${baseUrl(licenseModelId, version)}/${licenseKeyGroupId}/limits`, { + name: limit.name, + type: limit.type, + description: limit.description, + metric: limit.metric, + value: limit.value, + unit: limit.unit, + aggregationFunction: getValue(limit.aggregationFunction), + time: getValue(limit.time) + }); +} + +function putLimit(licenseModelId, licenseKeyGroupId, version, limit) { + + return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${licenseKeyGroupId}/limits/${limit.id}`, { + name: limit.name, + type: limit.type, + description: limit.description, + metric: limit.metric, + value: limit.value, + unit: limit.unit, + aggregationFunction: getValue(limit.aggregationFunction), + time: getValue(limit.time) + }); +} export default { fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version}) { @@ -59,7 +105,10 @@ export default { })); }, - openLicenseKeyGroupsEditor(dispatch, {licenseKeyGroup} = {}) { + openLicenseKeyGroupsEditor(dispatch, {licenseKeyGroup, licenseModelId, version} = {}) { + if (licenseModelId && version) { + this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); + } dispatch({ type: licenseKeyGroupsConstants.licenseKeyGroupsEditor.OPEN, licenseKeyGroup @@ -124,5 +173,34 @@ export default { LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => { this.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version}); }); + }, + + + fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}) { + return fetchLimitsList(licenseModelId, licenseKeyGroup.id, version).then(response => { + dispatch({ + type: licenseKeyGroupsConstants.licenseKeyGroupsEditor.LIMITS_LIST_LOADED, + response + }); + }); + }, + + submitLimit(dispatch, {licenseModelId, version, licenseKeyGroup, limit}) { + const promise = limit.id ? putLimit(licenseModelId,licenseKeyGroup.id, version, limit) : + postLimit(licenseModelId,licenseKeyGroup.id, version, limit); + return promise.then(() => { + dispatch({ + type: limitEditorActions.CLOSE + }); + this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); + }); + }, + + deleteLimit(dispatch, {licenseModelId, version, licenseKeyGroup, limit}) { + return deleteLimit(licenseModelId,licenseKeyGroup.id, version, limit.id).then(() => { + this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); + }); } + + }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js index 50d1fe8625..c376cb3fbc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js @@ -15,7 +15,7 @@ */ import keyMirror from 'nfvo-utils/KeyMirror.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions, {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; export const actionTypes = keyMirror({ @@ -28,6 +28,7 @@ export const actionTypes = keyMirror({ OPEN: null, CLOSE: null, DATA_CHANGED: null, + LIMITS_LIST_LOADED: null } }); @@ -77,3 +78,10 @@ export const getOperationalScopes = (operationalScope) => { return allOpScopes; } }; + +export const tabIds = { + GENERAL: 'GENERAL', + SP_LIMITS: 'SP_LIMITS', + VENDOR_LIMITS: 'VENDOR_LIMITS', + ADD_LIMIT_BUTTON: 'ADD_LIMIT_BUTTON' +}; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditor.js index aef1532dc1..028fa9d3e4 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditor.js @@ -16,12 +16,13 @@ import {connect} from 'react-redux'; import LicenseKeyGroupsActionHelper from './LicenseKeyGroupsActionHelper.js'; import LicenseKeyGroupsEditorView from './LicenseKeyGroupsEditorView.jsx'; +import LimitEditorActionHelper from '../limits/LimitEditorActionHelper.js'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; const mapStateToProps = ({licenseModel: {licenseKeyGroup}}) => { - let {data, genericFieldInfo, formReady} = licenseKeyGroup.licenseKeyGroupsEditor; + let {data, genericFieldInfo, formReady, limitsList} = licenseKeyGroup.licenseKeyGroupsEditor; let previousData, LKGNames = {}; const licenseKeyGroupId = data ? data.id : null; @@ -33,7 +34,7 @@ const mapStateToProps = ({licenseModel: {licenseKeyGroup}}) => { const list = licenseKeyGroup.licenseKeyGroupsList; for (let i = 0; i < list.length; i++) { - LKGNames[list[i].name] = list[i].id; + LKGNames[list[i].name.toLowerCase()] = list[i].id; } return { @@ -42,7 +43,8 @@ const mapStateToProps = ({licenseModel: {licenseKeyGroup}}) => { genericFieldInfo, isFormValid, formReady, - LKGNames + LKGNames, + limitsList }; }; @@ -50,11 +52,13 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => { return { onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}), onCancel: () => LicenseKeyGroupsActionHelper.closeLicenseKeyGroupEditor(dispatch), - onSubmit: ({previousLicenseKeyGroup, licenseKeyGroup}) => { - LicenseKeyGroupsActionHelper.closeLicenseKeyGroupEditor(dispatch); + onSubmit: ({previousLicenseKeyGroup, licenseKeyGroup, keepOpen}) => { + if (!keepOpen) {LicenseKeyGroupsActionHelper.closeLicenseKeyGroupEditor(dispatch);} LicenseKeyGroupsActionHelper.saveLicenseKeyGroup(dispatch, {licenseModelId, previousLicenseKeyGroup, licenseKeyGroup, version}); }, - onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName) + onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName), + onCloseLimitEditor: () => LimitEditorActionHelper.closeLimitsEditor(dispatch), + onOpenLimitEditor: (limit) => LimitEditorActionHelper.openLimitsEditor(dispatch, {limit}) }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js index 090c971c65..b1a22f3d9a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js @@ -14,20 +14,30 @@ * permissions and limitations under the License. */ import {actionTypes, defaultState, LKG_FORM_NAME} from './LicenseKeyGroupsConstants.js'; +import moment from 'moment'; +import {DATE_FORMAT} from 'sdc-app/onboarding/OnboardingConstants.js'; export default (state = {}, action) => { switch (action.type) { case actionTypes.licenseKeyGroupsEditor.OPEN: + let licenseKeyGroupData = {...action.licenseKeyGroup}; + let {startDate, expiryDate} = licenseKeyGroupData; + if (startDate) { + licenseKeyGroupData.startDate = moment(startDate, DATE_FORMAT).format(DATE_FORMAT); + } + if (expiryDate) { + licenseKeyGroupData.expiryDate = moment(expiryDate, DATE_FORMAT).format(DATE_FORMAT); + } return { ...state, - data: action.licenseKeyGroup ? {...action.licenseKeyGroup} : defaultState.licenseKeyGroupsEditor, + data: action.licenseKeyGroup ? licenseKeyGroupData : defaultState.licenseKeyGroupsEditor, formReady: null, formName: LKG_FORM_NAME, genericFieldInfo: { 'description' : { isValid: true, errorText: '', - validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}] + validations: [{type: 'maxLength', data: 1000}] }, 'name' : { isValid: true, @@ -43,9 +53,39 @@ export default (state = {}, action) => { isValid: true, errorText: '', validations: [] + }, + 'thresholdUnits' : { + isValid: true, + errorText: '', + validations: [] + }, + 'thresholdValue' : { + isValid: true, + errorText: '', + validations: [] + }, + 'increments' : { + isValid: true, + errorText: '', + validations: [{type: 'maxLength', data: 120}] + }, + 'startDate': { + isValid: true, + errorText: '', + validations: [] + }, + 'expiryDate': { + isValid: true, + errorText: '', + validations: [] } } }; + case actionTypes.licenseKeyGroupsEditor.LIMITS_LIST_LOADED: + return { + ...state, + limitsList: action.response.results + }; case actionTypes.licenseKeyGroupsEditor.CLOSE: return {}; default: diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx index b95efd0f9c..647e205cb5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx @@ -17,27 +17,43 @@ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Validator from 'nfvo-utils/Validator.js'; +import Tabs from 'sdc-ui/lib/react/Tabs.js'; +import Tab from 'sdc-ui/lib/react/Tab.js'; + +import Button from 'sdc-ui/lib/react/Button.js'; import Form from 'nfvo-components/input/validation/Form.jsx'; import Input from 'nfvo-components/input/validation/Input.jsx'; import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; -import {optionsInputValues as licenseKeyGroupOptionsInputValues, LKG_FORM_NAME} from './LicenseKeyGroupsConstants.js'; +import {optionsInputValues as licenseKeyGroupOptionsInputValues, LKG_FORM_NAME, tabIds} from './LicenseKeyGroupsConstants.js'; +import {optionsInputValues as LicenseModelOptionsInputValues} from '../LicenseModelConstants.js'; +import {validateStartDate, thresholdValueValidation} from '../LicenseModelValidations.js'; import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; -const LicenseKeyGroupPropType = React.PropTypes.shape({ +import {DATE_FORMAT} from 'sdc-app/onboarding/OnboardingConstants.js'; + +import LicenseKeyGroupsLimits from './LicenseKeyGroupsLimits.js'; +import {limitType, NEW_LIMIT_TEMP_ID} from '../limits/LimitEditorConstants.js'; + + const LicenseKeyGroupPropType = React.PropTypes.shape({ id: React.PropTypes.string, name: React.PropTypes.string, description: React.PropTypes.string, + increments: React.PropTypes.string, operationalScope: React.PropTypes.shape({ choices: React.PropTypes.array, other: React.PropTypes.string }), - type: React.PropTypes.string + type: React.PropTypes.string, + thresholdUnits: React.PropTypes.string, + thresholdValue: React.PropTypes.number, + startDate: React.PropTypes.string, + expiryDate: React.PropTypes.string }); -const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, validateName, validateOperationalScope}) => { - let {name, description, operationalScope, type} = data; +const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, validateName, validateStartDate, thresholdValueValidation}) => { + let {name, description, increments, operationalScope, type, thresholdUnits, thresholdValue, startDate, expiryDate} = data; return ( @@ -55,11 +71,10 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali {}} isMultiSelect={true} - isRequired={true} onEnumChange={operationalScope => onDataChanged({operationalScope:{choices: operationalScope, other: ''}}, - LKG_FORM_NAME, {operationalScope: validateOperationalScope})} + LKG_FORM_NAME)} onOtherChange={operationalScope => onDataChanged({operationalScope:{choices: [optionInputOther.OTHER], - other: operationalScope}}, LKG_FORM_NAME, {operationalScope: validateOperationalScope})} + other: operationalScope}}, LKG_FORM_NAME)} label={i18n('Operational Scope')} data-test-id='create-lkg-operational-scope' type='select' @@ -77,7 +92,6 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali value={description} isValid={genericFieldInfo.description.isValid} errorText={genericFieldInfo.description.errorText} - isRequired={true} type='textarea' overlayPos='bottom' /> @@ -101,6 +115,82 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali } + + { + // setting the unit to the correct value + const selectedIndex = e.target.selectedIndex; + const val = e.target.options[selectedIndex].value; + onDataChanged({thresholdUnits: val}, LKG_FORM_NAME); + // TODO make sure that the value is valid too + onDataChanged({thresholdValue: thresholdValue}, LKG_FORM_NAME,{thresholdValue : thresholdValueValidation});} + + } + value={thresholdUnits} + label={i18n('Threshold Units')} + data-test-id='create-ep-threshold-units' + isValid={genericFieldInfo.thresholdUnits.isValid} + errorText={genericFieldInfo.thresholdUnits.errorText} + groupClassName='bootstrap-input-options' + className='input-options-select' + type='select' > + {LicenseModelOptionsInputValues.THRESHOLD_UNITS.map(mtype => + )} + + + + onDataChanged({thresholdValue}, LKG_FORM_NAME, + {thresholdValue : thresholdValueValidation})} + label={i18n('Threshold Value')} + isValid={genericFieldInfo.thresholdValue.isValid} + errorText={genericFieldInfo.thresholdValue.errorText} + data-test-id='create-ep-threshold-value' + value={thresholdValue} + type='text'/> + + + onDataChanged( + {startDate: startDate ? startDate.format(DATE_FORMAT) : ''}, + LKG_FORM_NAME, + {startDate: validateStartDate} + )} + isValid={genericFieldInfo.startDate.isValid} + errorText={genericFieldInfo.startDate.errorText} + selectsStart/> + + + { + onDataChanged({expiryDate: expiryDate ? expiryDate.format(DATE_FORMAT) : ''}, LKG_FORM_NAME); + onDataChanged({startDate}, LKG_FORM_NAME, {startDate: validateStartDate}); + }} + isValid={genericFieldInfo.expiryDate.isValid} + errorText={genericFieldInfo.expiryDate.errorText} + selectsEnd/> + + + onDataChanged({increments}, LKG_FORM_NAME)} + label={i18n('Increments')} + value={increments} + data-test-id='create-ep-increments' + type='text'/> + ); }; @@ -120,36 +210,100 @@ class LicenseKeyGroupsEditorView extends React.Component { data: {} }; + componentDidUpdate(prevProps) { + if (this.props.formReady && this.props.formReady !== prevProps.formReady) { // if form validation succeeded -> continue with submit + this.submit(); + } + } + + state = { + localFeatureGroupsListFilter: '', + selectedTab: tabIds.GENERAL, + selectedLimit: '' + }; + render() { - let {data = {}, onDataChanged, isReadOnlyMode, genericFieldInfo} = this.props; + let {data = {}, onDataChanged, isReadOnlyMode, onCloseLimitEditor, genericFieldInfo, limitsList = []} = this.props; + let {selectedTab} = this.state; + const isTabsDisabled = !data.id || !this.props.isFormValid; return ( -
- { genericFieldInfo && -
this.submit() } - onReset={ () => this.props.onCancel() } - isValid={this.props.isFormValid} - formReady={this.props.formReady} - onValidateForm={() => this.props.onValidateForm(LKG_FORM_NAME) } - labledButtons={true} - isReadOnlyMode={isReadOnlyMode} - className='license-key-groups-form'> - this.validateName(value)} - validateOperationalScope={this.validateOperationalScope}/> - } +
+ { + if (tabIndex === tabIds.ADD_LIMIT_BUTTON) { + this.onAddLimit(); + } else { + this.setState({selectedTab: tabIndex}); + onCloseLimitEditor(); + this.setState({selectedLimit: ''}); + } + }} + invalidTabs={[]}> + + { genericFieldInfo && +
this.props.onValidateForm(LKG_FORM_NAME) } + labledButtons={true} + isReadOnlyMode={isReadOnlyMode} + className='license-model-form license-key-groups-form'> + this.validateName(value)} + validateStartDate={(value, state)=> validateStartDate(value, state)} + thresholdValueValidation={(value, state) => thresholdValueValidation(value, state)}/> + } + +
+ + {selectedTab === tabIds.SP_LIMITS && + item.type === limitType.SERVICE_PROVIDER)} + selectedLimit={this.state.selectedLimit} + onCloseLimitEditor={() => this.onCloseLimitEditor()} + onSelectLimit={limit => this.onSelectLimit(limit)}/>} + + + {selectedTab === tabIds.VENDOR_LIMITS && + item.type === limitType.VENDOR)} + selectedLimit={this.state.selectedLimit} + onCloseLimitEditor={() => this.onCloseLimitEditor()} + onSelectLimit={limit => this.onSelectLimit(limit)}/>} + + {selectedTab !== tabIds.GENERAL ? + : +
// Render empty div to not break tabs + } +
+ + + {!this.state.selectedLimit && } + +
+ ); } submit() { - const {data: licenseKeyGroup, previousData: previousLicenseKeyGroup} = this.props; - this.props.onSubmit({licenseKeyGroup, previousLicenseKeyGroup}); + const {data: licenseKeyGroup, previousData: previousLicenseKeyGroup, formReady, onValidateForm, onSubmit} = this.props; + if (!formReady) { + onValidateForm(LKG_FORM_NAME); + } else { + onSubmit({licenseKeyGroup, previousLicenseKeyGroup}); + } } validateName(value) { @@ -160,27 +314,23 @@ class LicenseKeyGroupsEditorView extends React.Component { {isValid: false, errorText: i18n('License key group by the name \'' + value + '\' already exists. License key group name must be unique')}; } - validateOperationalScope(value) { - if (value && value.choices && value.choices.length > 0) { - if (value.choices[0] !== optionInputOther.OTHER) - { - return { - isValid: true, - errorText: '' - }; - } else { - if ( value.other ) { - return { - isValid: true, - errorText: '' - }; - } - } + onSelectLimit(limit) { + if (limit.id === this.state.selectedLimit) { + this.setState({selectedLimit: ''}); + return; } - return { - isValid: false, - errorText: 'Field is required' - }; + this.setState({selectedLimit: limit.id}); + this.props.onOpenLimitEditor(limit); + } + + onCloseLimitEditor() { + this.setState({selectedLimit: ''}); + this.props.onCloseLimitEditor(); + } + + onAddLimit() { + this.setState({selectedLimit: NEW_LIMIT_TEMP_ID}); + this.props.onOpenLimitEditor(); } } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js new file mode 100644 index 0000000000..7745a12fec --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js @@ -0,0 +1,57 @@ +/*! + * 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 {connect} from 'react-redux'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import {actionTypes as globalModalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; +import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; +import Limits from 'sdc-app/onboarding/licenseModel/limits/Limits.jsx'; + +import LicenseKeyGroupsActionHelper from './LicenseKeyGroupsActionHelper.js'; + +const mapStateToProps = ({licenseModel: {licenseKeyGroup: {licenseKeyGroupsEditor: {data}}, limitEditor}, currentScreen}) => { + let {props: {licenseModelId, version}} = currentScreen; + return { + parent: data, + limitEditor, + licenseModelId, + version + }; +}; + +const mapActionsToProps = (dispatch) => { + return { + onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}), + onSubmit: (limit, licenseKeyGroup, licenseModelId, version) => LicenseKeyGroupsActionHelper.submitLimit(dispatch, + { + limit, + licenseKeyGroup, + licenseModelId, + version}), + onDelete: ({limit, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit}) => dispatch({ + type: globalModalActionTypes.GLOBAL_MODAL_WARNING, + data:{ + msg: i18n(`Are you sure you want to delete ${limit.name}?`), + confirmationButtonText: i18n('Delete'), + title: i18n('Warning'), + onConfirmed: ()=> LicenseKeyGroupsActionHelper.deleteLimit(dispatch, {limit, licenseKeyGroup: parent, licenseModelId, version}).then(() => + selectedLimit === limit.id && onCloseLimitEditor() + ) + } + }) + }; +}; + +export default connect(mapStateToProps, mapActionsToProps)(Limits); \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js index e2c6c30e21..a8cf1eb0a1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js @@ -38,7 +38,7 @@ const mapStateToProps = ({licenseModel: {licenseKeyGroup, licenseModelEditor}}) const mapActionsToProps = (dispatch, {licenseModelId, version}) => { return { onAddLicenseKeyGroupClick: () => LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor(dispatch), - onEditLicenseKeyGroupClick: licenseKeyGroup => LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor(dispatch, {licenseKeyGroup}), + onEditLicenseKeyGroupClick: licenseKeyGroup => LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor(dispatch, {licenseKeyGroup, licenseModelId, version}), onDeleteLicenseKeyGroupClick: licenseKeyGroup => dispatch({ type: globalMoadlActions.GLOBAL_MODAL_WARNING, data:{ diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx index b8ccd68bce..1a7f2b0b5b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx @@ -21,7 +21,7 @@ import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; import LicenseKeyGroupsEditor from './LicenseKeyGroupsEditor.js'; -import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions, {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; import {optionsInputValues} from './LicenseKeyGroupsConstants'; class LicenseKeyGroupsListEditorView extends React.Component { @@ -61,7 +61,7 @@ class LicenseKeyGroupsListEditorView extends React.Component { isReadOnlyMode={isReadOnlyMode}> {this.filterList().map(licenseKeyGroup => (this.renderLicenseKeyGroupListItem(licenseKeyGroup, isReadOnlyMode)))} - + {`${isModalInEditMode ? i18n('Edit License Key Group') : i18n('Create New License Key Group')}`} @@ -122,16 +122,20 @@ class LicenseKeyGroupsListEditorView extends React.Component { } getOperationalScopes(operationalScope) { - if(operationalScope.choices.toString() === i18n(optionInputOther.OTHER) && operationalScope.other !== '') { + + if(operationalScope.choices && operationalScope.choices.toString() === i18n(optionInputOther.OTHER)) { return operationalScope.other; } - else { + else if (operationalScope.choices) { let allOpScopes = ''; for (let opScope of operationalScope.choices) { allOpScopes += allOpScopes === '' ? InputOptions.getTitleByName(optionsInputValues, opScope) : `, ${InputOptions.getTitleByName(optionsInputValues, opScope)}`; } return allOpScopes; - } + } + else { + return ''; + } } extractValue(item) { diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.js new file mode 100644 index 0000000000..d483383472 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.js @@ -0,0 +1,25 @@ +import {connect} from 'react-redux'; +import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; +import LimitEditor from './LimitEditor.jsx'; + +const mapStateToProps = ({licenseModel: {limitEditor}}) => { + + let {data, genericFieldInfo, formReady} = limitEditor; + let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); + + return { + data, + genericFieldInfo, + isFormValid, + formReady + }; +}; + +const mapActionsToProps = (dispatch) => { + return { + onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}), + onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName) + }; +}; + +export default connect(mapStateToProps, mapActionsToProps)(LimitEditor); \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx new file mode 100644 index 0000000000..f70f917725 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx @@ -0,0 +1,193 @@ +import React from 'react'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import Form from 'nfvo-components/input/validation/Form.jsx'; +import Input from 'nfvo-components/input/validation/Input.jsx'; +import GridSection from 'nfvo-components/grid/GridSection.jsx'; +import GridItem from 'nfvo-components/grid/GridItem.jsx'; +import {LIMITS_FORM_NAME, selectValues} from './LimitEditorConstants.js'; +import Button from 'sdc-ui/lib/react/Button.js'; +import Validator from 'nfvo-utils/Validator.js'; + +const LimitPropType = React.PropTypes.shape({ + id: React.PropTypes.string, + name: React.PropTypes.string, + description: React.PropTypes.string, + metric: React.PropTypes.string, + value: React.PropTypes.number, + aggregationFunction: React.PropTypes.string, + time: React.PropTypes.string, + unit: React.PropTypes.number +}); + +class LimitEditor extends React.Component { + static propTypes = { + data: LimitPropType, + limitsNames: React.PropTypes.object, + isReadOnlyMode: React.PropTypes.bool, + isFormValid: React.PropTypes.bool, + formReady: React.PropTypes.bool, + genericFieldInfo: React.PropTypes.object.isRequired, + onDataChanged: React.PropTypes.func.isRequired, + onSubmit: React.PropTypes.func.isRequired, + onValidateForm: React.PropTypes.func.isRequired, + onCancel: React.PropTypes.func.isRequired + }; + + componentDidUpdate(prevProps) { + if (this.props.formReady && this.props.formReady !== prevProps.formReady) { + this.submit(); + } + } + + render() { + let {data = {}, onDataChanged, isReadOnlyMode, genericFieldInfo, onCancel, isFormValid, formReady, onValidateForm} = this.props; + let {name, description, metric, value, aggregationFunction, time, unit} = data; + return ( +
+ {!data.id && +
+ {data.name ? data.name : i18n('NEW LIMIT')} +
} + { + genericFieldInfo && +
onValidateForm(LIMITS_FORM_NAME) } + labledButtons={false} + isReadOnlyMode={isReadOnlyMode} + className='limit-editor-form'> + + + onDataChanged({name}, LIMITS_FORM_NAME, {name: () => this.validateName(name)})} + label={i18n('Name')} + data-test-id='limit-editor-name' + value={name} + isValid={genericFieldInfo.name.isValid} + errorText={genericFieldInfo.name.errorText} + isRequired={true} + type='text'/> + + + onDataChanged({description}, LIMITS_FORM_NAME)} + label={i18n('Description')} + data-test-id='limit-editor-description' + value={description} + isValid={genericFieldInfo.description.isValid} + errorText={genericFieldInfo.description.errorText} + isRequired={false} + type='text'/> + + + { + const selectedIndex = e.target.selectedIndex; + const val = e.target.options[selectedIndex].value; + onDataChanged({metric: val}, LIMITS_FORM_NAME);} + } + isRequired={true} + value={metric} + label={i18n('Metric')} + data-test-id='limit-editor-metric' + isValid={genericFieldInfo.metric.isValid} + errorText={genericFieldInfo.metric.errorText} + groupClassName='bootstrap-input-options' + className='input-options-select' + type='select' > + {selectValues.METRIC.map(mtype => + )} + + + + onDataChanged({value}, LIMITS_FORM_NAME)} + label={i18n('Metric value')} + data-test-id='limit-editor-metric-value' + value={value} + isValid={genericFieldInfo.value.isValid} + errorText={genericFieldInfo.value.errorText} + isRequired={true} + type='number'/> + + + onDataChanged({unit}, LIMITS_FORM_NAME)} + label={i18n('Units')} + data-test-id='limit-editor-units' + value={unit} + isValid={genericFieldInfo.unit.isValid} + errorText={genericFieldInfo.unit.errorText} + isRequired={false} + type='number'/> + + + { + const selectedIndex = e.target.selectedIndex; + const val = e.target.options[selectedIndex].value; + onDataChanged({aggregationFunction: val}, LIMITS_FORM_NAME);} + } + value={aggregationFunction} + label={i18n('Aggregation Function')} + data-test-id='limit-editor-aggregation-function' + isValid={genericFieldInfo.aggregationFunction.isValid} + errorText={genericFieldInfo.aggregationFunction.errorText} + groupClassName='bootstrap-input-options' + className='input-options-select' + type='select' > + {selectValues.AGGREGATION_FUNCTION.map(mtype => + )} + + + + { + const selectedIndex = e.target.selectedIndex; + const val = e.target.options[selectedIndex].value; + onDataChanged({time: val}, LIMITS_FORM_NAME);} + } + value={time} + label={i18n('Time')} + data-test-id='limit-editor-time' + isValid={genericFieldInfo.time.isValid} + errorText={genericFieldInfo.time.errorText} + groupClassName='bootstrap-input-options' + className='input-options-select' + type='select' > + {selectValues.TIME.map(mtype => + )} + + + + + + + +
+ } +
+ ); + } + + validateName(value) { + const {data: {id}, limitsNames} = this.props; + const isExists = Validator.isItemNameAlreadyExistsInList({itemId: id, itemName: value, list: limitsNames}); + + return !isExists ? {isValid: true, errorText: ''} : + {isValid: false, errorText: i18n('Limit by the name \'' + value + '\' already exists. Limit name must be unique')}; + } + + submit() { + if (!this.props.formReady) { + this.props.onValidateForm(LIMITS_FORM_NAME); + } else { + this.props.onSubmit(); + } + } +} + +export default LimitEditor; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageNavigationReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js similarity index 63% rename from openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageNavigationReducer.js rename to openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js index 20d1f5dd18..09c64ada62 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageNavigationReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorActionHelper.js @@ -13,20 +13,18 @@ * or implied. See the License for the specific language governing * permissions and limitations under the License. */ -import {actionTypes} from './SoftwareProductComponentsImageConstants.js'; -export default (state = {}, action) => { - switch (action.type) { +import {actionTypes} from './LimitEditorConstants.js'; - case actionTypes.IMAGES_LIST_UPDATE: - if (action.componentId) { - return { - ...state, - [action.componentId] : (action.response && action.response.length > 0) - }; - } - return state; - default: - return state; + +const LimitEditorActionHelper = { + openLimitsEditor(dispatch, {limit}) { + dispatch({type: actionTypes.OPEN, limitItem: limit}); + }, + + closeLimitsEditor(dispatch) { + dispatch({type: actionTypes.CLOSE}); } }; + +export default LimitEditorActionHelper; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js new file mode 100644 index 0000000000..1bef286442 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js @@ -0,0 +1,52 @@ +import keyMirror from 'nfvo-utils/KeyMirror.js'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +// import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; + +export const actionTypes = keyMirror({ + OPEN: null, + CLOSE: null, + DATA_CHANGED: null, +}); + +export const LIMITS_FORM_NAME = 'LIMITSFORM'; + +export const selectValues = { + METRIC: [ + {enum: '', title: i18n('please select…')}, + {enum: 'Software_Instances_Count', title: 'Software Instances'}, + {enum: 'Core', title: 'Core'}, + {enum: 'CPU', title: 'CPU'}, + {enum: 'Trunks', title: 'Trunks'}, + {enum: 'User', title: 'User'}, + {enum: 'Subscribers', title: 'Subscribers'}, + {enum: 'Tenants', title: 'Tenants'}, + {enum: 'Tokens', title: 'Tokens'}, + {enum: 'Seats', title: 'Seats'}, + {enum: 'Units_TB', title: 'Units-TB'}, + {enum: 'Units_GB', title: 'Units-GB'}, + {enum: 'Units_MB', title: 'Units-MB'} + ], + AGGREGATION_FUNCTION: [ + {enum: '', title: i18n('please select…')}, + {enum: 'Peak', title: 'Peak'}, + {enum: 'Average', title: 'Average'} + ], + TIME: [ + {enum: '', title: i18n('please select…')}, + {enum: 'Hour', title: 'Hour'}, + {enum: 'Day', title: 'Day'}, + {enum: 'Month', title: 'Month'} + ] + +}; + +export const limitType = { + SERVICE_PROVIDER: 'ServiceProvider', + VENDOR: 'Vendor' +}; + +export const defaultState = { + LIMITS_EDITOR_DATA: {} +}; + +export const NEW_LIMIT_TEMP_ID = 'NEW_LIMIT_TEMP_ID'; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js new file mode 100644 index 0000000000..2499093af2 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditorReducer.js @@ -0,0 +1,70 @@ +/*! + * 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, LIMITS_FORM_NAME, defaultState} from './LimitEditorConstants.js'; + +export default (state = {}, action) => { + switch (action.type) { + case actionTypes.OPEN: + return { + ...state, + data: action.limitItem ? {...action.limitItem} : defaultState.LIMITS_EDITOR_DATA, + formReady: null, + formName: LIMITS_FORM_NAME, + genericFieldInfo: { + 'description' : { + isValid: true, + errorText: '', + validations: [{type: 'maxLength', data: 1000}] + }, + 'name' : { + isValid: true, + errorText: '', + validations: [{type: 'required', data: true}, {type: 'maxLength', data: 120}] + }, + 'metric' : { + isValid: true, + errorText: '', + validations: [{type: 'required', data: true}] + }, + 'value' : { + isValid: true, + errorText: '', + validations: [{type: 'required', data: true}, {type: 'numeric', data: true}, {type: 'minimum', data: 0}] + }, + 'unit' : { + isValid: true, + errorText: '', + validations: [{type: 'numeric', data: true}] + }, + 'aggregationFunction' : { + isValid: true, + errorText: '', + validations: [] + }, + 'time' : { + isValid: true, + errorText: '', + validations: [] + } + } + }; + case actionTypes.CLOSE: + return {}; + default: + return state; + } +}; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx new file mode 100644 index 0000000000..ec5a1dff72 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/Limits.jsx @@ -0,0 +1,108 @@ +/*! + * 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 React from 'react'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx'; +import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; +import LimitEditor from './LimitEditor.js'; +import {NEW_LIMIT_TEMP_ID, selectValues} from './LimitEditorConstants.js'; + +const LimitItem = ({isReadOnlyMode, limit, onDelete, onSelect}) => { + const {name, description, metric, value, aggregationFunction = '', time = ''} = limit; + const timeLabel = time ? `per ${time}` : ''; + return ( + +
+
{name}
+
+ +
+
{description}
+
+ +
+
{`${selectValues.METRIC.find(item => item.enum === metric).title} ${value} ${aggregationFunction} ${timeLabel}`}
+
+
+ ); +}; + +class Limits extends React.Component { + + + state = { + localFilter: '' + }; + + render() { + const {isReadOnlyMode = false, limitEditor, limitsList = [], onCloseLimitEditor, selectedLimit} = this.props; + let limitsNames = {}; + for (let i = 0; i < limitsList.length; i++) { + limitsNames[limitsList[i].name.toLowerCase()] = limitsList[i].id; + } + return ( +
+ + {this.props.selectedLimit === NEW_LIMIT_TEMP_ID && limitEditor.data && + this.submit()}/> + } + {limitsList.length === 0 && !limitEditor.data &&
{i18n('There are no limits')}
} + {limitsList.map(limit => +
+ this.delete(limit)} + onSelect={selectedLimit ? undefined : () => this.props.onSelectLimit(limit)} + clickable={!selectedLimit} + isReadOnlyMode={isReadOnlyMode} + limit={limit}/> + {limit.id === selectedLimit && limitEditor.data && this.submit()}/>} +
)} +
+ +
+ ); + } + + submit() { + let {onSubmit, onCloseLimitEditor, parent, limitEditor, licenseModelId, version, limitType} = this.props; + onSubmit({type: limitType, ...limitEditor.data}, parent, licenseModelId, version).then(() => onCloseLimitEditor()); + } + + delete(limit) { + let {onDelete, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit} = this.props; + onDelete({limit, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit}); + } + + filterList() { + let {limitsList = []} = this.props; + let {localFilter} = this.state; + if (localFilter.trim()) { + const filter = new RegExp(escape(localFilter), 'i'); + return limitsList.filter(({name = '', description = ''}) => { + return escape(name).match(filter) || escape(description).match(filter); + }); + } + else { + return limitsList; + } + } +} + +export default Limits; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitsServer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitsServer.js new file mode 100644 index 0000000000..1b8ecb9d94 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitsServer.js @@ -0,0 +1,46 @@ +/*! + * 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. + */ + +// items/{itemId}/users + +let list = [ + +]; + +export default { + fetch() { + return Promise.resolve({ + listCount: list.length, + results: list + }); + }, + + put(url, payload) { + // let {removedUsers, addedUsers} = payload; + // users = users.filter(user => !removedUsers.map(user => user.userId).includes(user.userId)).concat(addedUsers); + payload.id = Math.random() * (1000 - 1) + 1; + list.push(payload); + return Promise.resolve(); + }, + + destroy(url) { + const parts = url.split('/'); + const id = parts[parts.length - 1]; + let newList = list.filter(item => item.id !== id); + list = newList; + return Promise.resolve(); + } +}; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js index b5a27ed018..56b23384a7 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js @@ -34,9 +34,9 @@ export const actionTypes = keyMirror({ LM_DATA_CHANGED: null }); -export const selectedButton = keyMirror({ - VLM_LIST_VIEW: null, - NOT_IN_USE: null -}); +export const selectedButton = { + VLM_LIST_VIEW: 'VLM_LIST_VIEW', + NOT_IN_USE: 'NOT_IN_USE' +}; export const VLM_DESCRIPTION_FORM = 'VLMDEWSCRIPTIONFORM'; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx index d6c79ddb52..15f6c2d1bb 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx @@ -52,7 +52,7 @@ class LicenseModelOverviewView extends React.Component { licenseModelId: React.PropTypes.string, licensingDataList: React.PropTypes.array, modalHeader: React.PropTypes.string, - selectedTab: React.PropTypes.symbol, + selectedTab: React.PropTypes.string, onTabSelect: React.PropTypes.func, onCallVCAction: React.PropTypes.func, onClose: React.PropTypes.func @@ -67,14 +67,13 @@ class LicenseModelOverviewView extends React.Component {
-
{selectedInUse ? i18n('VLM List View') : i18n('Entities not in Use')}
- +
{ isDisplayModal && - + {`${i18n('Create New ')}${i18n(modalHeader)}`} diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx index 119008a849..ec05e37681 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx @@ -66,7 +66,8 @@ class VLMListView extends Component { this.updateCollapsable(event, licenseAgreement.id) }/> + onClick={event => this.updateCollapsable(event, licenseAgreement.id) } + isOrphan={!this.props.showInUse}/>
    {licenseAgreement.children && licenseAgreement.children.map(item => this.renderLicensingItem(item))} @@ -83,7 +84,8 @@ class VLMListView extends Component { this.updateCollapsable(event, featureGroup.id) }/> + onClick={event=> this.updateCollapsable(event, featureGroup.id) } + isOrphan={!this.props.showInUse}/> { showInUse &&
      @@ -99,7 +101,7 @@ class VLMListView extends Component { renderEntitlementPoolItem(entitlementPool) { return (
    • - +
    • ); } @@ -107,7 +109,7 @@ class VLMListView extends Component { renderLicenseKeyGroupItem(licenseKeyGroup) { return (
    • - +
    • ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/EntitlementPool.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/EntitlementPool.jsx index 94977b40d1..34d2ee6db5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/EntitlementPool.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/EntitlementPool.jsx @@ -15,7 +15,7 @@ */ import React, {Component} from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import {extractValue, extractUnits} from '../../entitlementPools/EntitlementPoolsConstants.js'; +import {extractUnits} from '../../entitlementPools/EntitlementPoolsConstants.js'; import ArrowCol from './listItemsComponents/ArrowCol.jsx'; import ItemInfo from './listItemsComponents/ItemInfo.jsx'; import IconCol from './listItemsComponents/IconCol.jsx'; @@ -23,31 +23,23 @@ import {AdditionalDataCol, AdditionalDataElement} from './listItemsComponents/Ad class EntitlementPool extends Component { render() { - let {epData: {name, description, manufacturerReferenceNumber}} = this.props; + let {epData: {name, description, thresholdValue, thresholdUnits}, isOrphan} = this.props; return ( -
      - - +
      + {!isOrphan && } + - - + value={`${thresholdValue} ${extractUnits(thresholdUnits)}`}/> + }
      ); } - getEntitlement() { - let {epData: {entitlementMetric, aggregationFunction, time, thresholdValue, thresholdUnits}} = this.props; - return `${extractValue(aggregationFunction)} ${extractValue(entitlementMetric)} per ${extractValue(time)} ${thresholdValue} ${extractUnits(thresholdUnits)}`; - } - } export default EntitlementPool; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/FeatureGroup.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/FeatureGroup.jsx index 8dbd46a29e..6d97dea358 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/FeatureGroup.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/FeatureGroup.jsx @@ -18,30 +18,41 @@ import {overviewEditorHeaders} from '../LicenseModelOverviewConstants.js'; import ArrowCol from './listItemsComponents/ArrowCol.jsx'; import ItemInfo from './listItemsComponents/ItemInfo.jsx'; import IconCol from './listItemsComponents/IconCol.jsx'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import {AdditionalDataCol, AdditionalDataElement} from './listItemsComponents/AdditionalDataCol.jsx'; class FeatureGroup extends Component { render() { - let {fgData: {name, description, children = []}, isCollapsed, onClick} = this.props; + let {fgData: {name, manufacturerReferenceNumber, description, children = []}, isCollapsed, onClick, isOrphan} = this.props; return ( -
      onClick(e)} className='vlm-list-item vlm-list-item-fg' data-test-id='vlm-list-item-fg'> - - +
      onClick(e)} + className={`vlm-list-item vlm-list-item-fg ${isOrphan ? 'orphan-list-item' : ''} ${children.length && !isOrphan ? 'clickable' : ''}`} data-test-id='vlm-list-item-fg'> + {!isOrphan && } +
      - Entitlement Pools: + {i18n('Entitlement Pools: ')} {`${children.filter(child => child.itemType === overviewEditorHeaders.ENTITLEMENT_POOL).length}`} + | - License Key Groups: + {i18n('License Key Groups: ')} {`${children.filter(child => child.itemType === overviewEditorHeaders.LICENSE_KEY_GROUP).length}`}
      + + +
      ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseAgreement.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseAgreement.jsx index dd4686d330..dfbbe20d69 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseAgreement.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseAgreement.jsx @@ -15,7 +15,7 @@ */ import React, {Component} from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import InputOptions, {other as optionInputOther} from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions, {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx'; import {optionsInputValues} from '../../licenseAgreement/LicenseAgreementConstants.js'; import ArrowCol from './listItemsComponents/ArrowCol.jsx'; import ItemInfo from './listItemsComponents/ItemInfo.jsx'; @@ -24,14 +24,17 @@ import {AdditionalDataCol, AdditionalDataElement} from './listItemsComponents/Ad class LicenseAgreement extends Component { render() { - let {laData: {name, description, licenseTerm, children = []}, isCollapsed, onClick} = this.props; + let {laData: {name, description, licenseTerm, children = []}, isCollapsed, onClick, isOrphan} = this.props; return ( -
      onClick(e)} className='vlm-list-item vlm-list-item-la' data-test-id='vlm-list-la-item'> - - +
      onClick(e)} + className={`vlm-list-item vlm-list-item-la ${isOrphan ? 'orphan-list-item' : ''} ${children.length && !isOrphan ? 'clickable' : ''} `} + data-test-id='vlm-list-la-item'> + {!isOrphan && } +
      - Feature Groups: {`${children.length}`} + {i18n('Feature Groups: ')}{`${children.length}`}
      diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseKeyGroup.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseKeyGroup.jsx index 9722b83336..b1036aae23 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseKeyGroup.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/LicenseKeyGroup.jsx @@ -23,17 +23,17 @@ import {AdditionalDataCol, AdditionalDataElement} from './listItemsComponents/Ad class LicenseKeyGroup extends Component { render() { - let {lkgData: {name, description, operationalScope, type}} = this.props; + let {lkgData: {name, description, operationalScope, type}, isOrphan} = this.props; return ( -
      - - +
      + {!isOrphan && } + - + value={getOperationalScopes(operationalScope)}/>} -
      +
      {text}
      ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx index 730ccb33f1..3d81aa5d5c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx @@ -15,19 +15,26 @@ */ import React from 'react'; import {selectedButton} from '../LicenseModelOverviewConstants.js'; +import Tabs from 'sdc-ui/lib/react/Tabs.js'; +import Tab from 'sdc-ui/lib/react/Tab.js'; +import i18n from 'nfvo-utils/i18n/i18n.js'; -function ListButtons ({onTabSelect, selectedInUse}) { +function ListButtons ({onTabSelect, selectedTab}) { return ( -
      -
      onTabSelect(selectedButton.VLM_LIST_VIEW)} - className={selectedInUse ? 'button-vlm-list-view vlm-list-icon selected' : 'button-vlm-list-view vlm-list-icon' } - data-test-id='vlm-overview-vlmlist-tab'>
      -
      onTabSelect(selectedButton.NOT_IN_USE)} - className={selectedInUse ? 'button-vlm-list-view entities-list-icon' : 'button-vlm-list-view entities-list-icon selected' } - data-test-id='vlm-overview-orphans-tab' > -
      - -
      + onTabSelect(tabId)} + activeTab={selectedTab} + className='overview-buttons-section' + type='header' > + + + ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js index 1d65ab9869..87559901b3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js @@ -13,9 +13,11 @@ * or implied. See the License for the specific language governing * permissions and limitations under the License. */ -import React from 'react'; +import React, {Component} from 'react'; import {connect} from 'react-redux'; +import Tooltip from 'react-bootstrap/lib/Tooltip.js'; +import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger.js'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import licenseModelOverviewActionHelper from '../licenseModelOverviewActionHelper.js'; import LicenseModelActionHelper from '../../LicenseModelActionHelper.js'; @@ -46,9 +48,7 @@ const mapActionsToProps = (dispatch) => { }; }; - - -export class VendorDataView extends React.Component { +export class VendorDataView extends Component { render() { let {data: {vendorName}, description, isReadOnlyMode} = this.props; return ( @@ -62,13 +62,16 @@ export class VendorDataView extends React.Component { ); } + renderDescription() { let {data: {description}, onVendorDescriptionEdit, isReadOnlyMode} = this.props; return ( -
      {if (!isReadOnlyMode) {onVendorDescriptionEdit(description);}}} className={!isReadOnlyMode ? 'vendor-description' : 'vendor-description-readonly'}> -
      - {description} -
      +
      {if (!isReadOnlyMode) {onVendorDescriptionEdit(description);}}} className={!isReadOnlyMode ? 'vendor-description' : 'vendor-description-readonly'}> + {this.renderOverlay( +
      + {description} +
      + )}
      ); } @@ -80,7 +83,21 @@ export class VendorDataView extends React.Component { ); } + renderOverlay(children) { + let {data: {description}, isReadOnlyMode} = this.props; + if (isReadOnlyMode) { + return ( + {description}} + delayShow={400}> + {children} + + ); + } + return children; + } + } export default connect(mapStateToProps, mapActionsToProps)(VendorDataView); - diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogItemDetails.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogItemDetails.jsx index 3b3e2fcf40..5939499ec5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogItemDetails.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogItemDetails.jsx @@ -49,7 +49,7 @@ const CatalogTileVendorName = ({vendorName, catalogItemTypeClass}) => { }; const CatalogTileItemName = ({name}) => ( - +
      {name}
      ); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js index 07d6c740e0..c9c95f359e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js @@ -36,7 +36,7 @@ function getActiveNavigationId(screen, componentId) { return activeItemId; } -const buildComponentNavigationBarGroups = ({componentId, meta, hasImages}) => { +const buildComponentNavigationBarGroups = ({componentId, meta}) => { const groups = ([ { id: navigationItems.GENERAL + '|' + componentId, @@ -67,7 +67,6 @@ const buildComponentNavigationBarGroups = ({componentId, meta, hasImages}) => { id: navigationItems.IMAGES + '|' + componentId, name: i18n('Images'), disabled: false, - hidden: (!hasImages), meta }, { id: navigationItems.PROCESS_DETAILS + '|' + componentId, @@ -85,7 +84,7 @@ const buildComponentNavigationBarGroups = ({componentId, meta, hasImages}) => { return groups; }; -const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, componentsList, mapOfExpandedIds, imagesNavigationList}) => { +const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, componentsList, mapOfExpandedIds}) => { const {softwareProductEditor: {data: currentSoftwareProduct = {}}} = softwareProduct; const {id, name, onboardingMethod} = currentSoftwareProduct; const groups = [{ @@ -148,8 +147,7 @@ const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, co name: displayName, meta, expanded: mapOfExpandedIds[navigationItems.COMPONENTS + '|' + id] === true && screen !== enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, - items: buildComponentNavigationBarGroups({componentId: id, meta, - hasImages : (onboardingMethod === onboardingMethodTypes.MANUAL || imagesNavigationList[id] === true)}) + items: buildComponentNavigationBarGroups({componentId: id, meta}) })) ] } @@ -193,12 +191,12 @@ function buildMeta({softwareProduct, componentId, softwareProductDependencies}) const mapStateToProps = ({softwareProduct}, {currentScreen: {screen, props: {componentId}}}) => { const {softwareProductEditor, softwareProductComponents, softwareProductDependencies} = softwareProduct; const {mapOfExpandedIds = []} = softwareProductEditor; - const {componentsList = [], images: {imagesNavigationList}} = softwareProductComponents; + const {componentsList = []} = softwareProductComponents; const meta = buildMeta({softwareProduct, componentId, softwareProductDependencies}); return { versionControllerProps: buildVersionControllerProps(softwareProduct), - navigationBarProps: buildNavigationBarProps({softwareProduct, meta, screen, componentId, componentsList, mapOfExpandedIds, imagesNavigationList}), + navigationBarProps: buildNavigationBarProps({softwareProduct, meta, screen, componentId, componentsList, mapOfExpandedIds}), meta }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index d6ba86ad6e..90a2bb8f2e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -251,8 +251,7 @@ const SoftwareProductActionHelper = { processAndValidateHeatCandidate(dispatch, {softwareProductId, version}){ return validateHeatCandidate(softwareProductId, version).then(response => { if (response.status === 'Success') { - let isFetchImageDetails = true; - SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version, isFetchImageDetails}); + SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}); SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}); } }); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js index 5248c4e8fd..977a76ac69 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js @@ -35,7 +35,6 @@ import SoftwareProductComponentsNICListReducer from './components/network/Softwa import SoftwareProductComponentsNICEditorReducer from './components/network/SoftwareProductComponentsNICEditorReducer.js'; import SoftwareProductComponentsImageListReducer from './components/images/SoftwareProductComponentsImageListReducer.js'; import SoftwareProductComponentsImageEditorReducer from './components/images/SoftwareProductComponentsImageEditorReducer.js'; -import SoftwareProductComponentsImageNavigationReducer from './components/images/SoftwareProductComponentsImageNavigationReducer.js'; import SoftwareProductComponentsNICCreationReducer from './components/network/NICCreation/NICCreationReducer.js'; import SoftwareProductComponentsMonitoringReducer from './components/monitoring/SoftwareProductComponentsMonitoringReducer.js'; import SoftwareProductComponentsComputeFlavorListReducer from './components/compute/computeComponents/computeFlavor/ComputeFlavorListReducer.js'; @@ -83,7 +82,6 @@ export default combineReducers({ }), images: combineReducers({ imagesList: SoftwareProductComponentsImageListReducer, - imagesNavigationList: SoftwareProductComponentsImageNavigationReducer, imageEditor: createPlainDataReducer(createComposedJSONSchemaReducer(IMAGE_QUESTIONNAIRE, SoftwareProductComponentsImageEditorReducer)) }), computeFlavor: combineReducers({ diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupActionHelper.js index 53143647a3..87953bb8aa 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupActionHelper.js @@ -17,8 +17,8 @@ import {actionTypes} from './HeatSetupConstants.js'; import isEqual from 'lodash/isEqual.js'; import cloneDeep from 'lodash/cloneDeep.js'; import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js'; -import i18n from 'nfvo-utils/i18n/i18n.js'; -import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; +// import i18n from 'nfvo-utils/i18n/i18n.js'; +// import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; export default { @@ -56,7 +56,11 @@ export default { dispatch({type: actionTypes.ADD_ALL_UNASSIGNED_TO_ARTIFACTS}); }, - heatSetupLeaveConfirmation(dispatch, {softwareProductId, heatSetup, heatSetupCache}) { + heatSetupLeaveConfirmation() { + return Promise.resolve(); + } + + /*heatSetupLeaveConfirmation(dispatch, {softwareProductId, heatSetup, heatSetupCache}) { return new Promise((resolve, reject) => { if (isEqual({...heatSetup, softwareProductId}, heatSetupCache)) { resolve(); @@ -73,5 +77,5 @@ export default { }); } }); - } + }*/ }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsActionHelper.js index 71dc8325ad..8085c875f4 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsActionHelper.js @@ -18,7 +18,6 @@ import Configuration from 'sdc-app/config/Configuration.js'; import {actionTypes, COMPONENTS_QUESTIONNAIRE} from './SoftwareProductComponentsConstants.js'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; -import SoftwareProductComponentsImageActionHelper from './images/SoftwareProductComponentsImageActionHelper.js'; import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; function baseUrl(softwareProductId, version) { @@ -69,32 +68,12 @@ function postSoftwareProductComponent(softwareProductId, vspComponent, version) const SoftwareProductComponentsActionHelper = { - fetchSoftwareProductComponents(dispatch, {softwareProductId, version, isFetchImageDetails = false}) { + fetchSoftwareProductComponents(dispatch, {softwareProductId, version}) { return fetchSoftwareProductComponents(softwareProductId, version).then(response => { - let componentImagesCalls = []; - if (isFetchImageDetails && response.listCount) { - response.results.map(component => { - let componentId = component.id; - componentImagesCalls[componentImagesCalls.length] = - SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, { - softwareProductId, - componentId, - version - }); - - }); - return Promise.all(componentImagesCalls).then(() => { - dispatch({ - type: actionTypes.COMPONENTS_LIST_UPDATE, - componentsList: response.results - }); - }); - } else { - dispatch({ - type: actionTypes.COMPONENTS_LIST_UPDATE, - componentsList: response.results - }); - } + dispatch({ + type: actionTypes.COMPONENTS_LIST_UPDATE, + componentsList: response.results + }); }); }, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageList.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageList.js index 86c4e072d4..fb3bd35eb2 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageList.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageList.js @@ -77,9 +77,10 @@ const mapActionsToProps = (dispatch, {softwareProductId, componentId}) => { image, isReadOnlyMode, softwareProductId, componentId, version, modalClassName: 'image-modal-edit'} ); }, - onSubmit: ({qdata}) => { return SoftwareProductComponentsActionHelper.updateSoftwareProductComponentQuestionnaire(dispatch, + onSubmit: (version, qdata) => { return SoftwareProductComponentsActionHelper.updateSoftwareProductComponentQuestionnaire(dispatch, {softwareProductId, vspComponentId: componentId, + version, qdata}); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageListView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageListView.jsx index ccf5b9d6b1..54def08fc1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageListView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageListView.jsx @@ -125,8 +125,8 @@ class SoftwareProductComponentsImageListView extends React.Component { } save() { - let {onSubmit, qdata} = this.props; - return onSubmit({qdata}); + let {onSubmit, qdata, version} = this.props; + return onSubmit(version, qdata); } } export default SoftwareProductComponentsImageListView; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx index 2ad48ec84b..36c1728ef3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringView.jsx @@ -96,7 +96,7 @@ class SoftwareProductComponentsMonitoringView extends Component { - + ); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkListView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkListView.jsx index 5a159b4a87..4d460c722d 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkListView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkListView.jsx @@ -122,7 +122,7 @@ class SoftwareProductComponentsNetworkView extends React.Component {
      {i18n('Purpose of NIC')}
      -
      {description ? description : i18n('N/A')}
      + {description &&
      {description}
      }
      {!isManual &&
      {i18n('Network')}
      diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorage.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorage.js index 18a3b1e8ff..7149adbbfb 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorage.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorage.js @@ -33,14 +33,15 @@ const mapStateToProps = ({softwareProduct}) => { qdata, isReadOnlyMode, qGenericFieldInfo, - dataMap + dataMap, + version: currentVSP.version }; }; -const mapActionToProps = (dispatch, {softwareProductId, version, componentId}) => { +const mapActionToProps = (dispatch, {softwareProductId, componentId}) => { return { onQDataChanged: (deltaData) => ValidationHelper.qDataChanged(dispatch, {deltaData, qName: COMPONENTS_QUESTIONNAIRE}), - onSubmit: ({componentData, qdata}) => { return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(dispatch, + onSubmit: ({componentData, qdata, version}) => { return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(dispatch, {softwareProductId, version, vspComponentId: componentId, componentData, qdata}); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx index 28bdf8e5e5..00df21bb59 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/components/storage/SoftwareProductComponentStorageView.jsx @@ -162,7 +162,7 @@ class SoftwareProductComponentStorageView extends React.Component { }; render() { - let {onQDataChanged, dataMap, qGenericFieldInfo, isReadOnlyMode, onSubmit, qdata} = this.props; + let {onQDataChanged, dataMap, qGenericFieldInfo, isReadOnlyMode, onSubmit, qdata, version} = this.props; return(
      @@ -170,7 +170,7 @@ class SoftwareProductComponentStorageView extends React.Component { ref={form => this.form = form } isValid={true} formReady={null} - onSubmit={() => onSubmit({qdata})} + onSubmit={() => onSubmit({qdata, version})} className='component-questionnaire-validation-form' isReadOnlyMode={isReadOnlyMode} hasButtons={false}> @@ -182,8 +182,9 @@ class SoftwareProductComponentStorageView extends React.Component { ); } - save(){ - return this.form.handleFormSubmit(new Event('dummy')); + save(){ + const {componentData, qdata, onSubmit, version} = this.props; + return onSubmit({componentData, qdata, version}); } } diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js index 19e2d5b0db..3b973c65cd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js @@ -27,7 +27,7 @@ export const mapStateToProps = ({finalizedLicenseModelList, softwareProductList, let VSPNames = {}; for (let i = 0; i < softwareProductList.length; i++) { - VSPNames[softwareProductList[i].name] = softwareProductList[i].id; + VSPNames[softwareProductList[i].name.toLowerCase()] = softwareProductList[i].id; } return { diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/dependencies/SoftwareProductDependenciesView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/dependencies/SoftwareProductDependenciesView.jsx index 2e0cd340de..a427470a4f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/dependencies/SoftwareProductDependenciesView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/dependencies/SoftwareProductDependenciesView.jsx @@ -63,14 +63,15 @@ export default class SoftwareProductDependenciesView extends React.Component { numOfIcons={2} isReadOnlyMode={isReadOnlyMode} onAdd={canAdd ? onAddDependency : undefined} - onAddItem={i18n('Add Rule')}> + onAddItem={i18n('Add Rule')}> {softwareProductDependencies.map(dependency => ( onDataChanged(softwareProductDependencies.filter(currentDependency => currentDependency.id !== dependency.id))} overlayMsg={i18n('There is a loop between selections')} hasError={dependency.hasCycle} - hasErrorIndication> + hasErrorIndication + showDelete={dependency.id !== 'fake' || dependency.hasCycle !== undefined}> { - DFNames[deployment.model] = deployment.id; + DFNames[deployment.model.toLowerCase()] = deployment.id; }); return { diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx index 98dd7730bd..e4caf92c21 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx @@ -19,7 +19,7 @@ import i18n from 'nfvo-utils/i18n/i18n.js'; import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js'; import Form from 'nfvo-components/input/validation/Form.jsx'; import Input from 'nfvo-components/input/validation/Input.jsx'; -import InputOptions from 'nfvo-components/input/inputOptions/InputOptions.jsx'; +import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; import SoftwareProductCategoriesHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductCategoriesHelper.js'; diff --git a/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js b/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js index 14df58e4c2..a28245e8bc 100644 --- a/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js +++ b/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js @@ -19,9 +19,7 @@ import {overviewEditorHeaders} from 'sdc-app/onboarding/licenseModel/overview/Li Factory.define('EntitlementPoolBaseFactory') .attrs({ name: 'EntitlementPoolName', - description: 'description', - entitlementMetric: {'choice': 'User', 'other': ''}, - manufacturerReferenceNumber: '123' + description: 'description' }); Factory.define('EntitlementPoolExtendedBaseFactory') @@ -29,10 +27,10 @@ Factory.define('EntitlementPoolExtendedBaseFactory') .attrs({ thresholdValue: 75, thresholdUnits: '%', - increments: 'string', - aggregationFunction: {'choice': 'Average', 'other': ''}, - operationalScope: {'choices': ['Other'], 'other': 'blabla'}, - time: {'choice': 'Hour', 'other': ''} + increments: 'string', + operationalScope: {'choices': ['Other'], 'other': 'blabla'}, + startDate: (new Date()).getTime(), + expiryDate: (new Date()).getTime() }); export const EntitlementPoolListItemFactory = new Factory() diff --git a/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js b/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js new file mode 100644 index 0000000000..a08e7e6355 --- /dev/null +++ b/openecomp-ui/test-utils/factories/licenseModel/LimitFactories.js @@ -0,0 +1,38 @@ +/*! + * 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 {Factory} from 'rosie'; +import {limitType} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; + +Factory.define('LimitBaseFactory') + .attrs({ + name: 'SpLimit1', + type: limitType.SERVICE_PROVIDER, + description: 'fgfg', + metric: 'CPU', + value: 45, + unit: 55, + aggregationFunction: 'Peak', + time: 'Day' + }); + +export const LimitPostFactory = new Factory() + .extend('LimitBaseFactory'); + +export const LimitItemFactory = new Factory() + .extend('LimitBaseFactory') + .extend(IdMixin); diff --git a/openecomp-ui/test/licenseModel/entitlementPools/test.js b/openecomp-ui/test/licenseModel/entitlementPools/test.js index 15e1deecd6..911fb011f4 100644 --- a/openecomp-ui/test/licenseModel/entitlementPools/test.js +++ b/openecomp-ui/test/licenseModel/entitlementPools/test.js @@ -20,6 +20,7 @@ import {storeCreator} from 'sdc-app/AppStore.js'; import EntitlementPoolsActionHelper from 'sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js'; import {EntitlementPoolStoreFactory, EntitlementPoolPostFactory} from 'test-utils/factories/licenseModel/EntitlementPoolFactories.js'; import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js'; +import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js'; describe('Entitlement Pools Module Tests', function () { @@ -162,4 +163,173 @@ describe('Entitlement Pools Module Tests', function () { }); }); + it('Load Limits List', () => { + + const limitsList = LimitItemFactory.buildList(3); + deepFreeze(limitsList); + const store = storeCreator(); + deepFreeze(store.getState()); + + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', limitsList); + const entitlementPool = EntitlementPoolStoreFactory.build(); + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: limitsList}; + }); + + return EntitlementPoolsActionHelper.fetchLimits(store.dispatch, {licenseModelId: LICENSE_MODEL_ID, version, entitlementPool}).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + + it('Add Limit', () => { + + const store = storeCreator(); + deepFreeze(store.getState()); + + const limitToAdd = LimitPostFactory.build(); + + deepFreeze(limitToAdd); + + const LimitIdFromResponse = 'ADDED_ID'; + const limitAddedItem = {...limitToAdd, id: LimitIdFromResponse}; + deepFreeze(limitAddedItem); + const entitlementPool = EntitlementPoolStoreFactory.build(); + + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [limitAddedItem]); + + mockRest.addHandler('post', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); + expect(data).toEqual(limitToAdd); + expect(options).toEqual(undefined); + return { + returnCode: 'OK', + value: LimitIdFromResponse + }; + }); + + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: [limitAddedItem]}; + }); + + return EntitlementPoolsActionHelper.submitLimit(store.dispatch, + { + licenseModelId: LICENSE_MODEL_ID, + version, + entitlementPool, + limit: limitToAdd + } + ).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + + + it('Delete Limit', () => { + + const limitsList = LimitItemFactory.buildList(1); + deepFreeze(limitsList); + + const store = storeCreator({ + licenseModel: { + entitlementPool: { + entitlementPoolEditor: { + limitsList + } + } + } + }); + deepFreeze(store.getState()); + + const entitlementPool = EntitlementPoolStoreFactory.build(); + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', []); + + mockRest.addHandler('destroy', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits/${limitsList[0].id}`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return { + results: { + returnCode: 'OK' + } + }; + }); + + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: []}; + }); + + return EntitlementPoolsActionHelper.deleteLimit(store.dispatch, { + licenseModelId: LICENSE_MODEL_ID, + version, + entitlementPool, + limit: limitsList[0] + }).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + + it('Update Limit', () => { + + const limitsList = LimitItemFactory.buildList(1); + deepFreeze(limitsList); + const entitlementPool = EntitlementPoolStoreFactory.build(); + const store = storeCreator({ + licenseModel: { + entitlementPool: { + entitlementPoolEditor: { + limitsList + } + } + } + }); + + deepFreeze(store.getState()); + + + const previousData = limitsList[0]; + deepFreeze(previousData); + const limitId = limitsList[0].id; + + const updatedLimit = {...previousData, name: 'updatedLimit'}; + deepFreeze(updatedLimit); + const updatedLimitForPut = {...updatedLimit, id: undefined}; + + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.entitlementPool.entitlementPoolEditor.limitsList', [updatedLimit]); + + + mockRest.addHandler('put', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits/${limitId}`); + expect(data).toEqual(updatedLimitForPut); + expect(options).toEqual(undefined); + return {returnCode: 'OK'}; + }); + + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/entitlement-pools/${entitlementPool.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: [updatedLimit]}; + }); + + return EntitlementPoolsActionHelper.submitLimit(store.dispatch, + { + licenseModelId: LICENSE_MODEL_ID, + version, + entitlementPool, + limit: updatedLimit + } + ).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + }); diff --git a/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js b/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js index dd09030f4f..77fcc00694 100644 --- a/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js +++ b/openecomp-ui/test/licenseModel/licenseKeyGroups/test.js @@ -21,6 +21,7 @@ import {LicenseKeyGroupStoreFactory, LicenseKeyGroupPostFactory} from 'test-util import LicenseKeyGroupsActionHelper from 'sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js'; import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js'; +import {LimitItemFactory, LimitPostFactory} from 'test-utils/factories/licenseModel/LimitFactories.js'; describe('License Key Groups Module Tests', function () { @@ -157,4 +158,172 @@ describe('License Key Groups Module Tests', function () { }); }); + it('Load Limits List', () => { + + const limitsList = LimitItemFactory.buildList(3); + deepFreeze(limitsList); + const store = storeCreator(); + deepFreeze(store.getState()); + + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', limitsList); + const licenseKeyGroup = LicenseKeyGroupStoreFactory.build(); + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: limitsList}; + }); + + return LicenseKeyGroupsActionHelper.fetchLimits(store.dispatch, {licenseModelId: LICENSE_MODEL_ID, version, licenseKeyGroup}).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + + it('Add Limit', () => { + + const store = storeCreator(); + deepFreeze(store.getState()); + + const limitToAdd = LimitPostFactory.build(); + + deepFreeze(limitToAdd); + + const LimitIdFromResponse = 'ADDED_ID'; + const limitAddedItem = {...limitToAdd, id: LimitIdFromResponse}; + deepFreeze(limitAddedItem); + const licenseKeyGroup = LicenseKeyGroupStoreFactory.build(); + + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [limitAddedItem]); + + mockRest.addHandler('post', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); + expect(data).toEqual(limitToAdd); + expect(options).toEqual(undefined); + return { + returnCode: 'OK', + value: LimitIdFromResponse + }; + }); + + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: [limitAddedItem]}; + }); + + return LicenseKeyGroupsActionHelper.submitLimit(store.dispatch, + { + licenseModelId: LICENSE_MODEL_ID, + version, + licenseKeyGroup, + limit: limitToAdd + } + ).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + + it('Delete Limit', () => { + + const limitsList = LimitItemFactory.buildList(1); + deepFreeze(limitsList); + + const store = storeCreator({ + licenseModel: { + entitlementPool: { + entitlementPoolEditor: { + limitsList + } + } + } + }); + deepFreeze(store.getState()); + + const licenseKeyGroup = LicenseKeyGroupStoreFactory.build(); + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', []); + + mockRest.addHandler('destroy', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits/${limitsList[0].id}`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return { + results: { + returnCode: 'OK' + } + }; + }); + + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: []}; + }); + + return LicenseKeyGroupsActionHelper.deleteLimit(store.dispatch, { + licenseModelId: LICENSE_MODEL_ID, + version, + licenseKeyGroup, + limit: limitsList[0] + }).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + + it('Update Limit', () => { + + const limitsList = LimitItemFactory.buildList(1); + deepFreeze(limitsList); + const licenseKeyGroup = LicenseKeyGroupStoreFactory.build(); + const store = storeCreator({ + licenseModel: { + licenseKeyGroup: { + licenseKeyGroupsEditor: { + limitsList + } + } + } + }); + + deepFreeze(store.getState()); + + + const previousData = limitsList[0]; + deepFreeze(previousData); + const limitId = limitsList[0].id; + + const updatedLimit = {...previousData, name: 'updatedLimit'}; + deepFreeze(updatedLimit); + const updatedLimitForPut = {...updatedLimit, id: undefined}; + + const expectedStore = cloneAndSet(store.getState(), 'licenseModel.licenseKeyGroup.licenseKeyGroupsEditor.limitsList', [updatedLimit]); + + + mockRest.addHandler('put', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits/${limitId}`); + expect(data).toEqual(updatedLimitForPut); + expect(options).toEqual(undefined); + return {returnCode: 'OK'}; + }); + + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { + expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${LICENSE_MODEL_ID}/versions/${version.id}/license-key-groups/${licenseKeyGroup.id}/limits`); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: [updatedLimit]}; + }); + + return LicenseKeyGroupsActionHelper.submitLimit(store.dispatch, + { + licenseModelId: LICENSE_MODEL_ID, + version, + licenseKeyGroup, + limit: updatedLimit + } + ).then(() => { + expect(store.getState()).toEqual(expectedStore); + }); + }); + }); diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb new file mode 100644 index 0000000000..c7f408f294 --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb @@ -0,0 +1 @@ +normal['version'] = "1.1.0" -- 2.16.6