summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdeliveries/pom.xml2
-rwxr-xr-xepsdk-app-onap/pom.xml7
-rwxr-xr-xepsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties2
-rw-r--r--epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp78
-rw-r--r--epsdk-app-onap/version.properties2
-rw-r--r--features.properties.md4
-rw-r--r--pom.xml4
-rw-r--r--releases/6.0.2-container.yaml8
-rw-r--r--version.properties2
-rwxr-xr-xvid-app-common/pom.xml2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java13
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/PreLoadController.java34
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java47
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/PermissionProperties.kt34
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/Role.java33
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java25
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java21
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java64
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java (renamed from vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java)45
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java63
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt16
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java35
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java6
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java177
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java14
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java8
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/model/ServiceInstanceSearchResultTest.java188
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java41
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByOwningEntityTest.java90
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java114
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceTypeTest.java111
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorFactoryTest.java77
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorsComposerTest.java110
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java30
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json2
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json2
-rwxr-xr-xvid-app-common/version.properties2
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/execute/setup/SetupCDTest.java3
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java16
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOBaseDeleteWithCloudConfiguration.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarte5G.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarteOldViewEdit.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceAlacarte.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2AlacarteService.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVNFInstanceOnlyRelatedServiceInstance.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteE2E.java3
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteServiceCypress2.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfGroup.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfVlanTagging.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSODeleteALaCarteService.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.java11
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByRequestId.java11
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByServiceInstanceId.java13
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Features.java2
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java20
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java2
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java3
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java8
-rw-r--r--vid-automation/src/main/resources/NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json2
-rw-r--r--vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarte.json2
-rw-r--r--vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteForTemplate.json2
-rw-r--r--vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnf.json2
-rw-r--r--vid-automation/src/main/resources/registration_to_simulator/add_network/mso_add_network_error.json2
-rw-r--r--vid-automation/src/main/resources/registration_to_simulator/create_new_instance/deploy/mso_create_svc_instance.json2
-rw-r--r--vid-automation/src/main/resources/registration_to_simulator/search_for_service_instance/mso_instance_orch_status_req.json4
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java33
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java23
-rw-r--r--vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json2
-rw-r--r--vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json2
-rw-r--r--vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json2
-rw-r--r--vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json2
-rw-r--r--vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json2
-rw-r--r--vid-automation/src/test/resources/VnfGroup/vnfGroupCreate1VnfGroupAndDelete2VnfGroupsRequest.json2
-rw-r--r--vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json2
-rw-r--r--vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json3
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarte.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnfGroup.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json2
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/vidRequestDeleteServiceWithVnf.json2
-rw-r--r--vid-automation/src/test/resources/registration_to_simulator/body_jsons/mso_request_delete_or_unassign_service_instance.json2
-rw-r--r--vid-automation/src/test/resources/viewEdit/ServiceTreeWithMultipleChildren_serviceInstance_withUpdatedLatestVersion.json2
-rw-r--r--vid-automation/src/test/resources/vrf/vrfServiceCreateRequest.json2
-rw-r--r--vid-ext-services-simulator/src/main/resources/download_files/service-PASQUALEVmxVpeBvService488-csar-annotations.zipbin83322 -> 0 bytes
-rw-r--r--vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar.zipbin67068 -> 0 bytes
-rw-r--r--vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar_ecomp_false6.zipbin67712 -> 0 bytes
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts95
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts2
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts4
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts92
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts4
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts8
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts40
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts2
-rw-r--r--vid-webpack-master/cypress/pipeline/group1.txt2
-rw-r--r--vid-webpack-master/cypress/pipeline/group2.txt19
-rw-r--r--vid-webpack-master/cypress/pipeline/run_group2.sh13
-rw-r--r--vid-webpack-master/cypress/support/application/application.session.actions.ts35
-rw-r--r--vid-webpack-master/cypress/support/index.js5
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json2
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json3
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json2
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts52
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts37
-rw-r--r--vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json3
-rw-r--r--vid-webpack-master/package.cypress.json3
-rwxr-xr-xvid-webpack-master/package.json3
-rw-r--r--vid-webpack-master/pom.xml2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/basic.model.info.ts3
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts8
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts12
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts6
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts15
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts18
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts14
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts12
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vpn/vpn.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts12
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts15
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts243
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts54
-rw-r--r--vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.html5
-rw-r--r--vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.scss1
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts5
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts29
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts92
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts3
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts4
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/generic-form.component.html2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.html15
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.scss23
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.ts41
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.model.ts30
-rw-r--r--vid-webpack-master/src/app/shared/components/messageModal/message-modal.model.ts15
-rw-r--r--vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts56
-rw-r--r--vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.ts39
-rw-r--r--vid-webpack-master/src/app/shared/models/formControlModels/checkboxFormControl.model.ts4
-rw-r--r--vid-webpack-master/src/app/shared/models/formControlModels/formControl.model.ts1
-rw-r--r--vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts5
-rw-r--r--vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts4
-rw-r--r--vid-webpack-master/src/app/shared/shared.module.ts15
-rw-r--r--vid-webpack-master/src/app/shared/utils/constants.ts1
-rw-r--r--vid-webpack-master/src/styles.scss4
161 files changed, 1778 insertions, 1253 deletions
diff --git a/deliveries/pom.xml b/deliveries/pom.xml
index 5b467d6eb..66e79086d 100755
--- a/deliveries/pom.xml
+++ b/deliveries/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.vid</groupId>
<artifactId>vid-parent</artifactId>
- <version>6.0.2-SNAPSHOT</version>
+ <version>6.0.3-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
diff --git a/epsdk-app-onap/pom.xml b/epsdk-app-onap/pom.xml
index 0b9b60996..a7ce6b492 100755
--- a/epsdk-app-onap/pom.xml
+++ b/epsdk-app-onap/pom.xml
@@ -8,7 +8,7 @@
the Portal team. -->
<groupId>org.onap.vid</groupId>
<artifactId>epsdk-app-onap</artifactId>
- <version>6.0.2-SNAPSHOT</version>
+ <version>6.0.3-SNAPSHOT</version>
<packaging>war</packaging>
<name>ECOMP SDK Webapp for OpenSource</name>
<description>ECOMP SDK Web Application for public release</description>
@@ -24,7 +24,8 @@
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <epsdk.version>2.5.0</epsdk.version>
+ <epsdk.version>2.6.0</epsdk.version>
+ <epsdk.overlay.version>2.5.0</epsdk.overlay.version>
<jackson.version>2.10.1</jackson.version>
<jackson.databind.version>2.10.1</jackson.databind.version>
<springframework.version>5.2.3.RELEASE</springframework.version>
@@ -269,7 +270,7 @@
<dependency>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-app-overlay</artifactId>
- <version>${epsdk.version}</version>
+ <version>${epsdk.overlay.version}</version>
<type>war</type>
</dependency>
<dependency>
diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
index 393327d85..41e50c362 100755
--- a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
+++ b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
@@ -135,7 +135,7 @@ mso.restapi.cloudResourcesRequestsApiRoot=/cloudResourcesRequests/v1
mso.restapi.operationalEnvironment.cloudResourcesRequests.status=${mso.restapi.cloudResourcesRequestsApiRoot}?requestId=<request_id>
mso.displayTestAPIOnScreen=true
-mso.defaultTestAPI=VNF_API
+mso.defaultTestAPI=GR_API
mso.maxOpenedInstantiationRequests=200
mso.asyncPollingIntervalSeconds=1
refreshTimeInstantiationDashboard=10
diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp b/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp
index 50a10d607..4571f34d8 100644
--- a/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp
+++ b/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp
@@ -20,13 +20,12 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page isELIgnored="false"%>
-<%@ page import="org.onap.portalsdk.core.util.SystemProperties"%>
-<%@ page import="org.onap.portalsdk.core.onboarding.util.PortalApiProperties"%>
<%@ page import="org.onap.portalsdk.core.onboarding.util.PortalApiConstants"%>
-<%@ page import="org.onap.portalsdk.core.domain.MenuData"%>
+<%@ page import="org.onap.portalsdk.core.onboarding.util.PortalApiProperties"%>
+<%@ page import="org.onap.portalsdk.core.util.SystemProperties"%>
<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
-<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
+<link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css">
<%--<script src= "app/fusion/external/ebz/angular_js/angular.js"></script> --%>
@@ -688,55 +687,6 @@
"url": ""
},
{
- "menuId": 90,
- "column": 1,
- "text": "Google",
- "parentMenuId": 1,
- "url": "http://google.com"
- },
- {
- "menuId": 91,
- "column": 1,
- "text": "Mike Little's Coffee Cup",
- "parentMenuId": 2,
- "url": "http://coffee.com"
- },
- {
- "menuId": 92,
- "column": 2,
- "text": "Andy and his Astrophotgraphy",
- "parentMenuId": 3,
- "url": "http://nightskypix.com"
- },
- {
- "menuId": 93,
- "column": 1,
- "text": "JSONLint",
- "parentMenuId": 4,
- "url": "http://http://jsonlint.com"
- },
- {
- "menuId": 96,
- "column": 3,
- "text": "3rd Level App1c R200",
- "parentMenuId": 4,
- "url": "http://app1c.com"
- },
- {
- "menuId": 97,
- "column": 1,
- "text": "3rd Level App4b R16",
- "parentMenuId": 5,
- "url": "http://app4b.com"
- },
- {
- "menuId": 98,
- "column": 2,
- "text": "3rd Level App2b R16",
- "parentMenuId": 5,
- "url": "http://app2b.com"
- },
- {
"menuId": 99,
"column": 1,
"text": "Favorites",
@@ -748,11 +698,20 @@
$scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
// $log.debug(JSON.stringify($scope.jsonMenuData));
}
+
+ LeftMenuService.getLeftMenu().then(function (response) {
+ var menu = {
+ parentList: JSON.parse(response.data),
+ childItemList: JSON.parse(response.data2)
+ };
+
+ try {
+
var childItemList="";
var parentList = "";
try{
- childItemList = ${menu.childItemList};
- parentList = ${menu.parentList};
+ childItemList = menu.childItemList;
+ parentList = menu.parentList;
}catch(err){
console.log("ebz_header: failed to get child/parent lists", err);
}
@@ -819,7 +778,14 @@
$timeout(function() {
detectScrollEvent();
}, 800);
-
+
+ } catch (e) {
+ console.log("error happened while trying to get app menu " + e);
+ }
+ }, function (error) {
+ console.log('getLeftMenu failed', error);
+ });
+
});
app.filter("ellipsis", function(){
diff --git a/epsdk-app-onap/version.properties b/epsdk-app-onap/version.properties
index 819a8c054..ce5339b64 100644
--- a/epsdk-app-onap/version.properties
+++ b/epsdk-app-onap/version.properties
@@ -4,7 +4,7 @@
major=6
minor=0
-patch=2
+patch=3
base_version=${major}.${minor}.${patch}
diff --git a/features.properties.md b/features.properties.md
index f5e1113b9..ce153b869 100644
--- a/features.properties.md
+++ b/features.properties.md
@@ -199,6 +199,9 @@
* FLAG_2004_INSTANTIATION_TEMPLATES_POPUP
Enables a designated Templates selection modal, accessible when creating a new instance through "Browse SDC".
+* FLAG_2006_VFM_SDNC_PRELOAD_FILES
+ Enables upload files when SDNC preload checkbox is checked
+
* FLAG_2002_UNLIMITED_MAX
when flag is true and max_instances is not declare than user can add unlimited VND, NETWORK, VFMODULE,
User can duplicate up to 10 record in single time.
@@ -207,4 +210,3 @@
* FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO
On the "audit info" modal (available on Instantiation Status page), shows a link navigating to
the read-only RETRY page with more audit info.
- \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index adfeba410..70fc41c99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.vid</groupId>
<artifactId>vid-parent</artifactId>
- <version>6.0.2-SNAPSHOT</version>
+ <version>6.0.3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>vid</name>
@@ -86,7 +86,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <build.version>6.0.2-SNAPSHOT</build.version>
+ <build.version>6.0.3-SNAPSHOT</build.version>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
<releaseNexusPath>content/repositories/releases/</releaseNexusPath>
diff --git a/releases/6.0.2-container.yaml b/releases/6.0.2-container.yaml
new file mode 100644
index 000000000..eee3b1ccb
--- /dev/null
+++ b/releases/6.0.2-container.yaml
@@ -0,0 +1,8 @@
+distribution_type: 'container'
+container_release_tag: '6.0.2'
+project: 'vid'
+log_dir: 'vid-maven-docker-stage-master/253/'
+ref: 667fbe07aae6f9669127e9e0212f6f83c87b0d0a
+containers:
+ - name: 'vid'
+ version: '6.0.2-20200126T025724Z' \ No newline at end of file
diff --git a/version.properties b/version.properties
index 819a8c054..ce5339b64 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=6
minor=0
-patch=2
+patch=3
base_version=${major}.${minor}.${patch}
diff --git a/vid-app-common/pom.xml b/vid-app-common/pom.xml
index 1b786c2c0..94d07dbeb 100755
--- a/vid-app-common/pom.xml
+++ b/vid-app-common/pom.xml
@@ -9,7 +9,7 @@
inherit from a parent maven module. -->
<groupId>org.onap.vid</groupId>
<artifactId>vid-app-common</artifactId>
- <version>6.0.2-SNAPSHOT</version>
+ <version>6.0.3-SNAPSHOT</version>
<packaging>war</packaging>
<name>VID Common</name>
<description>VID Common code for opensource version</description>
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java
index 563c9ff20..a9ce40bba 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java
@@ -49,7 +49,6 @@ import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.util.AAIRestInterface;
import org.onap.vid.model.VersionByInvariantIdsRequest;
import org.onap.vid.properties.Features;
-import org.onap.vid.roles.Role;
import org.onap.vid.roles.RoleProvider;
import org.onap.vid.roles.RoleValidator;
import org.onap.vid.services.AaiService;
@@ -137,7 +136,7 @@ public class AaiController extends RestrictedBaseController {
@RequestMapping(value = "/aai_get_services", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> doGetServices(HttpServletRequest request) throws IOException {
- RoleValidator roleValidator = RoleValidator.by(roleProvider.getUserRoles(request));
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(request);
AaiResponse subscriberList = aaiService.getServices(roleValidator);
return aaiResponseToResponseEntity(subscriberList);
@@ -225,7 +224,7 @@ public class AaiController extends RestrictedBaseController {
@RequestMapping(value = "/aai_get_full_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> getFullSubscriberList(HttpServletRequest request) throws IOException {
ResponseEntity<String> responseEntity;
- RoleValidator roleValidator = RoleValidator.by(roleProvider.getUserRoles(request));
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(request);
SubscriberFilteredResults subscriberList = aaiService.getFullSubscriberList(roleValidator);
if (subscriberList.getHttpCode() == 200) {
responseEntity = new ResponseEntity<>(objectMapper.writeValueAsString(subscriberList.getSubscriberList()),
@@ -256,8 +255,7 @@ public class AaiController extends RestrictedBaseController {
@RequestMapping(value = "/aai_sub_details/{subscriberId}", method = RequestMethod.GET)
public ResponseEntity<String> getSubscriberDetails(HttpServletRequest request, @PathVariable("subscriberId") String subscriberId,
@RequestParam(value="omitServiceInstances", required = false, defaultValue = "false") boolean omitServiceInstances) throws IOException {
- List<Role> roles = roleProvider.getUserRoles(request);
- RoleValidator roleValidator = RoleValidator.by(roles);
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(request);
AaiResponse subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator,
featureManager.isActive(Features.FLAG_1906_AAI_SUB_DETAILS_REDUCE_DEPTH) && omitServiceInstances);
String httpMessage = subscriberData.getT() != null ? objectMapper.writeValueAsString(subscriberData.getT()) : subscriberData.getErrorMessage();
@@ -274,8 +272,7 @@ public class AaiController extends RestrictedBaseController {
@RequestParam(value = "owningEntity", required = false) List<String> owningEntities) throws IOException {
ResponseEntity responseEntity;
- List<Role> roles = roleProvider.getUserRoles(request);
- RoleValidator roleValidator = RoleValidator.by(roles);
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(request);
AaiResponse<ServiceInstancesSearchResults> searchResult = aaiService
.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, owningEntities, projects);
@@ -404,8 +401,7 @@ public class AaiController extends RestrictedBaseController {
ResponseEntity responseEntity;
try {
- List<Role> roles = roleProvider.getUserRoles(request);
- RoleValidator roleValidator = RoleValidator.by(roles);
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(request);
AaiResponse<GetTenantsResponse[]> response = aaiService
.getTenants(globalCustomerId, serviceType, roleValidator);
if (response.getHttpCode() == 200) {
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
index 6431282e7..2d7a9253e 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
@@ -33,6 +33,7 @@ import org.onap.vid.model.aaiTree.Network;
import org.onap.vid.model.aaiTree.RelatedVnf;
import org.onap.vid.model.aaiTree.VpnBinding;
import org.onap.vid.properties.Features;
+import org.onap.vid.roles.PermissionPropertiesSubscriberAndServiceType;
import org.onap.vid.roles.RoleProvider;
import org.onap.vid.services.AaiService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -94,7 +95,7 @@ public class AaiController2 extends VidRestrictedBaseController {
final boolean isEditPermitted = roleProvider
.getUserRolesValidator(request)
- .isServicePermitted(subscriberId, serviceType);
+ .isServicePermitted(new PermissionPropertiesSubscriberAndServiceType(subscriberId, serviceType));
return new Permissions(isEditPermitted);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
index 6c8a37262..ce8bbb50c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
@@ -33,7 +33,9 @@ import org.onap.vid.model.ServiceInfo;
import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.mso.MsoResponseWrapper2;
import org.onap.vid.properties.Features;
+import org.onap.vid.roles.AllPermissionProperties;
import org.onap.vid.roles.RoleProvider;
+import org.onap.vid.roles.RoleValidator;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
import org.onap.vid.services.AuditService;
import org.onap.vid.utils.SystemPropertiesWrapper;
@@ -165,8 +167,15 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
}
private void throwExceptionIfAccessDenied(ServiceInstantiation request, HttpServletRequest httpServletRequest, String userId) {
- if (featureManager.isActive(Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION) && !roleProvider.getUserRolesValidator(httpServletRequest).isServicePermitted(request.getGlobalSubscriberId(), request.getSubscriptionServiceType())) {
- throw new AccessDeniedException(String.format("User %s is not allowed to make this request", userId));
+ if (featureManager.isActive(Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION)) {
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(httpServletRequest);
+ if (!roleValidator.isServicePermitted(new AllPermissionProperties(
+ request.getGlobalSubscriberId(),
+ request.getSubscriptionServiceType(),
+ request.getOwningEntityId()))
+ ) {
+ throw new AccessDeniedException(String.format("User %s is not allowed to make this request", userId));
+ }
}
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/PreLoadController.java b/vid-app-common/src/main/java/org/onap/vid/controller/PreLoadController.java
new file mode 100644
index 000000000..ba20997cd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/PreLoadController.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.vid.controller;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+@RequestMapping(PreLoadController.PRE_LOAD)
+public class PreLoadController extends VidRestrictedBaseController{
+ public static final String PRE_LOAD = "preload";
+
+ @PostMapping()
+ public Boolean postPreload (HttpServletRequest request) {
+ return true;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java b/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java
index d2e5d637e..f8d5918db 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java
@@ -20,10 +20,9 @@
package org.onap.vid.model;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs;
import org.slf4j.MDC;
-import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
-
/**
* The Class ExceptionResponse.
*/
@@ -67,7 +66,7 @@ public class ExceptionResponse {
public void setException(Exception exception) {
setException(exception.getClass().toString().replaceFirst("^.*[\\.$]", ""));
- setMessage(exception.getMessage() + " (Request id: " + MDC.get(MDC_KEY_REQUEST_ID) + ")");
+ setMessage(exception.getMessage() + " (Request id: " + MDC.get(MDCs.REQUEST_ID) + ")");
}
/**
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java b/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java
index 259405c4e..2665313d7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java
@@ -20,11 +20,17 @@
package org.onap.vid.model;
-public class ServiceInstanceSearchResult {
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.vid.roles.WithPermissionPropertiesSubscriberAndServiceType;
+
+public class ServiceInstanceSearchResult implements WithPermissionPropertiesSubscriberAndServiceType {
+
+ private final String SUBSCRIBER_ID_FRONTEND_ALIAS = "globalCustomerId";
private String serviceInstanceId;
- private String globalCustomerId;
+ private String subscriberId;
private String serviceType;
@@ -39,13 +45,13 @@ public class ServiceInstanceSearchResult {
private boolean isPermitted;
public ServiceInstanceSearchResult(){
-
}
- public ServiceInstanceSearchResult(String serviceInstanceId, String globalCustomerId, String serviceType,
+
+ public ServiceInstanceSearchResult(String serviceInstanceId, String subscriberId, String serviceType,
String serviceInstanceName, String subscriberName, String aaiModelInvariantId,
String aaiModelVersionId, boolean isPermitted) {
this.serviceInstanceId = serviceInstanceId;
- this.globalCustomerId = globalCustomerId;
+ this.subscriberId = subscriberId;
this.serviceType = serviceType;
this.serviceInstanceName = serviceInstanceName;
this.subscriberName = subscriberName;
@@ -62,14 +68,17 @@ public class ServiceInstanceSearchResult {
this.serviceInstanceId = serviceInstanceId;
}
- public String getGlobalCustomerId() {
- return globalCustomerId;
+ @Override
+ @JsonProperty(SUBSCRIBER_ID_FRONTEND_ALIAS)
+ public String getSubscriberId() {
+ return subscriberId;
}
- public void setGlobalCustomerId(String globalCustomerId) {
- this.globalCustomerId = globalCustomerId;
+ public void setSubscriberId(String subscriberId) {
+ this.subscriberId = subscriberId;
}
+ @Override
public String getServiceType() {
return serviceType;
}
@@ -119,21 +128,21 @@ public class ServiceInstanceSearchResult {
}
@Override
- public boolean equals(Object other){
- if (other instanceof ServiceInstanceSearchResult) {
- ServiceInstanceSearchResult serviceInstanceSearchResultOther = (ServiceInstanceSearchResult) other;
- if (this.getServiceInstanceId().equals(serviceInstanceSearchResultOther.getServiceInstanceId())) {
- return true;
- }
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
}
- return false;
+ ServiceInstanceSearchResult that = (ServiceInstanceSearchResult) o;
+
+ return StringUtils.equals(serviceInstanceId, that.serviceInstanceId);
}
@Override
public int hashCode() {
- int result = 17;
- result = 31 * result + serviceInstanceId.hashCode();
- return result;
+ return serviceInstanceId != null ? serviceInstanceId.hashCode() : 0;
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index 74f7d4e0b..27190466d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -82,8 +82,10 @@ public enum Features implements Feature {
FLAG_2004_INSTANTIATION_STATUS_FILTER,
FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE,
FLAG_2004_INSTANTIATION_TEMPLATES_POPUP,
+ FLAG_2006_VFM_SDNC_PRELOAD_FILES,
FLAG_2002_UNLIMITED_MAX,
FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO,
+ FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY,
;
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
index 4e5340fc2..66eab1810 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
@@ -27,17 +27,17 @@ public class AlwaysValidRoleValidator implements RoleValidator {
}
@Override
- public boolean isSubscriberPermitted(String subscriberName) {
+ public boolean isSubscriberPermitted(String subscriberId) {
return true;
}
@Override
- public boolean isServicePermitted(String subscriberName, String serviceType) {
+ public boolean isServicePermitted(WithPermissionProperties permissionProperties) {
return true;
}
@Override
- public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) {
return true;
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/PermissionProperties.kt b/vid-app-common/src/main/java/org/onap/vid/roles/PermissionProperties.kt
new file mode 100644
index 000000000..dbdd41326
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/PermissionProperties.kt
@@ -0,0 +1,34 @@
+package org.onap.vid.roles
+
+import org.onap.vid.aai.ServiceSubscription
+
+
+interface WithPermissionProperties
+
+interface WithPermissionPropertiesSubscriberAndServiceType: WithPermissionProperties {
+ val subscriberId: String?
+ val serviceType: String?
+}
+
+interface WithPermissionPropertiesOwningEntity: WithPermissionProperties {
+ val owningEntityId: String?
+}
+
+
+data class AllPermissionProperties(
+ override val subscriberId: String?,
+ override val serviceType: String?,
+ override val owningEntityId: String?
+): WithPermissionPropertiesOwningEntity, WithPermissionPropertiesSubscriberAndServiceType
+
+data class PermissionPropertiesOwningEntity(
+ override val owningEntityId: String?
+): WithPermissionPropertiesOwningEntity
+
+data class PermissionPropertiesSubscriberAndServiceType(
+ override val subscriberId: String?,
+ override val serviceType: String?
+) : WithPermissionPropertiesSubscriberAndServiceType {
+ constructor(serviceSubscription: ServiceSubscription, subscriberId: String?) : this(subscriberId, serviceSubscription.serviceType)
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/Role.java b/vid-app-common/src/main/java/org/onap/vid/roles/Role.java
index 454483031..3de894480 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/Role.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/Role.java
@@ -20,49 +20,44 @@
package org.onap.vid.roles;
-/**
- * Created by Oren on 7/1/17.
- */
-
public class Role {
- private EcompRole ecompRole;
+ private final EcompRole ecompRole;
+
+ private final String subscriberId;
- private String subscribeName;
+ private final String serviceType;
- private String serviceType;
+ private final String tenant;
- private String tenant;
+ private final String owningEntityId;
- public Role(EcompRole ecompRole, String subscribeName, String serviceType, String tenant) {
+ public Role(EcompRole ecompRole, String subscriberId, String serviceType, String tenant, String owningEntityId) {
this.ecompRole = ecompRole;
- this.subscribeName = subscribeName;
+ this.subscriberId = subscriberId;
this.serviceType = serviceType;
this.tenant = tenant;
+ this.owningEntityId = owningEntityId;
}
public EcompRole getEcompRole() {
return ecompRole;
}
-
- public String getSubscribeName() {
- return subscribeName;
- }
-
- public void setSubscribeName(String subscribeName) {
- this.subscribeName = subscribeName;
+ public String getSubscriberId() {
+ return subscriberId;
}
public String getServiceType() {
return serviceType;
}
-
public String getTenant() {
return tenant;
}
-
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
index 898db332c..c35f5f704 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
@@ -42,11 +42,6 @@ import org.onap.vid.services.AaiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
-/**
- * Created by Oren on 7/1/17.
- */
-
@Component
public class RoleProvider {
@@ -58,16 +53,20 @@ public class RoleProvider {
private Function<HttpServletRequest, Integer> getUserIdFunction;
private Function<HttpServletRequest, Map> getRolesFunction;
+ private final RoleValidatorFactory roleValidatorFactory;
@Autowired
- public RoleProvider(AaiService aaiService) {
+ public RoleProvider(AaiService aaiService, RoleValidatorFactory roleValidatorFactory) {
this.aaiService=aaiService;
+ this.roleValidatorFactory = roleValidatorFactory;
getUserIdFunction = UserUtils::getUserId;
getRolesFunction = UserUtils::getRoles;
}
- RoleProvider(AaiService aaiService, Function<HttpServletRequest, Integer> getUserIdFunction, Function<HttpServletRequest, Map> getRolesFunction) {
+ RoleProvider(AaiService aaiService, RoleValidatorFactory roleValidatorFactory,
+ Function<HttpServletRequest, Integer> getUserIdFunction, Function<HttpServletRequest, Map> getRolesFunction) {
this.aaiService = aaiService;
+ this.roleValidatorFactory = roleValidatorFactory;
this.getRolesFunction = getRolesFunction;
this.getUserIdFunction = getUserIdFunction;
}
@@ -143,11 +142,13 @@ public class RoleProvider {
public Role createRoleFromStringArr(String[] roleParts, String rolePrefix) throws RoleParsingException {
String globalCustomerID = replaceSubscriberNameToGlobalCustomerID(roleParts[0], rolePrefix);
+ String owningEntityId = translateOwningEntityNameToOwningEntityId(roleParts[0]);
+
try {
if (roleParts.length > 2) {
- return new Role(EcompRole.READ, globalCustomerID, roleParts[1], roleParts[2]);
+ return new Role(EcompRole.READ, globalCustomerID, roleParts[1], roleParts[2], owningEntityId);
} else {
- return new Role(EcompRole.READ, globalCustomerID, roleParts[1], null);
+ return new Role(EcompRole.READ, globalCustomerID, roleParts[1], null, owningEntityId);
}
} catch (ArrayIndexOutOfBoundsException e) {
if (roleParts.length > 0)
@@ -161,8 +162,12 @@ public class RoleProvider {
}
+ private String translateOwningEntityNameToOwningEntityId(String owningEntityName) {
+ return owningEntityName; // TODO: translate to id
+ }
+
public RoleValidator getUserRolesValidator(HttpServletRequest request) {
- return RoleValidator.by(getUserRoles(request));
+ return roleValidatorFactory.by(getUserRoles(request));
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
index 830c0f50c..14c027392 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
@@ -21,26 +21,11 @@
package org.onap.vid.roles;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.portalsdk.core.util.SystemProperties;
-
public interface RoleValidator {
- static RoleValidator by(List<Role> roles) {
- final boolean disableRoles = StringUtils.equals(SystemProperties.getProperty("role_management_activated"), "false");
- return by(roles, disableRoles);
- }
-
- static RoleValidator by(List<Role> roles, boolean disableRoles) {
- return disableRoles
- ? new AlwaysValidRoleValidator()
- : new RoleValidatorByRoles(roles);
- }
-
- boolean isSubscriberPermitted(String subscriberName);
+ boolean isSubscriberPermitted(String subscriberId);
- boolean isServicePermitted(String subscriberName, String serviceType);
+ boolean isServicePermitted(WithPermissionProperties serviceInstanceSearchResult);
- boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName);
+ boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java
new file mode 100644
index 000000000..8d73dc400
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByOwningEntity.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.vid.roles;
+
+
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+
+public class RoleValidatorByOwningEntity implements RoleValidator{
+
+ private final List<Role> userRoles;
+
+ RoleValidatorByOwningEntity(List<Role> roles) {
+ this.userRoles = roles;
+ }
+
+ private boolean isOwningEntityIdPermitted(String owningEntityId) {
+ if (StringUtils.isEmpty(owningEntityId)) {
+ return false;
+ }
+
+ return userRoles.stream().anyMatch(userRole ->
+ StringUtils.equals(userRole.getOwningEntityId(), owningEntityId)
+ );
+ }
+
+ @Override
+ public boolean isSubscriberPermitted(String subscriberId) {
+ return false;
+ }
+
+ @Override
+ public boolean isServicePermitted(WithPermissionProperties permissionProperties) {
+ if (permissionProperties instanceof WithPermissionPropertiesOwningEntity) {
+ String owningEntityId = ((WithPermissionPropertiesOwningEntity) permissionProperties).getOwningEntityId();
+ return isOwningEntityIdPermitted(owningEntityId);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) {
+ return false;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java
index ad5b519c4..24a00f6e8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceType.java
@@ -21,21 +21,20 @@
package org.onap.vid.roles;
import java.util.List;
-import java.util.Map;
-import org.onap.vid.mso.rest.RequestDetails;
+import org.apache.commons.lang3.StringUtils;
-public class RoleValidatorByRoles implements RoleValidator {
+public class RoleValidatorBySubscriberAndServiceType implements RoleValidator {
private final List<Role> userRoles;
- RoleValidatorByRoles(List<Role> roles) {
+ RoleValidatorBySubscriberAndServiceType(List<Role> roles) {
this.userRoles = roles;
}
@Override
- public boolean isSubscriberPermitted(String subscriberName) {
+ public boolean isSubscriberPermitted(String subscriberId) {
for (Role role : userRoles) {
- if (role.getSubscribeName().equals(subscriberName)) {
+ if (role.getSubscriberId().equals(subscriberId)) {
return true;
}
}
@@ -43,19 +42,26 @@ public class RoleValidatorByRoles implements RoleValidator {
}
@Override
- public boolean isServicePermitted(String subscriberName, String serviceType) {
- for (Role role : userRoles) {
- if (role.getSubscribeName().equals(subscriberName) && role.getServiceType().equals(serviceType)) {
- return true;
- }
+ public boolean isServicePermitted(WithPermissionProperties permissionProperties) {
+ if (permissionProperties instanceof WithPermissionPropertiesSubscriberAndServiceType) {
+ return isServicePermitted(
+ (WithPermissionPropertiesSubscriberAndServiceType) permissionProperties
+ );
}
return false;
}
+ private boolean isServicePermitted(WithPermissionPropertiesSubscriberAndServiceType permissionProperties) {
+ return userRoles.stream().anyMatch(userRole ->
+ StringUtils.equals(userRole.getSubscriberId(), permissionProperties.getSubscriberId())
+ && StringUtils.equals(userRole.getServiceType(), permissionProperties.getServiceType())
+ );
+ }
+
@Override
- public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ public boolean isTenantPermitted(String subscriberId, String serviceType, String tenantName) {
for (Role role : userRoles) {
- if (role.getSubscribeName().equals(globalCustomerId)
+ if (role.getSubscriberId().equals(subscriberId)
&& role.getServiceType().equals(serviceType)
&& (role.getTenant() == null || role.getTenant().equalsIgnoreCase(tenantName))) {
return true;
@@ -64,17 +70,4 @@ public class RoleValidatorByRoles implements RoleValidator {
return false;
}
- boolean isMsoRequestValid(RequestDetails msoRequest) {
- try {
- String globalSubscriberIdRequested = (String) ((Map) ((Map) msoRequest.getAdditionalProperties()
- .get("requestDetails")).get("subscriberInfo")).get("globalSubscriberId");
- String serviceType = (String) ((Map) ((Map) msoRequest.getAdditionalProperties().get("requestDetails"))
- .get("requestParameters")).get("subscriptionServiceType");
- return isServicePermitted(globalSubscriberIdRequested, serviceType);
- } catch (Exception e) {
- //Until we'll get the exact information regarding the tenants and the global customer id, we'll return true on unknown requests to mso
- return true;
- }
- }
-
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java
new file mode 100644
index 000000000..b171ad7e7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorFactory.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2020 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.onap.vid.roles;
+
+
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.properties.Features;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.togglz.core.manager.FeatureManager;
+
+@Component
+public class RoleValidatorFactory {
+ private final FeatureManager featureManager;
+
+ @Autowired
+ public RoleValidatorFactory(FeatureManager featureManager) {
+ this.featureManager = featureManager;
+ }
+
+
+ public RoleValidator by(List<Role> roles) {
+ final boolean disableRoles = StringUtils
+ .equals(SystemProperties.getProperty("role_management_activated"), "false");
+ return by(roles, disableRoles);
+ }
+
+ public RoleValidator by(List<Role> roles, boolean disableRoles) {
+
+ if(disableRoles) {
+ return new AlwaysValidRoleValidator();
+ }
+ else if (featureManager.isActive(Features.FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY)){
+ return new RoleValidatorsComposer(
+ new RoleValidatorBySubscriberAndServiceType(roles),
+ new RoleValidatorByOwningEntity(roles)
+ );
+ }
+ else {
+ return new RoleValidatorBySubscriberAndServiceType(roles);
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt
new file mode 100644
index 000000000..d012cb3f3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorsComposer.kt
@@ -0,0 +1,16 @@
+package org.onap.vid.roles
+
+class RoleValidatorsComposer(private vararg val roleValidators: RoleValidator) : RoleValidator {
+
+ constructor(roleValidators: Collection<RoleValidator>) : this(*roleValidators.toTypedArray())
+
+ override fun isServicePermitted(p: WithPermissionProperties): Boolean =
+ roleValidators.any { it.isServicePermitted(p) }
+
+ override fun isSubscriberPermitted(subscriberId: String?): Boolean =
+ roleValidators.any { it.isSubscriberPermitted(subscriberId) }
+
+ override fun isTenantPermitted(subscriberId: String?, serviceType: String?, tenantName: String?): Boolean =
+ roleValidators.any { it.isTenantPermitted(subscriberId, serviceType, tenantName) }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index b3ac16884..696aca5ea 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -85,6 +85,7 @@ import org.onap.vid.model.aaiTree.NodeType;
import org.onap.vid.model.aaiTree.RelatedVnf;
import org.onap.vid.model.aaiTree.VpnBinding;
import org.onap.vid.model.aaiTree.VpnBindingKt;
+import org.onap.vid.roles.PermissionPropertiesSubscriberAndServiceType;
import org.onap.vid.roles.RoleValidator;
import org.onap.vid.utils.Intersection;
import org.onap.vid.utils.Logging;
@@ -217,11 +218,11 @@ public class AaiServiceImpl implements AaiService {
} else if (key.equals(SERVICE_TYPE)) {
serviceInstanceSearchResult.setServiceType(relationshipData.getRelationshipValue());
} else if (key.equals(CUSTOMER_ID)) {
- serviceInstanceSearchResult.setGlobalCustomerId(relationshipData.getRelationshipValue());
+ serviceInstanceSearchResult.setSubscriberId(relationshipData.getRelationshipValue());
}
}
- boolean isPermitted = roleValidator.isServicePermitted(serviceInstanceSearchResult.getSubscriberName(), serviceInstanceSearchResult.getServiceType());
+ boolean isPermitted = roleValidator.isServicePermitted(serviceInstanceSearchResult);
serviceInstanceSearchResult.setIsPermitted(isPermitted);
}
}
@@ -265,10 +266,9 @@ public class AaiServiceImpl implements AaiService {
@Override
public AaiResponse getSubscriberData(String subscriberId, RoleValidator roleValidator, boolean omitServiceInstances) {
AaiResponse<Services> subscriberResponse = aaiClient.getSubscriberData(subscriberId, omitServiceInstances);
- String subscriberGlobalId = subscriberResponse.getT().globalCustomerId;
for (ServiceSubscription serviceSubscription : subscriberResponse.getT().serviceSubscriptions.serviceSubscription) {
- String serviceType = serviceSubscription.serviceType;
- serviceSubscription.isPermitted = roleValidator.isServicePermitted(subscriberGlobalId, serviceType);
+ serviceSubscription.isPermitted = roleValidator.isServicePermitted(
+ new PermissionPropertiesSubscriberAndServiceType(serviceSubscription, subscriberResponse.getT().globalCustomerId));
}
return subscriberResponse;
@@ -298,38 +298,43 @@ public class AaiServiceImpl implements AaiService {
private List<ServiceInstanceSearchResult> getServicesBySubscriber(String subscriberId, String instanceIdentifier, RoleValidator roleValidator) {
AaiResponse<Services> subscriberResponse = aaiClient.getSubscriberData(subscriberId, false);
- String subscriberGlobalId = subscriberResponse.getT().globalCustomerId;
String subscriberName = subscriberResponse.getT().subscriberName;
ServiceSubscriptions serviceSubscriptions = subscriberResponse.getT().serviceSubscriptions;
- return getSearchResultsForSubscriptions(serviceSubscriptions, subscriberId, instanceIdentifier, roleValidator, subscriberGlobalId, subscriberName);
-
+ return getSearchResultsForSubscriptions(serviceSubscriptions, subscriberId, instanceIdentifier, roleValidator, subscriberName);
}
- private ArrayList<ServiceInstanceSearchResult> getSearchResultsForSubscriptions(ServiceSubscriptions serviceSubscriptions, String subscriberId, String instanceIdentifier, RoleValidator roleValidator, String subscriberGlobalId, String subscriberName) {
+ private ArrayList<ServiceInstanceSearchResult> getSearchResultsForSubscriptions(
+ ServiceSubscriptions serviceSubscriptions, String subscriberId, String instanceIdentifier,
+ RoleValidator roleValidator, String subscriberName) {
ArrayList<ServiceInstanceSearchResult> results = new ArrayList<>();
if (serviceSubscriptions != null) {
for (ServiceSubscription serviceSubscription : serviceSubscriptions.serviceSubscription) {
- String serviceType = serviceSubscription.serviceType;
- serviceSubscription.isPermitted = roleValidator.isServicePermitted(subscriberGlobalId, serviceType);
- ArrayList<ServiceInstanceSearchResult> resultsForSubscription = getSearchResultsForSingleSubscription(serviceSubscription, subscriberId, instanceIdentifier, subscriberName, serviceType);
- results.addAll(resultsForSubscription);
+ serviceSubscription.isPermitted = roleValidator.isServicePermitted(new PermissionPropertiesSubscriberAndServiceType(serviceSubscription, subscriberId));
+ results.addAll(getSearchResultsForSingleSubscription(
+ serviceSubscription, subscriberId, instanceIdentifier, subscriberName,
+ serviceSubscription.serviceType, roleValidator)
+ );
}
}
return results;
}
- private ArrayList<ServiceInstanceSearchResult> getSearchResultsForSingleSubscription(ServiceSubscription serviceSubscription, String subscriberId, String instanceIdentifier, String subscriberName, String serviceType) {
+ private ArrayList<ServiceInstanceSearchResult> getSearchResultsForSingleSubscription(
+ ServiceSubscription serviceSubscription, String subscriberId, String instanceIdentifier, String subscriberName,
+ String serviceType, RoleValidator roleValidator) {
ArrayList<ServiceInstanceSearchResult> results = new ArrayList<>();
if (serviceSubscription.serviceInstances != null) {
for (ServiceInstance serviceInstance : serviceSubscription.serviceInstances.serviceInstance) {
ServiceInstanceSearchResult serviceInstanceSearchResult =
new ServiceInstanceSearchResult(serviceInstance.serviceInstanceId, subscriberId, serviceType, serviceInstance.serviceInstanceName,
- subscriberName, serviceInstance.modelInvariantId, serviceInstance.modelVersionId, serviceSubscription.isPermitted);
+ subscriberName, serviceInstance.modelInvariantId, serviceInstance.modelVersionId, false);
+
+ serviceInstanceSearchResult.setIsPermitted(roleValidator.isServicePermitted(serviceInstanceSearchResult));
if ((instanceIdentifier == null) || (serviceInstanceMatchesIdentifier(instanceIdentifier, serviceInstance))){
results.add(serviceInstanceSearchResult);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
index 9cdd5ceb9..1e8a04baf 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -265,7 +265,8 @@ appDS2
FLAG_FLASH_REPLACE_VF_MODULE: "FLAG_FLASH_REPLACE_VF_MODULE",
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT: "FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT",
FLAG_SHOW_ORCHESTRATION_TYPE: "FLAG_SHOW_ORCHESTRATION_TYPE",
- FLAG_2004_INSTANTIATION_TEMPLATES_POPUP : "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"
+ FLAG_2004_INSTANTIATION_TEMPLATES_POPUP : "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP",
+ FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY: "FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY"
}
};
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java
index f9668c960..06ef5d586 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java
@@ -33,8 +33,10 @@ import org.onap.vid.model.SubscriberList;
import org.onap.vid.roles.EcompRole;
import org.onap.vid.roles.Role;
import org.onap.vid.roles.RoleValidator;
+import org.onap.vid.roles.RoleValidatorFactory;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
public class SubscriberFilteredResultsTest {
@@ -89,9 +91,7 @@ public class SubscriberFilteredResultsTest {
}
private void prepareRoleValidator() {
- ArrayList<Role> list = new ArrayList<>();
- list.add(new Role(EcompRole.READ, "a", "a", "a"));
- roleValidator = RoleValidator.by(list);
+ roleValidator = mock(RoleValidator.class);
}
private void prepareSubscriberList() throws IOException {
diff --git a/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java
deleted file mode 100644
index 1d4556535..000000000
--- a/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 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.onap.vid.bl;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.arrayWithSize;
-import static org.hamcrest.Matchers.equalTo;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.vid.aai.AaiClientInterface;
-import org.onap.vid.aai.AaiResponse;
-import org.onap.vid.aai.model.AaiGetPnfResponse;
-import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
-import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
-import org.onap.vid.aai.model.LogicalLinkResponse;
-import org.onap.vid.aai.model.Relationship;
-import org.onap.vid.aai.model.RelationshipData;
-import org.onap.vid.aai.model.RelationshipList;
-import org.onap.vid.aai.model.ServiceRelationships;
-import org.onap.vid.roles.Role;
-import org.onap.vid.roles.RoleValidator;
-import org.onap.vid.services.AaiServiceImpl;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-public class AaiServiceTest {
-
- @InjectMocks
- private AaiServiceImpl aaiService;
-
- @Mock
- private AaiClientInterface aaiClientInterface;
-
-
-
- @BeforeMethod
- public void initMocks(){
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testGetSpecificPnf(){
- Pnf pnf = Pnf.builder().withPnfId("11111").build();
- AaiResponse<Pnf> aaiResponse = new AaiResponse<>(pnf, "aaaa", 200);
- Mockito.doReturn(aaiResponse).when(aaiClientInterface).getSpecificPnf(Mockito.anyString());
- AaiResponse<Pnf> specificPnf = aaiService.getSpecificPnf("1345667");
- assertNotNull(specificPnf);
- pnf = specificPnf.getT();
- assertNotNull(pnf);
- assertEquals("11111",pnf.getPnfId());
- assertEquals("aaaa",specificPnf.getErrorMessage());
- assertEquals(200,specificPnf.getHttpCode());
- }
-
- @Test
- public void testPnfByRegion(){
- AaiGetPnfResponse aaiGetPnfResponse = new AaiGetPnfResponse();
- AaiResponse<AaiGetPnfResponse> aaiResponse = new AaiResponse<>(aaiGetPnfResponse, "", 200);
- Mockito.doReturn(aaiResponse).when(aaiClientInterface).getPNFData(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
- AaiResponse<AaiGetPnfResponse> aaiGetPnfResponseWrapper = aaiService.getPNFData("1345667", "1345667", "1345667", "1345667", "1345667", "1345667", "1345667");
- assertNotNull(aaiGetPnfResponseWrapper);
- aaiGetPnfResponse = aaiGetPnfResponseWrapper.getT();
- assertNotNull(aaiGetPnfResponse);
- }
-
- @Test
- public void testGetAssociatedPnfs(){
- ServiceRelationships serviceRelationships = createServiceRelationships();
- AaiResponse<ServiceRelationships> aaiResponse = new AaiResponse<>(serviceRelationships, null, 200);
- Mockito.doReturn(aaiResponse).when(aaiClientInterface).getServiceInstance(Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
-
- LogicalLinkResponse logicalLinkResponse = createLogicalLinkResponse();
- AaiResponse<LogicalLinkResponse> aaiResponse1 = new AaiResponse<>(logicalLinkResponse, null, 200);
- Mockito.doReturn(aaiResponse1).when(aaiClientInterface).getLogicalLink("SANITY6758cce9%3ALAG1992%7CSANITY6785cce9%3ALAG1961");
-
- List<String> pnfList = aaiService.getServiceInstanceAssociatedPnfs("123", "456", "789");
- assertNotNull(pnfList);
- assertEquals(1, pnfList.size());
- assertEquals("SANITY6785cce9", pnfList.get(0));
- }
-
- private ServiceRelationships createServiceRelationships() {
- ServiceRelationships serviceRelationships = new ServiceRelationships();
- serviceRelationships.setServiceInstanceName("test service");
-
- RelationshipData logicalLinksRelationshipData = new RelationshipData();
- logicalLinksRelationshipData.setRelationshipKey("logical-link.link-name");
- logicalLinksRelationshipData.setRelationshipValue("SANITY6758cce9:LAG1992|SANITY6785cce9:LAG1961");
-
- Relationship logicalLinksRelationship = new Relationship();
- logicalLinksRelationship.setRelatedTo("logical-link");
- logicalLinksRelationship.setRelationDataList(Arrays.asList(logicalLinksRelationshipData));
-
- RelationshipList logicalLinksRelationshipsList = new RelationshipList();
- logicalLinksRelationshipsList.setRelationship(Arrays.asList(logicalLinksRelationship));
-
- serviceRelationships.setRelationshipList(logicalLinksRelationshipsList);
- return serviceRelationships;
- }
-
- private LogicalLinkResponse createLogicalLinkResponse() {
- LogicalLinkResponse logicalLinkResponse = new LogicalLinkResponse();
- logicalLinkResponse.setLinkName("SANITY6758cce9:LAG1992|SANITY6785cce9:LAG1961");
-
- RelationshipData lagInterfaceRelationshipData = new RelationshipData();
- lagInterfaceRelationshipData.setRelationshipKey("pnf.pnf-name");
- lagInterfaceRelationshipData.setRelationshipValue("SANITY6785cce9");
-
- Relationship lagInterfaceRelationship = new Relationship();
- lagInterfaceRelationship.setRelatedTo("lag-interface");
- lagInterfaceRelationship.setRelationDataList(Arrays.asList(lagInterfaceRelationshipData));
-
- RelationshipList lagInterfaceRelationshipsList = new RelationshipList();
- lagInterfaceRelationshipsList.setRelationship(Arrays.asList(lagInterfaceRelationship));
-
- logicalLinkResponse.setRelationshipList(lagInterfaceRelationshipsList);
-
- return logicalLinkResponse;
- }
-
- @DataProvider
- public static Object[][] getTenantsData() {
- return new Object[][] {
- {"customer1", "serviceType1", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", true},
- {"customer1", "serviceType1", "TeNant1", "customer1", "serviceType1", "tenant1", "id-1", true},
- {"customer1", "serviceType1", "TENANT1", "customer1", "serviceType1", "tenant1", "id-1", true},
- {"customer1", "serviceType1", "tenant2", "customer1", "serviceType1", "tenant1", "tenant2", false},
- {"customer1", "serviceType1", null, "customer1", "serviceType1", "tenant1", "tenant2", true},
- {"customer2", "serviceType1", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", false},
- {"customer1", "serviceType2", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", false},
- {"customer2", "serviceType1", null, "customer1", "serviceType1", "tenant1", "id-1", false},
- {"customer1", "serviceType2", null, "customer1", "serviceType1", "tenant1", "id-1", false},
- };
- }
-
- @Test(dataProvider = "getTenantsData")
- public void testGetTenants(String userGlobalCustomerId, String userServiceType, String userTenantName, String serviceGlobalCustomerId,
- String serviceServiceType, String serviceTenantName, String serviceTenantId, boolean expectedIsPermitted) {
- GetTenantsResponse[] getTenantsResponses = new GetTenantsResponse[] {new GetTenantsResponse(null, null, serviceTenantName, serviceTenantId, expectedIsPermitted)};
- AaiResponse<GetTenantsResponse[]> aaiResponse = new AaiResponse<>(getTenantsResponses, null, 200);
- Mockito.doReturn(aaiResponse).when(aaiClientInterface).getTenants(serviceGlobalCustomerId, serviceServiceType);
- Role role = new Role(null, userGlobalCustomerId, userServiceType, userTenantName);
- RoleValidator roleValidator = RoleValidator.by(Collections.singletonList(role));
- AaiResponse<GetTenantsResponse[]> actualTenants = aaiService.getTenants(serviceGlobalCustomerId, serviceServiceType, roleValidator);
-
- assertThat(actualTenants.getT(), arrayWithSize(1));
- assertThat(actualTenants.getT()[0].tenantName, equalTo(serviceTenantName));
- //assertThat(actualTenants.getT()[0].isPermitted, equalTo(expectedIsPermitted));
- }
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
index 521102383..202263c41 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
@@ -23,11 +23,13 @@ package org.onap.vid.controller;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@@ -68,8 +70,11 @@ import org.onap.vid.aai.model.PortDetailsTranslator.PortDetailsOk;
import org.onap.vid.aai.util.AAIRestInterface;
import org.onap.vid.model.VersionByInvariantIdsRequest;
import org.onap.vid.properties.Features;
+import org.onap.vid.roles.AlwaysValidRoleValidator;
import org.onap.vid.roles.RoleProvider;
-import org.onap.vid.roles.RoleValidatorByRoles;
+import org.onap.vid.roles.RoleValidator;
+import org.onap.vid.roles.RoleValidatorBySubscriberAndServiceType;
+import org.onap.vid.roles.RoleValidatorFactory;
import org.onap.vid.services.AaiService;
import org.onap.vid.utils.SystemPropertiesWrapper;
import org.onap.vid.utils.Unchecked;
@@ -92,6 +97,8 @@ public class AaiControllerTest {
@Mock
private RoleProvider roleProvider;
@Mock
+ private RoleValidator roleValidator;
+ @Mock
private SystemPropertiesWrapper systemPropertiesWrapper;
@Mock
private FeatureManager featureManager;
@@ -103,6 +110,7 @@ public class AaiControllerTest {
public void setUp() {
aaiController = new AaiController(aaiService, aaiRestInterface, roleProvider, systemPropertiesWrapper,
featureManager);
+ when(roleProvider.getUserRolesValidator(any())).thenReturn(roleValidator);
mockMvc = MockMvcBuilders.standaloneSetup(aaiController).build();
}
@@ -408,7 +416,7 @@ public class AaiControllerTest {
String okResponseBody = "OK_RESPONSE";
AaiResponse<String> aaiResponse = new AaiResponse<>(okResponseBody, "", HttpStatus.OK.value());
given(featureManager.isActive(Features.FLAG_1906_AAI_SUB_DETAILS_REDUCE_DEPTH)).willReturn(isFeatureActive);
- given(aaiService.getSubscriberData(eq(subscriberId), isA(RoleValidatorByRoles.class),
+ given(aaiService.getSubscriberData(eq(subscriberId), isA(RoleValidator.class),
eq(isFeatureActive && omitServiceInstances)))
.willReturn(aaiResponse);
@@ -479,7 +487,7 @@ public class AaiControllerTest {
String okResponseBody = "OK_RESPONSE";
AaiResponse<String> aaiResponse = new AaiResponse<>(okResponseBody, "", HttpStatus.OK.value());
given(featureManager.isActive(Features.FLAG_1906_AAI_SUB_DETAILS_REDUCE_DEPTH)).willReturn(isFeatureActive);
- given(aaiService.getSubscriberData(eq(subscriberId), isA(RoleValidatorByRoles.class),
+ given(aaiService.getSubscriberData(eq(subscriberId), isA(RoleValidator.class),
eq(isFeatureActive && omitServiceInstances)))
.willReturn(aaiResponse);
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java
index f0d840929..6f584ed3d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java
@@ -66,7 +66,7 @@ public class LoggerControllerTest {
@Test
public void shouldThrowNotAuthorizedException_whenUserIsNotAuthorizedToGetLogs() throws Exception {
- List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1"));
+ List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1", "owningEntityId"));
given(provider.getUserRoles(argThat(req -> req.getRequestedSessionId().equals("id1")))).willReturn(list);
given(provider.userPermissionIsReadLogs(list)).willReturn(false);
@@ -80,7 +80,7 @@ public class LoggerControllerTest {
@Test
public void shouldReturnLastAndOneBeforeLogLines_whenLimitIs2() throws Exception {
- List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1"));
+ List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1", "owningEntityId"));
given(provider.getUserRoles(argThat(req -> req.getRequestedSessionId().equals("id1")))).willReturn(list);
given(provider.userPermissionIsReadLogs(list)).willReturn(true);
@@ -96,7 +96,7 @@ public class LoggerControllerTest {
@Test
public void shouldReturnEmptyString_whenLogFileIsEmpty() throws Exception {
- List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1"));
+ List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1", "owningEntityId"));
given(provider.getUserRoles(argThat(req -> req.getRequestedSessionId().equals("id1")))).willReturn(list);
given(provider.userPermissionIsReadLogs(list)).willReturn(true);
@@ -111,7 +111,7 @@ public class LoggerControllerTest {
@Test
public void shouldReturnEmptyString_whenDebugLogFileIsEmpty() throws Exception {
- List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1"));
+ List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1", "owningEntityId"));
given(provider.getUserRoles(argThat(req -> req.getRequestedSessionId().equals("id1")))).willReturn(list);
given(provider.userPermissionIsReadLogs(list)).willReturn(true);
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java
index ac3da50ab..3b7dbfbb8 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.when;
import org.jetbrains.annotations.NotNull;
import org.onap.vid.aai.model.Permissions;
+import org.onap.vid.roles.PermissionPropertiesSubscriberAndServiceType;
import org.onap.vid.roles.RoleProvider;
import org.onap.vid.roles.RoleValidator;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -53,7 +54,7 @@ public class ServicePermissionsTest {
RoleProvider roleProvider = mock(RoleProvider.class);
RoleValidator roleValidator = mock(RoleValidator.class);
when(roleProvider.getUserRolesValidator(any())).thenReturn(roleValidator);
- when(roleValidator.isServicePermitted(subscriberId, serviceType)).thenReturn(expected);
+ when(roleValidator.isServicePermitted(new PermissionPropertiesSubscriberAndServiceType(subscriberId, serviceType))).thenReturn(expected);
AaiController2 aaiController2 = new AaiController2(null, roleProvider, null, null);
diff --git a/vid-app-common/src/test/java/org/onap/vid/model/ServiceInstanceSearchResultTest.java b/vid-app-common/src/test/java/org/onap/vid/model/ServiceInstanceSearchResultTest.java
index 5168a5c63..b777375ef 100644
--- a/vid-app-common/src/test/java/org/onap/vid/model/ServiceInstanceSearchResultTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/model/ServiceInstanceSearchResultTest.java
@@ -20,183 +20,47 @@
package org.onap.vid.model;
-import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsFor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeFor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonNodeAbsent;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
+import static org.apache.commons.lang3.ArrayUtils.toArray;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.testng.annotations.Test;
public class ServiceInstanceSearchResultTest {
- private ServiceInstanceSearchResult createTestSubject() {
- return new ServiceInstanceSearchResult();
- }
-
- @Test
- public void testGetServiceInstanceId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getServiceInstanceId();
- }
-
- @Test
- public void testSetServiceInstanceId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String serviceInstanceId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setServiceInstanceId(serviceInstanceId);
- }
-
- @Test
- public void testGetGlobalCustomerId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getGlobalCustomerId();
- }
-
- @Test
- public void testSetGlobalCustomerId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String globalCustomerId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setGlobalCustomerId(globalCustomerId);
- }
-
- @Test
- public void testGetServiceType() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getServiceType();
- }
-
- @Test
- public void testSetServiceType() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String serviceType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setServiceType(serviceType);
- }
-
- @Test
- public void testGetServiceInstanceName() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getServiceInstanceName();
- }
-
- @Test
- public void testSetServiceInstanceName() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String serviceInstanceName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setServiceInstanceName(serviceInstanceName);
- }
-
- @Test
- public void testGetSubscriberName() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSubscriberName();
- }
-
- @Test
- public void testSetSubscriberName() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String subscriberName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setSubscriberName(subscriberName);
- }
-
@Test
- public void testGetAaiModelInvariantId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAaiModelInvariantId();
- }
-
- @Test
- public void testSetAaiModelInvariantId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String aaiModelInvariantId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAaiModelInvariantId(aaiModelInvariantId);
- }
-
- @Test
- public void testGetAaiModelVersionId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAaiModelVersionId();
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ServiceInstanceSearchResult.class, hasValidGettersAndSetters());
}
@Test
- public void testSetAaiModelVersionId() throws Exception {
- ServiceInstanceSearchResult testSubject;
- String aaiModelVersionId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAaiModelVersionId(aaiModelVersionId);
- }
-
- @Test
- public void testGetIsPermitted() throws Exception {
- ServiceInstanceSearchResult testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getIsPermitted();
+ public void shouldHaveValidConstructor() {
+ assertThat(ServiceInstanceSearchResult.class, hasValidBeanConstructor());
}
@Test
- public void testSetIsPermitted() throws Exception {
- ServiceInstanceSearchResult testSubject;
- boolean isPermitted = false;
+ public void shouldHaveValidEqualsAndHashCode() {
+ String[] propertiesToEqualBy = toArray("serviceInstanceId");
- // default test
- testSubject = createTestSubject();
- testSubject.setIsPermitted(isPermitted);
+ assertThat(ServiceInstanceSearchResult.class, allOf(
+ hasValidBeanHashCodeFor(propertiesToEqualBy),
+ hasValidBeanEqualsFor(propertiesToEqualBy))
+ );
}
@Test
- public void testEquals() throws Exception {
- ServiceInstanceSearchResult testSubject;
- Object other = null;
- boolean result;
+ public void subscriberId_shouldBeSerializedAsGlobalCustomerId() {
+ ServiceInstanceSearchResult underTest = new ServiceInstanceSearchResult();
+ underTest.setSubscriberId("example");
- // default test
- testSubject = createTestSubject();
- result = testSubject.equals(other);
+ assertThat(underTest, jsonPartEquals("globalCustomerId", "example"));
+ assertThat(underTest, jsonNodeAbsent("subscriberId"));
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java
index 363c6ff76..6826b1e4a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java
@@ -33,7 +33,8 @@ public class AlwaysValidRoleValidatorTest {
@Test
public void testIsServicePermitted() {
- assertTrue(new AlwaysValidRoleValidator().isServicePermitted("any", "any"));
+ WithPermissionProperties emptyPermissionProperties = new WithPermissionProperties() {};
+ assertTrue(new AlwaysValidRoleValidator().isServicePermitted(emptyPermissionProperties));
}
@Test
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
index c1033d2d0..8d81c929c 100644
--- a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
@@ -22,6 +22,7 @@ package org.onap.vid.roles;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
@@ -42,7 +43,7 @@ import org.testng.annotations.Test;
public class RoleProviderTest {
private static final String SAMPLE_SUBSCRIBER = "sampleSubscriber";
- private static final String SAMPLE_CUSTOMER_ID = "sampleCustomerId";
+ private static final String SAMPLE_SUBSCRIBER_ID = "subscriberId";
private static final String SERVICE_TYPE_LOGS = "LOGS";
private static final String TENANT_PERMITTED = "PERMITTED";
private static final String SAMPLE_SERVICE = "sampleService";
@@ -58,13 +59,16 @@ public class RoleProviderTest {
@Mock
private AaiResponse<SubscriberList> subscriberListResponse;
+ @Mock
+ private RoleValidatorFactory roleValidatorFactory;
+
private RoleProvider roleProvider;
@BeforeMethod
public void setUp() {
initMocks(this);
- roleProvider = new RoleProvider(aaiService, httpServletRequest -> 5, httpServletRequest -> createRoles());
+ roleProvider = new RoleProvider(aaiService, roleValidatorFactory, httpServletRequest -> 5, httpServletRequest -> createRoles());
}
@Test
@@ -83,7 +87,7 @@ public class RoleProviderTest {
Role role = roleProvider.createRoleFromStringArr(roleParts, SAMPLE_ROLE_PREFIX);
assertThat(role.getEcompRole()).isEqualTo(EcompRole.READ);
- assertThat(role.getSubscribeName()).isEqualTo(SAMPLE_CUSTOMER_ID);
+ assertThat(role.getSubscriberId()).isEqualTo(SAMPLE_SUBSCRIBER_ID);
assertThat(role.getTenant()).isEqualTo(SAMPLE_TENANT);
assertThat(role.getServiceType()).isEqualTo(SAMPLE_SERVICE);
}
@@ -97,7 +101,7 @@ public class RoleProviderTest {
Role role = roleProvider.createRoleFromStringArr(roleParts, SAMPLE_ROLE_PREFIX);
assertThat(role.getEcompRole()).isEqualTo(EcompRole.READ);
- assertThat(role.getSubscribeName()).isEqualTo(SAMPLE_CUSTOMER_ID);
+ assertThat(role.getSubscriberId()).isEqualTo(SAMPLE_SUBSCRIBER_ID);
assertThat(role.getServiceType()).isEqualTo(SAMPLE_SERVICE);
assertThat(role.getTenant()).isNullOrEmpty();
}
@@ -111,7 +115,7 @@ public class RoleProviderTest {
@Test
public void shouldProperlyRetrieveUserRolesWhenPermissionIsDifferentThanRead() {
- Role expectedRole = new Role(EcompRole.READ, SAMPLE_CUSTOMER_ID, SAMPLE_SERVICE, SAMPLE_TENANT);
+ Role expectedRole = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER_ID, SAMPLE_SERVICE, SAMPLE_TENANT, owningEntityId());
setSubscribers();
List<Role> userRoles = roleProvider.getUserRoles(request);
@@ -121,7 +125,7 @@ public class RoleProviderTest {
Role actualRole = userRoles.get(0);
assertThat(actualRole.getTenant()).isEqualTo(expectedRole.getTenant());
- assertThat(actualRole.getSubscribeName()).isEqualTo(expectedRole.getSubscribeName());
+ assertThat(actualRole.getSubscriberId()).isEqualTo(expectedRole.getSubscriberId());
assertThat(actualRole.getServiceType()).isEqualTo(expectedRole.getServiceType());
}
@@ -132,21 +136,38 @@ public class RoleProviderTest {
@Test
public void shouldReturnNotReadOnlyPermissionWhenRolesArePresent() {
- assertThat(roleProvider.userPermissionIsReadOnly(Lists.list(new Role(EcompRole.READ, SAMPLE_SUBSCRIBER, SAMPLE_SERVICE, SAMPLE_TENANT)))).isFalse();
+ assertThat(roleProvider.userPermissionIsReadOnly(Lists.list(new Role(
+ EcompRole.READ, SAMPLE_SUBSCRIBER, SAMPLE_SERVICE, SAMPLE_TENANT, owningEntityId())))).isFalse();
}
@Test
public void userShouldHavePermissionToReadLogsWhenServiceAndTenantAreCorrect() {
- Role withoutPermission = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER, SAMPLE_SERVICE, SAMPLE_TENANT);
- Role withPermission = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER, SERVICE_TYPE_LOGS, TENANT_PERMITTED);
+ Role withoutPermission = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER, SAMPLE_SERVICE, SAMPLE_TENANT, owningEntityId());
+ Role withPermission = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER, SERVICE_TYPE_LOGS, TENANT_PERMITTED, owningEntityId());
assertThat(roleProvider.userPermissionIsReadLogs(Lists.list(withoutPermission, withPermission))).isTrue();
}
+ @Test
+ public void getUserRolesValidator_shouldReturnValidatorFromFactory() {
+ RoleValidator expectedRoleValidator = new AlwaysValidRoleValidator();
+ when(roleValidatorFactory.by(any())).thenReturn(expectedRoleValidator);
+
+ RoleValidator result = roleProvider.getUserRolesValidator(request);
+
+ assertThat(result).isEqualTo(expectedRoleValidator);
+ }
+
+ private String owningEntityId() {
+ // while translateOwningEntityNameToOwningEntityId does nothing, no translation happens.
+ // this will be changed later.
+ return SAMPLE_SUBSCRIBER;
+ }
+
private void setSubscribers() {
Subscriber subscriber = new Subscriber();
subscriber.subscriberName = SAMPLE_SUBSCRIBER;
- subscriber.globalCustomerId = SAMPLE_CUSTOMER_ID;
+ subscriber.globalCustomerId = SAMPLE_SUBSCRIBER_ID;
SubscriberList subscriberList = new SubscriberList(Lists.list(subscriber));
when(aaiService.getFullSubscriberList()).thenReturn(subscriberListResponse);
when(subscriberListResponse.getT()).thenReturn(subscriberList);
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByOwningEntityTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByOwningEntityTest.java
new file mode 100644
index 000000000..d84ac6edd
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByOwningEntityTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.vid.roles;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.withSettings;
+import static org.testng.Assert.assertFalse;
+
+import com.google.common.collect.ImmutableList;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class RoleValidatorByOwningEntityTest {
+
+ private static final String OWNING_ENTITY_ID = "owningEntityId";
+ private static final String SUBSCRIBER_NAME = "subscriber_name";
+ private static final String NOT_MATCHING_OWNING_ENTITY_ID = "notMatchingOwningEntityId";
+
+ private static final String SERVICE_TYPE = "serviceType";
+ private static final String GLOBAL_CUSTOMER_ID = "globalCustomerId";
+ private static final String TENANT_NAME = "tenantName";
+
+
+ private RoleValidatorByOwningEntity roleValidatorByOwningEntity;
+
+ @BeforeMethod
+ public void setup() {
+ final Role SAMPLE_ROLE = new Role(EcompRole.READ, "", "", "", OWNING_ENTITY_ID);
+ roleValidatorByOwningEntity = new RoleValidatorByOwningEntity(ImmutableList.of(SAMPLE_ROLE));
+ }
+
+ @Test
+ public void testIsSubscriberPermitted() {
+ assertFalse(roleValidatorByOwningEntity.isSubscriberPermitted(SUBSCRIBER_NAME));
+ }
+
+ @Test
+ public void isServicePermitted_owningEntityMatch_returnTrue() {
+ PermissionPropertiesOwningEntity permittedOwningEntity =
+ new PermissionPropertiesOwningEntity(OWNING_ENTITY_ID);
+
+ assertThat(roleValidatorByOwningEntity.isServicePermitted(permittedOwningEntity), is(true));
+ }
+
+ @DataProvider
+ public static Object[][] nonMatchingPermissionProperties() {
+ return new Object[][]{
+ {new PermissionPropertiesOwningEntity(NOT_MATCHING_OWNING_ENTITY_ID)},
+ {new PermissionPropertiesOwningEntity("")},
+ {new WithPermissionProperties() {}},
+ {mock(PermissionPropertiesOwningEntity.class,
+ withSettings().name("PermissionPropertiesOwningEntity with null owningEntityId"))},
+ {new PermissionPropertiesSubscriberAndServiceType(OWNING_ENTITY_ID, OWNING_ENTITY_ID)},
+ };
+ }
+
+ @Test(dataProvider = "nonMatchingPermissionProperties")
+ public void isServicePermitted_nonMatchingPermissionProperties_returnFalse(WithPermissionProperties permissionProperties) {
+ assertThat(permissionProperties.toString(), roleValidatorByOwningEntity.isServicePermitted(
+ permissionProperties
+ ), is(false));
+ }
+
+ @Test
+ public void testIsTenantPermitted() {
+ assertFalse(roleValidatorByOwningEntity.isTenantPermitted(GLOBAL_CUSTOMER_ID, SERVICE_TYPE, TENANT_NAME));
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java
deleted file mode 100644
index 9362ec9d7..000000000
--- a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 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.onap.vid.roles;
-
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import java.util.List;
-import java.util.Map;
-import org.onap.vid.mso.rest.RequestDetails;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class RoleValidatorByRolesTest {
-
- private static final String SAMPLE_SUBSCRIBER = "sampleSubscriber";
- private static final String NOT_MATCHING_SUBSCRIBER = "notMatchingSubscriber";
- private static final String SAMPLE_SERVICE_TYPE = "sampleServiceType";
- private static final String NOT_MATCHING_TENANT = "notMatchingTenant";
- private static final String SAMPLE_TENANT = "sampleTenant";
-
- private static final Role SAMPLE_ROLE = new Role(EcompRole.READ, SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, SAMPLE_TENANT);
-
- private List<Role> roles = ImmutableList.of(SAMPLE_ROLE);
- private Map<String, Object> subscriberInfo = ImmutableMap.of("globalSubscriberId", SAMPLE_SUBSCRIBER);
- private Map<String, Object> requestParameters = ImmutableMap.of("subscriptionServiceType", SAMPLE_SERVICE_TYPE);
- private Map<String, Object> requestDetailsProperties = ImmutableMap.of("subscriberInfo", subscriberInfo, "requestParameters", requestParameters);
- private RequestDetails requestDetails;
- private RoleValidatorByRoles roleValidator;
-
- @BeforeMethod
- public void setUp() {
- roleValidator = new RoleValidatorByRoles(roles);
- requestDetails = new RequestDetails();
- }
-
- @Test
- public void shouldPermitSubscriberWhenNameMatchesAndRolesAreEnabled() {
- assertThat(roleValidator.isSubscriberPermitted(SAMPLE_SUBSCRIBER)).isTrue();
- }
-
- @Test
- public void shouldNotPermitSubscriberWhenNameNotMatches() {
- assertThat(roleValidator.isSubscriberPermitted(NOT_MATCHING_SUBSCRIBER)).isFalse();
- }
-
- @Test
- public void shouldPermitServiceWhenNamesMatches() {
- assertThat(roleValidator.isServicePermitted(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE)).isTrue();
- }
-
-
- @Test
- public void shouldNotPermitServiceWhenSubscriberNameNotMatches() {
- assertThat(roleValidator.isServicePermitted(NOT_MATCHING_SUBSCRIBER, SAMPLE_SERVICE_TYPE)).isFalse();
- }
-
- @Test
- public void shouldNotPermitServiceWhenServiceTypeNotMatches() {
- assertThat(roleValidator.isServicePermitted(SAMPLE_SUBSCRIBER, NOT_MATCHING_SUBSCRIBER)).isFalse();
- }
-
- @Test
- public void shouldPermitTenantWhenNameMatches() {
- assertThat(roleValidator.isTenantPermitted(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, SAMPLE_TENANT)).isTrue();
- }
-
-
- @Test
- public void shouldNotPermitTenantWhenNameNotMatches() {
- assertThat(roleValidator.isTenantPermitted(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, NOT_MATCHING_TENANT)).isFalse();
- }
-
- @Test
- public void shouldValidateProperlySORequest() {
- requestDetails.setAdditionalProperty("requestDetails", requestDetailsProperties);
-
- assertThat(roleValidator.isMsoRequestValid(requestDetails)).isTrue();
- }
-
- @Test
- public void shouldValidateUnknownSORequest() {
- assertThat(roleValidator.isMsoRequestValid(new RequestDetails())).isTrue();
- }
-
- @Test
- public void shouldRejectSORequestWhenSubscriberNotMatches() {
- Map<String, Object> subscriberInfo = ImmutableMap.of("globalSubscriberId", "sample");
- Map<String, Object> requestDetailsProperties = ImmutableMap.of("subscriberInfo", subscriberInfo, "requestParameters", requestParameters);
- requestDetails.setAdditionalProperty("requestDetails", requestDetailsProperties);
-
- assertThat(roleValidator.isMsoRequestValid(requestDetails)).isFalse();
- }
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceTypeTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceTypeTest.java
new file mode 100644
index 000000000..b6958cd67
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorBySubscriberAndServiceTypeTest.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.onap.vid.roles;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class RoleValidatorBySubscriberAndServiceTypeTest {
+
+ private static final String SAMPLE_SUBSCRIBER = "sampleSubscriber";
+ private static final String NOT_MATCHING_SUBSCRIBER = "notMatchingSubscriber";
+ private static final String SAMPLE_SERVICE_TYPE = "sampleServiceType";
+ private static final String NOT_MATCHING_TENANT = "notMatchingTenant";
+ private static final String SAMPLE_TENANT = "sampleTenant";
+ private static final String SOME_OWNING_ENTITY_ID = "someOwningEntityId";
+
+ private static final Role SAMPLE_ROLE = new Role(
+ EcompRole.READ, SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, SAMPLE_TENANT, SOME_OWNING_ENTITY_ID);
+
+ private List<Role> roles = ImmutableList.of(SAMPLE_ROLE);
+ private RoleValidatorBySubscriberAndServiceType roleValidatorBySubscriberAndServiceType;
+
+ @BeforeMethod
+ public void setUp() {
+ roleValidatorBySubscriberAndServiceType = new RoleValidatorBySubscriberAndServiceType(roles);
+ }
+
+ @Test
+ public void shouldPermitSubscriberWhenNameMatchesAndRolesAreEnabled() {
+ assertThat(roleValidatorBySubscriberAndServiceType.isSubscriberPermitted(SAMPLE_SUBSCRIBER)).isTrue();
+ }
+
+ @Test
+ public void shouldNotPermitSubscriberWhenNameNotMatches() {
+ assertThat(roleValidatorBySubscriberAndServiceType.isSubscriberPermitted(NOT_MATCHING_SUBSCRIBER)).isFalse();
+ }
+
+ @Test
+ public void shouldPermitServiceWhenNamesMatches() {
+ assertThat(roleValidatorBySubscriberAndServiceType.isServicePermitted(
+ new PermissionPropertiesSubscriberAndServiceType(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE))).isTrue();
+ }
+
+ @Test
+ public void isServicePermitted_serviceWithAllPermissionProperties_isPermitted() {
+ assertThat(roleValidatorBySubscriberAndServiceType.isServicePermitted(
+ new AllPermissionProperties(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, SOME_OWNING_ENTITY_ID))).isTrue();
+ }
+
+ @Test
+ public void shouldNotPermitServiceWhenSubscriberNameNotMatches() {
+ assertThat(
+ roleValidatorBySubscriberAndServiceType.isServicePermitted(
+ new PermissionPropertiesSubscriberAndServiceType(NOT_MATCHING_SUBSCRIBER, SAMPLE_SERVICE_TYPE))).isFalse();
+ }
+
+ @Test
+ public void shouldNotPermitServiceWhenServiceTypeNotMatches() {
+ assertThat(roleValidatorBySubscriberAndServiceType.isServicePermitted(
+ new PermissionPropertiesSubscriberAndServiceType(SAMPLE_SUBSCRIBER, NOT_MATCHING_SUBSCRIBER))).isFalse();
+ }
+
+ @Test
+ public void isServicePermitted_owningEntityPermissionProperties_isNotPermitted() {
+ assertThat(roleValidatorBySubscriberAndServiceType.isServicePermitted(
+ new PermissionPropertiesOwningEntity(SAMPLE_SUBSCRIBER))).isFalse();
+ }
+
+ @Test
+ public void shouldPermitTenantWhenNameMatches() {
+ assertThat(roleValidatorBySubscriberAndServiceType
+ .isTenantPermitted(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, SAMPLE_TENANT)).isTrue();
+ }
+
+ @Test
+ public void shouldPermitTenantWhenNameMatchesCaseInsensitive() {
+ assertThat(roleValidatorBySubscriberAndServiceType
+ .isTenantPermitted(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, SAMPLE_TENANT.toUpperCase())).isTrue();
+ }
+
+
+ @Test
+ public void shouldNotPermitTenantWhenNameNotMatches() {
+ assertThat(roleValidatorBySubscriberAndServiceType
+ .isTenantPermitted(SAMPLE_SUBSCRIBER, SAMPLE_SERVICE_TYPE, NOT_MATCHING_TENANT)).isFalse();
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorFactoryTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorFactoryTest.java
new file mode 100644
index 000000000..b3c71c547
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorFactoryTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2020 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.onap.vid.roles;
+
+import static java.util.Collections.emptyList;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.List;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.properties.Features;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
+
+public class RoleValidatorFactoryTest {
+
+ @InjectMocks
+ private RoleValidatorFactory roleValidatorFactory;
+
+ @Mock
+ private FeatureManager featureManager;
+
+ @BeforeClass
+ public void initMocks() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @AfterMethod
+ public void reset() {
+ Mockito.reset(featureManager);
+ }
+
+ @Test (dataProvider = "presetRoleValidatorClass")
+ public void returnRoleValidatorByGivenClass_And_RoleManagementActivated_And_FeatureFlag(Class expectedClass,boolean isDisabledRoles, boolean flagActive ) {
+
+ when(featureManager.isActive(Features.FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY)).thenReturn(flagActive);
+ RoleValidator roleValidator = roleValidatorFactory.by(emptyList(), isDisabledRoles);
+ assertThat(roleValidator, instanceOf(expectedClass));
+ }
+
+ @DataProvider
+ public static Object[][] presetRoleValidatorClass() {
+ return new Object[][] {
+ {RoleValidatorsComposer.class, false, true},
+ {AlwaysValidRoleValidator.class, true, true},
+ {RoleValidatorBySubscriberAndServiceType.class, false, false},
+ {AlwaysValidRoleValidator.class, true, false}
+ };
+ }
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorsComposerTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorsComposerTest.java
new file mode 100644
index 000000000..c0892dafb
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorsComposerTest.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2020 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.onap.vid.roles;
+
+import static java.util.stream.Collectors.toList;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.withSettings;
+
+import com.google.common.collect.ImmutableSet;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class RoleValidatorsComposerTest {
+
+ private RoleValidator alwaysTrueRoles;
+ private RoleValidator alwaysFalseRoles;
+
+ @DataProvider
+ public static Object[][] allInterfaceFunctions() {
+ return Stream.<Function<RoleValidator, Boolean>>of(
+ (RoleValidator o) -> o.isSubscriberPermitted("subscriberId"),
+ (RoleValidator o) -> o.isServicePermitted(new WithPermissionProperties() {}),
+ (RoleValidator o) -> o.isTenantPermitted("subscriberId", "serviceType", "tenantName")
+ ).map(it -> new Object[]{it}).collect(toList()).toArray(new Object[][]{});
+ }
+
+ @BeforeMethod
+ public void setUp() {
+ alwaysTrueRoles = mock(RoleValidator.class, withSettings().defaultAnswer(o -> true));
+ alwaysFalseRoles = mock(RoleValidator.class);
+ }
+
+ @Test(dataProvider = "allInterfaceFunctions")
+ public void emptyComposite_returnsFalse(Function<RoleValidator, Boolean> interfaceFunction) {
+ RoleValidatorsComposer underTest = new RoleValidatorsComposer();
+
+ assertThat(
+ interfaceFunction.apply(underTest),
+ is(false)
+ );
+
+ }
+
+ @Test(dataProvider = "allInterfaceFunctions")
+ public void falseAndTrueComposite_returnsTrue(Function<RoleValidator, Boolean> interfaceFunction) {
+ RoleValidatorsComposer underTest =
+ new RoleValidatorsComposer(alwaysFalseRoles, alwaysFalseRoles, alwaysTrueRoles);
+
+ assertThat(
+ interfaceFunction.apply(underTest),
+ is(true)
+ );
+ }
+
+ @Test(dataProvider = "allInterfaceFunctions")
+ public void trueAndFalseComposite_returnsTrueAndShortCircuits(Function<RoleValidator, Boolean> interfaceFunction) {
+ RoleValidatorsComposer underTest = new RoleValidatorsComposer(alwaysTrueRoles, alwaysFalseRoles);
+
+ assertThat(
+ interfaceFunction.apply(underTest),
+ is(true)
+ );
+
+ verifyZeroInteractions(alwaysFalseRoles);
+ }
+
+ @Test(dataProvider = "allInterfaceFunctions")
+ public void falseAndFalseComposite_returnsFalse(Function<RoleValidator, Boolean> interfaceFunction) {
+ RoleValidatorsComposer underTest = new RoleValidatorsComposer(alwaysFalseRoles, alwaysFalseRoles);
+
+ assertThat(
+ interfaceFunction.apply(underTest),
+ is(false)
+ );
+ }
+
+ @Test
+ public void secondaryConstructor_givenSetIfValidators_returnsTrue() {
+ RoleValidatorsComposer underTest = new RoleValidatorsComposer(
+ ImmutableSet.of(alwaysTrueRoles)
+ );
+
+ assertThat(underTest.isSubscriberPermitted("anything"), is(true));
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
index d3b2a48b1..a37482624 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
@@ -183,7 +183,7 @@ public class AaiServiceImplTest {
AaiResponse<Services> aaiResponseServices = new AaiResponse<>(services, null, HttpStatus.SC_OK);
when(aaiClient.getSubscriberData(SUBSCRIBER_ID, false)).thenReturn(aaiResponseServices);
- when(roleValidator.isServicePermitted(eq(GLOBAL_CUSTOMER_ID), anyString())).thenReturn(Boolean.TRUE);
+ when(roleValidator.isServicePermitted(any())).thenReturn(Boolean.TRUE);
AaiResponse actualResponse = aaiService.getSubscriberData(SUBSCRIBER_ID, roleValidator, false);
List<ServiceSubscription> actualServiceSubscriptions = ((AaiResponse<Services>) actualResponse)
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java
index 6aa67051e..338657b51 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceTest.java
@@ -23,6 +23,12 @@ package org.onap.vid.services;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.equalTo;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.withSettings;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
@@ -49,6 +55,7 @@ import org.onap.vid.aai.model.ServiceRelationships;
import org.onap.vid.model.aaiTree.AAITreeNode;
import org.onap.vid.roles.Role;
import org.onap.vid.roles.RoleValidator;
+import org.onap.vid.roles.RoleValidatorFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -61,6 +68,9 @@ public class AaiServiceTest {
@Mock
private AaiClientInterface aaiClientInterface;
+ @Mock
+ private RoleValidatorFactory roleValidatorFactory;
+
@BeforeMethod
public void initMocks(){
MockitoAnnotations.initMocks(this);
@@ -68,7 +78,7 @@ public class AaiServiceTest {
@Test
public void testGetSpecificPnf(){
- Pnf pnf = new Pnf("11111", null, null, null, null, null, null);
+ Pnf pnf = Pnf.builder().withPnfId("11111").build();
AaiResponse<Pnf> aaiResponse = new AaiResponse<>(pnf, "aaaa", 200);
Mockito.doReturn(aaiResponse).when(aaiClientInterface).getSpecificPnf(Mockito.anyString());
AaiResponse<Pnf> specificPnf = aaiService.getSpecificPnf("1345667");
@@ -150,8 +160,6 @@ public class AaiServiceTest {
public static Object[][] getTenantsData() {
return new Object[][] {
{"customer1", "serviceType1", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", true},
- {"customer1", "serviceType1", "TeNant1", "customer1", "serviceType1", "tenant1", "id-1", true},
- {"customer1", "serviceType1", "TENANT1", "customer1", "serviceType1", "tenant1", "id-1", true},
{"customer1", "serviceType1", "tenant2", "customer1", "serviceType1", "tenant1", "tenant2", false},
{"customer1", "serviceType1", null, "customer1", "serviceType1", "tenant1", "tenant2", true},
{"customer2", "serviceType1", "tenant1", "customer1", "serviceType1", "tenant1", "id-1", false},
@@ -162,14 +170,20 @@ public class AaiServiceTest {
}
@Test(dataProvider = "getTenantsData")
- public void testGetTenants(String userGlobalCustomerId, String userServiceType, String userTenantName, String serviceGlobalCustomerId,
- String serviceServiceType, String serviceTenantName, String serviceTenantId, boolean expectedIsPermitted) {
+ public void testGetTenants(String userGlobalCustomerId, String userServiceType, String userTenantName,
+ String serviceGlobalCustomerId, String serviceServiceType, String serviceTenantName,
+ String serviceTenantId, boolean expectedIsPermitted) {
GetTenantsResponse[] getTenantsResponses = new GetTenantsResponse[] {new GetTenantsResponse(null, null, serviceTenantName, serviceTenantId, false)};
AaiResponse<GetTenantsResponse[]> aaiResponse = new AaiResponse<>(getTenantsResponses, null, 200);
Mockito.doReturn(aaiResponse).when(aaiClientInterface).getTenants(serviceGlobalCustomerId, serviceServiceType);
- Role role = new Role(null, userGlobalCustomerId, userServiceType, userTenantName);
- RoleValidator roleValidator = RoleValidator.by(Collections.singletonList(role), false);
- AaiResponse<GetTenantsResponse[]> actualTenants = aaiService.getTenants(serviceGlobalCustomerId, serviceServiceType, roleValidator);
+
+ RoleValidator roleValidatorMock = mock(RoleValidator.class);
+ when(roleValidatorMock.isTenantPermitted(
+ eq(userGlobalCustomerId), eq(userServiceType),
+ (userTenantName == null) ? anyString() : eq(userTenantName))
+ ).thenReturn(true);
+
+ AaiResponse<GetTenantsResponse[]> actualTenants = aaiService.getTenants(serviceGlobalCustomerId, serviceServiceType, roleValidatorMock);
assertThat(actualTenants.getT(), arrayWithSize(1));
assertThat(actualTenants.getT()[0].tenantName, equalTo(serviceTenantName));
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
index d215a4331..16d369ba7 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json
@@ -111,7 +111,7 @@
"rollbackOnFailure": false,
"isALaCarte": true,
"collectionResources": {},
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"vidNotions": {
"instantiationUI": "legacy",
"modelCategory": "other",
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
index 91f80e9f1..5c258f66b 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json
@@ -36,7 +36,7 @@
"retainAssignments": false,
"usePreload" : true,
"userParams": [],
- "testApi": "VNF_API"
+ "testApi": "GR_API"
},
"modelInfo": {
"modelType": "vfModule",
diff --git a/vid-app-common/version.properties b/vid-app-common/version.properties
index 819a8c054..ce5339b64 100755
--- a/vid-app-common/version.properties
+++ b/vid-app-common/version.properties
@@ -4,7 +4,7 @@
major=6
minor=0
-patch=2
+patch=3
base_version=${major}.${minor}.${patch}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/execute/setup/SetupCDTest.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/execute/setup/SetupCDTest.java
index b3be16a42..dd08eb312 100644
--- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/execute/setup/SetupCDTest.java
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -171,9 +171,6 @@ public abstract class SetupCDTest extends DriverFactory {
public static void navigateToUrl(String url) {
try {
- System.out.println("Deleting cookies...");
- deleteCookies();
-
System.out.println("Navigating to URL : " + url);
getDriver().navigate().to(url);
GeneralUIUtils.waitForLoader();
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java
index 7c4ce0376..0888bd9c8 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java
@@ -11,22 +11,6 @@ public abstract class BaseMSOPreset extends BasePreset {
public static final String DEFAULT_INSTANCE_ID = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
protected String cloudOwner = DEFAULT_CLOUD_OWNER;
- public static String getRequestBodyWithTestApiOnly() {
- if (Features.FLAG_ADD_MSO_TESTAPI_FIELD.isActive()) {
- return "" +
- "{" +
- " \"requestDetails\": { " +
- " \"requestParameters\": { " +
- " \"testApi\": \"VNF_API\" " +
- " } " +
- " } " +
- "} " +
- "";
- } else {
- return null;
- }
- }
-
protected String addCloudOwnerIfNeeded() {
return Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST.isActive() ?
"\"cloudOwner\": \"" + cloudOwner + "\"," : "";
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOBaseDeleteWithCloudConfiguration.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOBaseDeleteWithCloudConfiguration.java
index 0c813641d..ad7bd0be2 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOBaseDeleteWithCloudConfiguration.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOBaseDeleteWithCloudConfiguration.java
@@ -23,7 +23,7 @@ public abstract class PresetMSOBaseDeleteWithCloudConfiguration extends PresetMS
" \"requestorId\": \"us16807000\"" +
" }," +
" \"requestParameters\": {" +
- " \"testApi\": \"VNF_API\"" +
+ " \"testApi\": \"GR_API\"" +
" }," +
" \"cloudConfiguration\": {" +
" \"lcpCloudRegionId\": \"hvf6\"," +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarte5G.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarte5G.java
index 0b7c6517f..835621a6c 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarte5G.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarte5G.java
@@ -70,7 +70,7 @@ public class PresetMSOCreateNetworkALaCarte5G extends PresetMSOBaseCreateInstanc
" }" +
" ]," +
" \"requestParameters\": {" +
- " \"testApi\": \"VNF_API\"," +
+ " \"testApi\": \"GR_API\"," +
" \"userParams\": []" +
" }" +
" }" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarteOldViewEdit.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarteOldViewEdit.java
index fcad03c58..fd70723ad 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarteOldViewEdit.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateNetworkALaCarteOldViewEdit.java
@@ -38,7 +38,7 @@ public class PresetMSOCreateNetworkALaCarteOldViewEdit extends PresetMSOBaseCrea
" \"modelCustomizationName\": \"AIC30_CONTRAIL_BASIC 0\"" +
" }," +
" \"requestParameters\": {" +
- " \"testApi\": \"VNF_API\"," +
+ " \"testApi\": \"GR_API\"," +
" \"userParams\": []" +
" }," +
" \"cloudConfiguration\": {" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceAlacarte.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceAlacarte.java
index 180aaefd1..a0867e541 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceAlacarte.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceAlacarte.java
@@ -44,7 +44,7 @@ public class PresetMSOCreateServiceInstanceAlacarte extends PresetMSOCreateServi
" \"requestorId\": \""+this.requestorId+"\"" +
" }," +
" \"requestParameters\": {" +
- " \"testApi\": \"VNF_API\"," +
+ " \"testApi\": \"GR_API\"," +
" \"subscriptionServiceType\": \"TYLER SILVIA\"," +
" \"aLaCarte\": true," +
" \"userParams\": []" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2AlacarteService.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2AlacarteService.java
index f80f6bb57..f1de64faa 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2AlacarteService.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2AlacarteService.java
@@ -42,7 +42,7 @@ public class PresetMSOCreateServiceInstanceGen2AlacarteService extends PresetMSO
" \"requestorId\": \"us16807000\" " +
" }, " +
" \"requestParameters\": { " +
- " \"testApi\": \"VNF_API\", " +
+ " \"testApi\": \"GR_API\", " +
" \"subscriptionServiceType\": \"TYLER SILVIA\", " +
" \"aLaCarte\": true, " +
" \"userParams\": [] " +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService.java
index 28705ad89..fcec15536 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService.java
@@ -50,7 +50,7 @@ public class PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService
" \"requestorId\": \"" + userId + "\" " +
" }, " +
" \"requestParameters\": { " +
- " \"testApi\": \"VNF_API\", " +
+ " \"testApi\": \"GR_API\", " +
" \"subscriptionServiceType\": \"TYLER SILVIA\", " +
" \"aLaCarte\": true, " +
" \"userParams\": [] " +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService.java
index cc33a3b14..4ad26cc8f 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService.java
@@ -47,7 +47,7 @@ public class PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService extends
" \"requestorId\": \"us16807000\" " +
" }, " +
" \"requestParameters\": { " +
- " \"testApi\": \"VNF_API\", " +
+ " \"testApi\": \"GR_API\", " +
" \"subscriptionServiceType\": \"TYLER SILVIA\", " +
" \"aLaCarte\": true, " +
" \"userParams\": [] " +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVNFInstanceOnlyRelatedServiceInstance.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVNFInstanceOnlyRelatedServiceInstance.java
index f203a7df6..9ace3596f 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVNFInstanceOnlyRelatedServiceInstance.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVNFInstanceOnlyRelatedServiceInstance.java
@@ -66,7 +66,7 @@ public class PresetMSOCreateVNFInstanceOnlyRelatedServiceInstance extends Preset
" ]," +
" \"requestParameters\": {" +
" \"userParams\": []," +
- " \"testApi\": \"VNF_API\"" +
+ " \"testApi\": \"GR_API\"" +
" }" +
" }" +
"}";
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
index 07a782642..185c4bfe8 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
@@ -76,7 +76,7 @@ public class PresetMSOCreateVfModuleALaCarteE2E extends PresetMSOCreateVfModuleB
+ " \"value\": \"sample\""
+ " }"
+ " ],"
- + " \"testApi\": \"VNF_API\""
+ + " \"testApi\": \"GR_API\""
+ " }"
+ " }"
+ "}";
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteE2E.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteE2E.java
index dba42f32f..07839ba6b 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteE2E.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteE2E.java
@@ -40,6 +40,7 @@ public class PresetMSOCreateVnfALaCarteE2E extends PresetMSOCreateVnfBase {
+ " \"tenantId\": \"092eb9e8e4b7412e8787dd091bc58e86\""
+ " },"
+ " \"requestInfo\": {"
+ + " \"productFamilyId\":\"e433710f-9217-458d-a79d-1c7aff376d89\","
+ " \"source\": \"VID\","
+ " \"suppressRollback\": false,"
+ " \"requestorId\": \""+requestorId+"\""
@@ -59,7 +60,7 @@ public class PresetMSOCreateVnfALaCarteE2E extends PresetMSOCreateVnfBase {
+ " ],"
+ " \"requestParameters\": {"
+ " \"userParams\": [],"
- + " \"testApi\": \"VNF_API\""
+ + " \"testApi\": \"GR_API\""
+ " }"
+ " }"
+ "}";
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteServiceCypress2.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteServiceCypress2.java
index afdb3f49b..bca049d0d 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteServiceCypress2.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteServiceCypress2.java
@@ -30,7 +30,7 @@ public class PresetMSOCreateVnfALaCarteServiceCypress2 extends PresetMSOCreateVn
"\"modelType\":\"vnf\"," +
"\"modelVersion\":\"4.0\"}," +
"\"requestParameters\":{" +
- "\"testApi\": \"VNF_API\", " +
+ "\"testApi\": \"GR_API\", " +
"\"userParams\":[]" +
"}," +
"\"relatedInstanceList\":[" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfGroup.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfGroup.java
index ac2d6f4b9..41e67480e 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfGroup.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfGroup.java
@@ -45,7 +45,7 @@ public class PresetMSOCreateVnfGroup extends PresetMSOBaseCreateInstancePost {
" }" +
" ]," +
" \"requestParameters\": {" +
- " \"testApi\": \"VNF_API\", " +
+ " \"testApi\": \"GR_API\", " +
" \"userParams\": []" +
" }" +
" }" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfVlanTagging.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfVlanTagging.java
index d5faa3f1c..131fe8018 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfVlanTagging.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfVlanTagging.java
@@ -55,7 +55,7 @@ public class PresetMSOCreateVnfVlanTagging extends PresetMSOBaseCreateInstancePo
" }," +
" \"requestParameters\": {" +
" \"userParams\": []," +
- " \"testApi\": \"VNF_API\"" +
+ " \"testApi\": \"GR_API\"" +
" }," +
" \"relatedInstanceList\": [{" +
" \"relatedInstance\": {" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSODeleteALaCarteService.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSODeleteALaCarteService.java
index b20d462e6..0fb9179c2 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSODeleteALaCarteService.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSODeleteALaCarteService.java
@@ -37,7 +37,7 @@ public class PresetMSODeleteALaCarteService extends PresetMSODeleteService {
" \"requestorId\": \"us16807000\"" +
" }," +
" \"requestParameters\": {" +
- " \"testApi\": \"VNF_API\","+
+ " \"testApi\": \"GR_API\","+
" \"aLaCarte\": true" +
" }" +
" }" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.java
index 1d3b8c00a..4c667d9a4 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.java
@@ -1,13 +1,12 @@
package org.onap.simulator.presetGenerator.presets.mso;
-import com.google.common.collect.ImmutableMap;
-import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
-import org.springframework.http.HttpMethod;
+import static java.util.Collections.singletonList;
+import com.google.common.collect.ImmutableMap;
import java.util.List;
import java.util.Map;
-
-import static java.util.Collections.singletonList;
+import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
+import org.springframework.http.HttpMethod;
public class PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork extends BaseMSOPreset {
@@ -82,7 +81,7 @@ public class PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork extend
" \"requestParameters\": {" +
" \"subscriptionServiceType\": \"TYLER SILVIA\"," +
" \"aLaCarte\": true," +
- " \"testApi\": \"VNF_API\"" +
+ " \"testApi\": \"GR_API\"" +
" }," +
" \"project\": {" +
" \"projectName\": \"WATKINS\"" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByRequestId.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByRequestId.java
index 8524d92cd..ee4fd3a67 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByRequestId.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByRequestId.java
@@ -1,13 +1,12 @@
package org.onap.simulator.presetGenerator.presets.mso;
-import com.google.common.collect.ImmutableMap;
-import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
-import org.springframework.http.HttpMethod;
+import static java.util.Collections.singletonList;
+import com.google.common.collect.ImmutableMap;
import java.util.List;
import java.util.Map;
-
-import static java.util.Collections.singletonList;
+import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
+import org.springframework.http.HttpMethod;
public class PresetMSOOrchestrationRequestsGetByRequestId extends BaseMSOPreset {
@@ -57,7 +56,7 @@ public class PresetMSOOrchestrationRequestsGetByRequestId extends BaseMSOPreset
" \"requestParameters\": {" +
" \"subscriptionServiceType\": \"Kennedy\"," +
" \"aLaCarte\": true," +
- " \"testApi\": \"VNF_API\"" +
+ " \"testApi\": \"GR_API\"" +
" }," +
" \"project\": {" +
" \"projectName\": \"Kennedy\"" +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByServiceInstanceId.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByServiceInstanceId.java
index 921776569..cbce5a2c0 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByServiceInstanceId.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOOrchestrationRequestsGetByServiceInstanceId.java
@@ -1,13 +1,12 @@
package org.onap.simulator.presetGenerator.presets.mso;
-import com.google.common.collect.ImmutableMap;
-import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
-import org.springframework.http.HttpMethod;
+import static java.util.Collections.singletonList;
+import com.google.common.collect.ImmutableMap;
import java.util.List;
import java.util.Map;
-
-import static java.util.Collections.singletonList;
+import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
+import org.springframework.http.HttpMethod;
public class PresetMSOOrchestrationRequestsGetByServiceInstanceId extends BaseMSOPreset {
@@ -68,7 +67,7 @@ public class PresetMSOOrchestrationRequestsGetByServiceInstanceId extends BaseMS
" \"requestParameters\": {" +
" \"subscriptionServiceType\": \"Kennedy\"," +
" \"aLaCarte\": true," +
- " \"testApi\": \"VNF_API\"" +
+ " \"testApi\": \"GR_API\"" +
" }," +
" \"project\": {" +
" \"projectName\": \"Kennedy\"" +
@@ -138,7 +137,7 @@ public class PresetMSOOrchestrationRequestsGetByServiceInstanceId extends BaseMS
" \"lcpCloudRegionId\":\"olson5b\"" +
" }," +
" \"requestParameters\":{" +
- " \"testApi\":\"VNF_API\"" +
+ " \"testApi\":\"GR_API\"" +
" }," +
" \"platform\":{" +
" \"platformName\":\"AIC\"" +
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
index f55053497..55b7b3fd0 100644
--- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
@@ -57,6 +57,8 @@ public enum Features implements Feature {
FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE,
FLAG_2002_UNLIMITED_MAX,
FLAG_2004_INSTANTIATION_TEMPLATES_POPUP,
+ FLAG_2006_VFM_SDNC_PRELOAD_FILES,
+ FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY,
;
public boolean isActive() {
diff --git a/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java b/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java
index 92b01d17c..99107aeee 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/ALaCarteflowTest.java
@@ -39,7 +39,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
static final String SERVICE_NAME = "ggghhh";
static final String SERVICE_ID = "537d3eb0-b7ab-4fe8-a438-6166ab6af49b";
static final String VNF_ID = "0eb38f69-d96b-4d5e-b8c9-3736c292f0f7";
- static final String DEFAULT_TEST_API_VALUE = "VNF_API";
+ static final String DEFAULT_TEST_API_VALUE = "GR_API";
public static final String SERVICE_INSTANCE_ID = "SERVICE_INSTANCE_ID";
public static final String A_LACARTE_FLOW_GET_ORCHESTRATION = "aLacarteFlow/get_orchestration_request_status.json";
public static final String ORCHESTRATION_REQUEST_ID = "orchestrationRequestId";
@@ -71,7 +71,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
@Test(dataProvider = "msoTestApiOptions")
- private void testAddVfModule(String msoTestApiOption, String msoTestApiValue) {
+ public void testAddVfModule(String msoTestApiOption, String msoTestApiValue) {
withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bddd";
final String MODEL_UUID = "d205e01d-e5da-4e68-8c52-f95cb0607959";
@@ -104,7 +104,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
}
@Test
- private void testTenant() throws Exception {
+ public void testTenant() throws Exception {
ViewEditPage viewEditPage = new ViewEditPage();
User user = usersService.getUser("Emanuel_with_tenant");
relogin(user.credentials);
@@ -120,7 +120,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
}
@Test(dataProvider = "msoTestApiOptions")
- private void testAddVnf(String msoTestApiOption, String msoTestApiValue) {
+ public void testAddVnf(String msoTestApiOption, String msoTestApiValue) {
withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
final String MODEL_UUID = MODEL;
String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
@@ -145,7 +145,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
}
@Test(dataProvider = "msoTestApiOptions")
- private void requiredLineOfBussiness_confirmVnfWithNoLob(String msoTestApiOption, String msoTestApiValue) throws Exception {
+ public void requiredLineOfBussiness_confirmVnfWithNoLob(String msoTestApiOption, String msoTestApiValue) throws Exception {
withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
goToInstance();
String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
@@ -170,7 +170,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
}
@Test
- private void emptyLobAfterReopenCreateVnfDialog() throws Exception {
+ public void emptyLobAfterReopenCreateVnfDialog() throws Exception {
final String lobToSelect = "ONAP";
goToInstance();
ViewEditPage viewEditPage = new ViewEditPage();
@@ -185,7 +185,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
}
@Test(dataProvider = "msoTestApiOptions")
- private void testAddVolumeGroup(String msoTestApiOption, String msoTestApiValue) throws Exception {
+ public void testAddVolumeGroup(String msoTestApiOption, String msoTestApiValue) throws Exception {
withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bdaa";
final String MODEL_UUID = "13f022c4-651e-4326-b8e1-61e9a8c7a7ad";
@@ -230,8 +230,8 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
@DataProvider
public static Object[][] msoTestApiOptions() {
return new Object[][]{
- {"VNF_API (old)", DEFAULT_TEST_API_VALUE}
- , {"GR_API (new)", "GR_API"}
+ {"GR_API (new)", DEFAULT_TEST_API_VALUE}
+ , {"VNF_API (old)", "VNF_API"}
};
}
@@ -244,7 +244,7 @@ public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
test.run();
} finally {
// back to default
- selectMsoTestApiOption("VNF_API (old)");
+ selectMsoTestApiOption("GR_API (new)");
}
}
}
diff --git a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
index 351e5b03f..e092ad35a 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
@@ -649,7 +649,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
.put("workflow", "" + workflowName + "")
.put("policyYN", "Y")
.put("sniroYN", "Y")
- .put("testApi", "VNF_API")
+ .put("testApi", "GR_API")
.put("vnfType", "vMobileDNS")
.putAll(workflowParams)
.build()
diff --git a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java
index eb3406f5f..3caf59ef6 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java
@@ -1184,12 +1184,15 @@ public class NewServiceInstanceTest extends ModernUITestBase {
browseASDCPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
+
assertSetButtonDisabled(VNF_SET_BUTTON_TEST_ID);
if(isNetwork){
browseASDCPage.selectPlatform("platform");
}else {
SelectOption.selectOptionsFromMultiselectById("multi-selectPlatform", ImmutableList.of("platform"));
+ SelectOption.byTestIdAndVisibleText("TYLER SILVIA", Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID);
+ browseASDCPage.selectProductFamily("e433710f-9217-458d-a79d-1c7aff376d89");
}
browseASDCPage.selectLineOfBusiness("ONAP");
diff --git a/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java
index cbc28d0b0..94af6594b 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/ViewEditServiceInstanceTest.java
@@ -4,8 +4,8 @@ import static org.apache.logging.log4j.core.util.Assert.isNonEmpty;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.matchesPattern;
import static org.hamcrest.collection.IsEmptyCollection.empty;
-import static org.testng.AssertJUnit.assertEquals;
import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
import com.google.common.collect.ImmutableMap;
@@ -14,6 +14,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -55,7 +56,7 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase {
private final String crNetworkText ="NETWORK INSTANCE GROUP: l3network-id-rs804s | ROLE: RosemaProtectedOam.OAM | TYPE: Tenant_Layer_3 | # OF NETWORKS: 3";
private final String crCollectionText ="COLLECTION: collection-name | TYPE: L3-NETWORK";
private final String crInfoText = "\"requestState\": \"COMPLETE\"";
- SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
+ SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.US);
static final String LCP_REGION = "hvf6";
static final String CLOUD_OWNER = "AIC";
static final String TENANT = "bae71557c5bb4d5aac6743a4e5f1d054";
@@ -284,6 +285,7 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase {
viewEditPage.clickCloseButton();
}
+ //this test works only if your browser run at UTC timezone
@Test
public void testTimestampOnDeactivateAndInfoServiceInstance() throws ParseException {
SimulatorApi.clearAll();
@@ -296,7 +298,7 @@ public class ViewEditServiceInstanceTest extends VidBaseTestCase {
goToExistingInstanceById(serviceInstanceId);
Click.byClass("service-info");
GeneralUIUtils.ultimateWait();
- assertEquals("Timestamp isn't the finished time", getTimeatampValue(Constants.ViewEdit.DETAILS_LOG), "Tue, 24 Oct 2017 02:28:39");
+ assertThat("Timestamp isn't the finished time", getTimeatampValue(Constants.ViewEdit.DETAILS_LOG), matchesPattern("Mon, 23 Oct 2017 [0-9]{1,2}:28:39")); //timezone insensitive
viewEditPage.clickCloseButton();
viewEditPage.clickDeactivateButton();
GeneralUIUtils.ultimateWait();
diff --git a/vid-automation/src/main/resources/NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json b/vid-automation/src/main/resources/NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json
index d8aebc746..222f895c4 100644
--- a/vid-automation/src/main/resources/NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json
+++ b/vid-automation/src/main/resources/NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json
@@ -1943,7 +1943,7 @@
"bulkSize": "3",
"aicZoneName": "NFTJSSSS-NFT1",
"owningEntityName": "WayneHolland",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"tenantName": "AIN Web Tool-15-D-testalexandria",
"modelInfo": {
"modelInvariantId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
diff --git a/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarte.json b/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarte.json
index 71ba53661..049626681 100644
--- a/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarte.json
+++ b/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarte.json
@@ -20,7 +20,7 @@
"tenantId" : "c85f0e80-0636-44a4-8cb2-4ec00d056e79",
"tenantName" : "Hedvika Wendelin",
"bulkSize": "1",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte": true
}
diff --git a/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteForTemplate.json b/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteForTemplate.json
index 5b831b937..3abb41f8f 100644
--- a/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteForTemplate.json
+++ b/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteForTemplate.json
@@ -26,7 +26,7 @@
"rollbackOnFailure": true,
"aicZoneName": null,
"owningEntityName": "WayneHolland",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"tenantName": null,
"modelInfo": {
"modelInvariantId": "d1068db8-b933-4919-8972-8bc1aed366c8",
diff --git a/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnf.json b/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnf.json
index c6529c86e..b145f3e9b 100644
--- a/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnf.json
+++ b/vid-automation/src/main/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnf.json
@@ -41,7 +41,7 @@
"tenantId" : "c85f0e80-0636-44a4-8cb2-4ec00d056e79",
"tenantName" : "Hedvika Wendelin",
"bulkSize": "BULK_SIZE",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte": true
}
diff --git a/vid-automation/src/main/resources/registration_to_simulator/add_network/mso_add_network_error.json b/vid-automation/src/main/resources/registration_to_simulator/add_network/mso_add_network_error.json
index 3e31a39df..a6b808888 100644
--- a/vid-automation/src/main/resources/registration_to_simulator/add_network/mso_add_network_error.json
+++ b/vid-automation/src/main/resources/registration_to_simulator/add_network/mso_add_network_error.json
@@ -22,7 +22,7 @@
"modelCustomizationName": "AIC30_CONTRAIL_BASIC 0"
},
"requestParameters": {
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"userParams": []
},
"cloudConfiguration": {
diff --git a/vid-automation/src/main/resources/registration_to_simulator/create_new_instance/deploy/mso_create_svc_instance.json b/vid-automation/src/main/resources/registration_to_simulator/create_new_instance/deploy/mso_create_svc_instance.json
index 5cf1c341f..d6c4ec345 100644
--- a/vid-automation/src/main/resources/registration_to_simulator/create_new_instance/deploy/mso_create_svc_instance.json
+++ b/vid-automation/src/main/resources/registration_to_simulator/create_new_instance/deploy/mso_create_svc_instance.json
@@ -21,7 +21,7 @@
"userParams": [],
"subscriptionServiceType": "TYLER SILVIA",
"aLaCarte": true,
- "testApi": "VNF_API"
+ "testApi": "GR_API"
},
"subscriberInfo": {
"globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
diff --git a/vid-automation/src/main/resources/registration_to_simulator/search_for_service_instance/mso_instance_orch_status_req.json b/vid-automation/src/main/resources/registration_to_simulator/search_for_service_instance/mso_instance_orch_status_req.json
index 1106697cb..e45de76cd 100644
--- a/vid-automation/src/main/resources/registration_to_simulator/search_for_service_instance/mso_instance_orch_status_req.json
+++ b/vid-automation/src/main/resources/registration_to_simulator/search_for_service_instance/mso_instance_orch_status_req.json
@@ -13,7 +13,7 @@
{
"request": {
"requestId": "678cc766-b673-4a50-b9c5-471f68914590",
- "startTime": "Mon, 23 Oct 2017 23:28:39 GMT",
+ "startTime": "Mon, 23 Oct 2017 15:28:39 GMT",
"requestScope": "service",
"requestType": "createInstance",
"instanceReferences": {
@@ -24,7 +24,7 @@
"requestState": "COMPLETE",
"statusMessage": "Service Instance was created successfully.",
"percentProgress": 100,
- "finishTime": "Mon, 23 Oct 2017 23:28:39 GMT"
+ "finishTime": "Mon, 23 Oct 2017 15:28:39 GMT"
}
}
}
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
index 555c2edcf..e170c450f 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
@@ -2,6 +2,7 @@ package org.onap.vid.api;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.defaultPlacement;
import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofL3Network;
@@ -13,12 +14,15 @@ import static org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPo
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.AssertJUnit.assertEquals;
+import static vid.automation.test.Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS;
import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET;
import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
import static vid.automation.test.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
@@ -898,6 +902,35 @@ public class AaiApiTest extends BaseApiAaiTest {
assertThat(response.getBody(), jsonEquals(getResourceAsString(AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS)));
}
+ @Test
+ public void searchServiceInstances_serviceInstanceOfAnotherSubscriber_authIsFollwingFeatureToggle() {
+ String craigRobertsSubscriberId = "31739f3e-526b-11e6-beb8-9e71128cae77";
+ String aServiceInstanceId = "4ea864f2-b946-473a-b51c-51a7c10b8391";
+ String aServiceOwningEntityId = "f160c875-ddd1-4ef5-84d8-d098784daa3a";
+ String currentUserAuthorizedOwningEntityId = "SILVIA ROBBINS"; // this will need to change with translateOwningEntityNameToOwningEntityId
+
+ boolean expectedPermission = Features.FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY.isActive();
+
+ SimulatorApi.registerExpectation(GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS,
+ ImmutableMap.of(aServiceOwningEntityId, currentUserAuthorizedOwningEntityId), CLEAR_THEN_SET);
+
+ JsonNode serviceInstancesResult = restTemplate
+ .getForObject(uri + "/search_service_instances?subscriberId=" + craigRobertsSubscriberId, JsonNode.class);
+
+ assertThat(serviceInstancesResult.path("service-instances").isArray(), is(true));
+
+ ArrayNode servicesArray = ((ArrayNode) serviceInstancesResult.path("service-instances"));
+
+ JsonNode aServiceResult = Streams.fromIterator(servicesArray.iterator())
+ .filter(it -> it.path("serviceInstanceId").asText().equals(aServiceInstanceId))
+ .findAny()
+ .orElseThrow(() -> new AssertionError("could not find serviceInstanceId=" + aServiceInstanceId));
+
+ assertThat(aServiceResult.toString(),
+ aServiceResult.path("isPermitted").booleanValue(), is(expectedPermission));
+
+ }
+
private void assertResponse(Object expected, String response) {
assertResponse(Configuration.empty(), expected, response);
}
diff --git a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
index 9651002b2..962a7860f 100644
--- a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
@@ -18,7 +18,6 @@ import static org.hamcrest.Matchers.matchesPattern;
import static vid.automation.test.services.SimulatorApi.retrieveRecordedRequests;
import com.fasterxml.jackson.databind.JsonNode;
-
import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
@@ -28,12 +27,15 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
import org.onap.vid.api.BaseApiTest;
+import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -234,12 +236,29 @@ public class LoggerFormatTest extends BaseApiTest {
}
private JsonNode getCheckerResults (String logtype, String logLines){
+
+ final int MAX_RETRIES = 3;
+
Map<String, String> params = new HashMap<>();
params.put("format", "raw");
params.put("type", logtype);
params.put("component", "vid");
params.put("data", logLines);
- return restTemplate.postForObject(logChecker, params, JsonNode.class);
+ for (int i=0; i< MAX_RETRIES; i++) {
+ try {
+ return restTemplate.postForObject(logChecker, params, JsonNode.class);
+ } catch (RestClientException exception) { //retry for cases that logchecker is not available immediately
+ logger.error("Failed to call to logChecker try: " + i, exception);
+ if (i<(MAX_RETRIES-1)) { //no need to sleep on last retry
+ try {
+ Thread.sleep((new Random().nextInt(2000) + 1000)); //random sleep between 1-3 seconds
+ } catch (InterruptedException e) {
+ ExceptionUtils.rethrow(e);
+ }
+ }
+ }
+ }
+ throw new AssertionError("failed to call to logChecker after max retries: "+MAX_RETRIES);
}
}
diff --git a/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json b/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json
index d1a777028..34805e1d4 100644
--- a/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json
+++ b/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json
@@ -43,6 +43,6 @@
"modelType": "service",
"modelVersion": "1.0"
},
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"action": "Delete"
}
diff --git a/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json b/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json
index cb2f2011c..88757da22 100644
--- a/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json
+++ b/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json
@@ -208,5 +208,5 @@
"modelVersion": "1.0"
},
- "testApi": "VNF_API"
+ "testApi": "GR_API"
}
diff --git a/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json b/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json
index b7c6dc2a5..7dfe064d0 100644
--- a/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json
+++ b/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json
@@ -163,7 +163,7 @@
"instanceName": "SERVICE_INSTANCE_NAME",
"owningEntityName": null,
"rollbackOnFailure": false,
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte": true,
"vidNotions": {
"instantiationUI": "serviceWithVnfGrouping",
diff --git a/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json b/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json
index d6cf636de..5d8843a8c 100644
--- a/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json
+++ b/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json
@@ -182,5 +182,5 @@
"modelType": "service",
"modelVersion": "1.0"
},
- "testApi": "VNF_API"
+ "testApi": "GR_API"
}
diff --git a/vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json b/vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json
index bb0334b7a..478c32a64 100644
--- a/vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json
+++ b/vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json
@@ -64,7 +64,7 @@
"subscriberName": "SILVIA ROBBINS",
"owningEntityName": "WayneHolland",
"rollbackOnFailure": true,
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte": true,
"isDirty":true,
"action": "Create"
diff --git a/vid-automation/src/test/resources/VnfGroup/vnfGroupCreate1VnfGroupAndDelete2VnfGroupsRequest.json b/vid-automation/src/test/resources/VnfGroup/vnfGroupCreate1VnfGroupAndDelete2VnfGroupsRequest.json
index 2e0f85ee4..e29471217 100644
--- a/vid-automation/src/test/resources/VnfGroup/vnfGroupCreate1VnfGroupAndDelete2VnfGroupsRequest.json
+++ b/vid-automation/src/test/resources/VnfGroup/vnfGroupCreate1VnfGroupAndDelete2VnfGroupsRequest.json
@@ -119,5 +119,5 @@
"modelVersion": "1.0"
},
- "testApi": "VNF_API"
+ "testApi": "GR_API"
}
diff --git a/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json b/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json
index cabdbca38..aeaf6b65d 100644
--- a/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json
+++ b/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json
@@ -43,7 +43,7 @@
"subscriptionServiceType": "service-instance-type",
"tenantId": null,
"tenantName": null,
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"validationCounter": 0,
"vnfGroups": {
"VNF_GROUP1_INSTANCE_ID": {
diff --git a/vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json b/vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json
index 7cf11c824..5f789e0ed 100644
--- a/vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json
+++ b/vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json
@@ -23,8 +23,7 @@
},
"type": "VL",
"instanceName" : "NetInstance",
- "modelCustomizationName": "ExtVL 0",
- "isFailed": true
+ "modelCustomizationName": "ExtVL 0"
}
},
"vnfs": {
diff --git a/vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json b/vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json
index d5b282e89..aa1945f94 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json
@@ -57,7 +57,7 @@
"bulkSize": 1,
"rollbackOnFailure": "false",
"isALaCarte": true,
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"instanceId": "INSTANCE_ID",
"action": "None",
"trackById": "TRACK_BY_ID",
diff --git a/vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json b/vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json
index 28761f393..0d840daed 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json
@@ -33,7 +33,7 @@
"subscriptionServiceType": "TYLER SILVIA",
"tenantId": "c85f0e80-0636-44a4-8cb2-4ec00d056e79",
"tenantName": "Hedvika Wendelin",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"trackById": "TRACK_BY_ID",
"vnfGroups": {
},
diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json
index 15d506b47..bb3fb155b 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json
@@ -75,7 +75,6 @@
"action": "Create",
"instanceId": null,
"instanceName": "hvf6arlba007",
- "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"vnfStoreKey": "vProbe_NC_VNF 0",
"instanceParams": [
{
@@ -169,7 +168,6 @@
},
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
"instanceName": "hvf6arlba008",
- "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"vnfStoreKey": "vProbe_NC_VNF 0_1",
"action": "Create",
"platformName": "xxx1",
diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json
index daccff0be..f186f90a6 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json
@@ -45,7 +45,6 @@
},
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
"instanceName": "hvf6arlba007",
- "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"action": "Create",
"platformName": "xxx1",
"lcpCloudRegionId": "hvf6",
@@ -123,7 +122,6 @@
},
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
"instanceName": "hvf6arlba008",
- "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"action": "Create",
"platformName": "xxx1",
"lcpCloudRegionId": "hvf6",
diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarte.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarte.json
index 71ba53661..049626681 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarte.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarte.json
@@ -20,7 +20,7 @@
"tenantId" : "c85f0e80-0636-44a4-8cb2-4ec00d056e79",
"tenantName" : "Hedvika Wendelin",
"bulkSize": "1",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte": true
}
diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnfGroup.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnfGroup.json
index 430675256..d458b63c5 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnfGroup.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateALaCarteWithVnfGroup.json
@@ -38,7 +38,7 @@
"tenantId" : "c85f0e80-0636-44a4-8cb2-4ec00d056e79",
"tenantName" : "Hedvika Wendelin",
"bulkSize": "1",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte": true
}
diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json
index f6373bfb4..0dc9321fe 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json
@@ -291,5 +291,5 @@
},
"orchStatus": "Active",
"modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450",
- "testApi": "VNF_API"
+ "testApi": "GR_API"
}
diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDeleteServiceWithVnf.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDeleteServiceWithVnf.json
index ac5f7faf9..9cbbfceaf 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDeleteServiceWithVnf.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDeleteServiceWithVnf.json
@@ -67,5 +67,5 @@
"isALaCarte": true,
"orchStatus": "Active",
"modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450",
- "testApi": "VNF_API"
+ "testApi": "GR_API"
} \ No newline at end of file
diff --git a/vid-automation/src/test/resources/registration_to_simulator/body_jsons/mso_request_delete_or_unassign_service_instance.json b/vid-automation/src/test/resources/registration_to_simulator/body_jsons/mso_request_delete_or_unassign_service_instance.json
index 3b0204aa7..951eac1fb 100644
--- a/vid-automation/src/test/resources/registration_to_simulator/body_jsons/mso_request_delete_or_unassign_service_instance.json
+++ b/vid-automation/src/test/resources/registration_to_simulator/body_jsons/mso_request_delete_or_unassign_service_instance.json
@@ -12,7 +12,7 @@
"requestorId": "16807000"
},
"requestParameters": {
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"aLaCarte": false
}
}
diff --git a/vid-automation/src/test/resources/viewEdit/ServiceTreeWithMultipleChildren_serviceInstance_withUpdatedLatestVersion.json b/vid-automation/src/test/resources/viewEdit/ServiceTreeWithMultipleChildren_serviceInstance_withUpdatedLatestVersion.json
index cf805b7ba..2fdda8fa0 100644
--- a/vid-automation/src/test/resources/viewEdit/ServiceTreeWithMultipleChildren_serviceInstance_withUpdatedLatestVersion.json
+++ b/vid-automation/src/test/resources/viewEdit/ServiceTreeWithMultipleChildren_serviceInstance_withUpdatedLatestVersion.json
@@ -15,7 +15,7 @@
"aicZoneName":null,
"projectName":null,
"rollbackOnFailure":null,
- "isALaCarte":false,
+ "isALaCarte":true,
"modelInfo":{
"modelInvariantId":"d27e42cf-087e-4d31-88ac-6c4b7585f800",
"modelVersionId": "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
diff --git a/vid-automation/src/test/resources/vrf/vrfServiceCreateRequest.json b/vid-automation/src/test/resources/vrf/vrfServiceCreateRequest.json
index a3fcd0e4e..2d7121729 100644
--- a/vid-automation/src/test/resources/vrf/vrfServiceCreateRequest.json
+++ b/vid-automation/src/test/resources/vrf/vrfServiceCreateRequest.json
@@ -183,7 +183,7 @@
"rollbackOnFailure": true,
"aicZoneName": null,
"owningEntityName": "WayneHolland",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"modelInfo": {
"modelInvariantId": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb",
"modelVersionId": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
diff --git a/vid-ext-services-simulator/src/main/resources/download_files/service-PASQUALEVmxVpeBvService488-csar-annotations.zip b/vid-ext-services-simulator/src/main/resources/download_files/service-PASQUALEVmxVpeBvService488-csar-annotations.zip
deleted file mode 100644
index a1f1f5d83..000000000
--- a/vid-ext-services-simulator/src/main/resources/download_files/service-PASQUALEVmxVpeBvService488-csar-annotations.zip
+++ /dev/null
Binary files differ
diff --git a/vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar.zip b/vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar.zip
deleted file mode 100644
index 2967a50ec..000000000
--- a/vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar.zip
+++ /dev/null
Binary files differ
diff --git a/vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar_ecomp_false6.zip b/vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar_ecomp_false6.zip
deleted file mode 100644
index dfd929875..000000000
--- a/vid-ext-services-simulator/src/main/resources/download_files/service-vDOROTHEASrv-csar_ecomp_false6.zip
+++ /dev/null
Binary files differ
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
index d1bee9c70..f7419ef33 100644
--- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
@@ -25,7 +25,7 @@ describe('Drawing Board: Instantiation Templates', function () {
it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, () => {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
// Then...
cy.getElementByDataTestsId("node-vProbe_NC_VNF 0").should('be.visible');
@@ -34,7 +34,7 @@ describe('Drawing Board: Instantiation Templates', function () {
it('Given a template - User can remove existing VNF', () => {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0');
removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0');
@@ -47,7 +47,7 @@ describe('Drawing Board: Instantiation Templates', function () {
});
it('Given a template - User can add new VNF', () => {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
// add new node
addNewNode('node-vProbe_NC_VNF 0-add-btn')
.fillVnfPopup()
@@ -66,10 +66,10 @@ describe('Drawing Board: Instantiation Templates', function () {
// check instance name not change if empty
- editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0)
+ cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0)
.clearInput('instanceName');
cy.getElementByDataTestsId('form-set').click({force: true}).then((done) => {
- editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0)
+ cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0)
.getElementByDataTestsId('instanceName').should('be.empty')
});
});
@@ -77,8 +77,8 @@ describe('Drawing Board: Instantiation Templates', function () {
it('Given a template - User can Duplicate VNF', () => {
const numberOfDuplicate: number = 4;
- loadDrawingBoardWithRecreateMode();
- nodeAction('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 'Duplicate')
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
+ cy.nodeAction('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 'Duplicate')
.getElementByDataTestsId('duplicate-amount-vfmodules').select(numberOfDuplicate.toString())
.getTagElementContainsText('button', 'Duplicate').click()
.getDrawingBoardDeployBtn().click()
@@ -89,10 +89,10 @@ describe('Drawing Board: Instantiation Templates', function () {
it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected and deploy without changes', () => {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
// Then...
- editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0")
+ cy.editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0")
.getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007')
.getElementByDataTestsId("productFamily").should('contain', 'Emanuel')
.getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1')
@@ -102,14 +102,14 @@ describe('Drawing Board: Instantiation Templates', function () {
.checkPlatformValue('xxx1')
.getElementByDataTestsId("cancelButton").click();
- editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0")
+ cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0")
.getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007_lba_Base_01')
.getElementByDataTestsId("lcpRegion").should('contain', 'hvf6')
.getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1')
.getElementByDataTestsId("rollback").should('contain', 'Rollback')
.getElementByDataTestsId("cancelButton").click();
- editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1")
+ cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1")
.getElementByDataTestsId("instanceName").should('have.value', 'my_hvf6arlba007_lba_dj_01')
.getElementByDataTestsId("volumeGroupName").should('have.value', 'my_special_hvf6arlba007_lba_dj_01_vol')
.getElementByDataTestsId("lcpRegion").should('contain', 'hvf6')
@@ -126,7 +126,7 @@ describe('Drawing Board: Instantiation Templates', function () {
it(`Given a stored template - when "edit" service is opened - then template’s details are visible as expected`, function () {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
cy.openServiceContextMenu()
.getElementByDataTestsId("context-menu-header-edit-item").click()
@@ -140,7 +140,7 @@ describe('Drawing Board: Instantiation Templates', function () {
});
it(`Given a stored template - add one VfModule, edit its details, and deploy - deploy is added with the vfModule details`, () => {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
let newVfModuleName = "new.vfmodule.name";
let module1ModelId = "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1";
@@ -153,7 +153,7 @@ describe('Drawing Board: Instantiation Templates', function () {
cy.drawingBoardPressAddButtonByElementName(`node-${module1CustomizationId}`)
.click({force: true});
- editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1);
+ cy.editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1);
cy.clearInput("instanceName");
cy.typeToInput("instanceName", newVfModuleName);
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
@@ -196,8 +196,8 @@ describe('Drawing Board: Instantiation Templates', function () {
it('Given a template - User can remove existing vfmodule', function () {
- loadDrawingBoardWithRecreateMode();
- nodeAction('node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1', 'Remove');
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
+ cy.nodeAction('node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1', 'Remove');
let removed_vfModule_Path = [
...vnfPath, "vfModules",
"vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
@@ -217,7 +217,7 @@ describe('Drawing Board: Instantiation Templates', function () {
it(`Given a stored template - edit service vnf and vfmodule ${testCase.desc} - deploy request should be ${testCase.desc}`, function () {
- loadDrawingBoardWithRecreateMode();
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
//edit service
cy.openServiceContextMenu();
@@ -229,7 +229,7 @@ describe('Drawing Board: Instantiation Templates', function () {
cy.getElementByDataTestsId('form-set').click();
// edit vnf
- editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0");
+ cy.editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0");
if (testCase.modifySomeValues) {
cy.selectPlatformValue('platform');
cy.selectDropdownOptionByText("tenant", "CESAR-100-D-spjg61909");
@@ -237,7 +237,7 @@ describe('Drawing Board: Instantiation Templates', function () {
cy.getElementByDataTestsId('form-set').click();
//edit vf module
- editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0");
+ cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0");
if (testCase.modifySomeValues) {
cy.getElementByDataTestsId('sdncPreLoad').click();
}
@@ -266,7 +266,7 @@ describe('Drawing Board: Instantiation Templates', function () {
it(`Given a stored template of Network - - it is loaded`, () => {
- loadDrawingBoardWithRecreateModeNetwork();
+ cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup);
// Then...
cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible');
@@ -276,9 +276,9 @@ describe('Drawing Board: Instantiation Templates', function () {
it(`Given a stored template of Network - User can remove existing network`, () => {
- loadDrawingBoardWithRecreateModeNetwork();
+ cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup);
- nodeAction('node-01f4c475-3f89-4f00-a2f4-39a873dba0ae-SR-IOV Provider 2-1', 'Remove');
+ cy.nodeAction('node-01f4c475-3f89-4f00-a2f4-39a873dba0ae-SR-IOV Provider 2-1', 'Remove');
let removed_network_Path = [
"networks", "SR-IOV Provider 2-1",
];
@@ -295,7 +295,7 @@ describe('Drawing Board: Instantiation Templates', function () {
it('Given a template - User can add a new network', () => {
- loadDrawingBoardWithRecreateModeNetwork();
+ cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup);
// add new node
addNewNode('node-SR-IOV Provider 2-1-add-btn')
@@ -341,58 +341,14 @@ const vnfPath2 = [
"vnfs", "vProbe_NC_VNF 0_1"
];
-function loadDrawingBoardWithRecreateMode() {
- loadDrawingBoardWithRecreateModeInternal(
- '../../' + templateWithVnfSetup.instanceTemplateFile,
- templateWithVnfSetup.serviceModelId,
- templateWithVnfSetup.serviceModelFile);
-}
-
-function loadDrawingBoardWithRecreateModeNetwork() {
- loadDrawingBoardWithRecreateModeInternal(
- '../../' + templateWithNetworkSetup.instanceTemplateFile,
- templateWithNetworkSetup.serviceModelId,
- templateWithNetworkSetup.serviceModelFile);
-}
-
-function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) {
- const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";
-
- const drawingBoardAction = `RECREATE`;
- const templateTopologyEndpoint = "templateTopology";
- cy.route(`**/rest/models/services/${serviceModelIdToLoad}`,
- 'fixture:' + serviceModel)
- .as('serviceModel');
-
- cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`,
- 'fixture:' + instanceTemplate)
- .as('templateTopology');
-
- // When...
- cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
- `?jobId=${templateUuid}` +
- `&serviceModelId=${serviceModelIdToLoad}`);
-
- cy.wait('@serviceModel');
- cy.wait('@templateTopology');
-}
-
-function nodeAction(dataTestId: string, action: string, index ?: number) {
- return cy.drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId, index)
- .drawingBoardTreeClickOnContextMenuOptionByName(action)
-}
-
-function editNode(dataTestId: string, index ?: number) {
- return nodeAction(dataTestId, 'Edit', index);
-}
function addNewNode(dataTestId: string) {
return cy.getElementByDataTestsId(dataTestId).click({force: true})
}
function removeVNFWithVFModules(dataTestId: string) {
- return nodeAction(dataTestId, 'Remove')
+ return cy.nodeAction(dataTestId, 'Remove')
.getTagElementContainsText('button', 'Remove VNF').click()
}
@@ -465,6 +421,7 @@ function mockAsyncBulkResponse() {
url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
method: 'POST',
status: 200,
- response: "[]",
+ response: true,
}).as("expectedPostAsyncInstantiation");
}
+
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
index dd51457e9..f76babe76 100644
--- a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
@@ -97,7 +97,7 @@ describe('Template', () => {
// check table body row
cy.getElementByDataTestsId(`userId-${templateJobIdFromE2EFile}`).contains('16807000');
- cy.getElementByDataTestsId(`createDate-${templateJobIdFromE2EFile}`).contains('2019-12-26 11:57:05');
+ cy.getElementByDataTestsId(`createDate-${templateJobIdFromE2EFile}`).contains(/2019-12-26 [0-9]{1,2}:57:05/); //timezone insensitive
cy.getElementByDataTestsId(`instanceName-${templateJobIdFromE2EFile}`).contains('SERVICE_NAME');
cy.getElementByDataTestsId(`instantiationStatus-${templateJobIdFromE2EFile}`).contains('IN_PROGRESS');
cy.getElementByDataTestsId(`summary-${templateJobIdFromE2EFile}`).contains('vnf: 1, vfModule: 2, volumeGroup: 1');
diff --git a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts
index e544720a7..005babbc6 100644
--- a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts
@@ -56,7 +56,7 @@ describe('Retry Page', function () {
cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
- cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click();
+ cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click();
cy.get('.failed-msg').should('have.length', 5);
cy.get('.newIcon').should('have.length', 4);
@@ -133,7 +133,7 @@ describe('Retry Page', function () {
cy.openIframe(`app/ui/#/servicePlanning/RETRY?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
- cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click();
+ cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click();
cy.get('.failed-msg').should('have.length', 4);
cy.get('.newIcon').should('have.length', 4);
diff --git a/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts
new file mode 100644
index 000000000..877506cad
--- /dev/null
+++ b/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts
@@ -0,0 +1,92 @@
+describe('SDNC preload ', () => {
+
+ beforeEach(() => {
+ cy.clearSessionStorage();
+ cy.setTestApiParamToGR();
+ cy.initAAIMock();
+ cy.initGetAAISubDetails();
+ cy.initVidMock();
+ cy.initDrawingBoardUserPermission();
+ cy.login();
+ });
+
+ afterEach(() => {
+ cy.screenshot();
+ });
+
+ it('feature toggle is on and SDNC is checked then SDNC preload file is enable : upload success' , () => {
+ mockPreloadResult(true, 200);
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
+ cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1");
+ checkUploadLinkLogic();
+
+ uploadFile().then(() => {
+ cy.get('.sdc-modal__content').should('contain', 'The pre-load file(s) have been uploaded successfully.');
+ cy.getElementByDataTestsId('button-ok').click()
+ .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload another')
+ });
+ });
+
+ it('feature toggle is on and SDNC is checked then SDNC preload file is enable : upload fail', () => {
+ mockPreloadResult(false, 200);
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
+
+ cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1");
+ checkUploadLinkLogic();
+
+ uploadFile().then(() => {
+ cy.get('.sdc-modal__content').should('contain', 'Failed to upload one or more of the files, please retry.');
+ cy.getElementByDataTestsId('button-ok').click()
+ .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload')
+ });
+ });
+});
+
+
+let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/';
+
+const templateWithVnfSetup = {
+ serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38',
+ instanceTemplateFile: apiTestResources + 'templates__instance_template.json',
+ instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json',
+ serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json',
+};
+
+function mockAsyncBulkResponse() {
+ cy.server().route({
+ url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
+ method: 'POST',
+ status: 200,
+ response: true,
+ }).as("expectedPostAsyncInstantiation");
+}
+
+function mockPreloadResult(response: boolean, status?: number) {
+ cy.server().route({
+ url: Cypress.config('baseUrl') + '/preload',
+ method: 'POST',
+ status: status ? status : 200,
+ response: response,
+ }).as("preload");
+}
+
+
+function uploadFile() {
+ // @ts-ignore
+ return new Promise((resolve) => {
+ const fileName = '../support/uploadFiles/sdncPreLoadFileExample.json';
+ cy.fixture(fileName).then(fileContent => {
+ // @ts-ignore
+ cy.get('input[type=file]').eq(0).upload({fileContent, fileName, mimeType: 'application/json'}).then(() => {
+ resolve();
+ });
+ })
+ });
+}
+
+function checkUploadLinkLogic() {
+ cy.getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload').should('not.have.class', 'disabled')
+ .getElementByDataTestsId('sdncPreLoad').click()
+ .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload').should('have.class', 'disabled')
+ .getElementByDataTestsId('sdncPreLoad').click()
+}
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
index 09734472c..ac5790ddf 100644
--- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
@@ -16,6 +16,8 @@ export const initServicePlanning = function (viewOrEdit: string, customModelFile
}
cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => {
+ res.service.instantiationType = "A-La-Carte";
+ res.service.vidNotions.instantiationType = "ALaCarte";
jsonBuilderAndMock.basicJson(
res,
Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
@@ -133,7 +135,7 @@ describe('View Edit Page: Upgrade VFModule', function () {
beforeEach(() => {
cy.clearSessionStorage();
- cy.setTestApiParamToVNF();
+ cy.setTestApiParamToGR();
cy.initVidMock();
cy.login();
});
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts
index 60b2e123d..de5facf89 100644
--- a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts
@@ -113,13 +113,13 @@ describe('View only drawing board', function () {
cy.getElementByDataTestsId('node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');
//testing right side
- cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
- cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click({force: true});
+ cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.length', 3).and('have.text', 'VNFVNFVNF');
+ cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click({force: true});
cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');
//check vnf node tree sub header
- cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created');
- cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', '');
+ cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Created');
+ cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', '');
cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist');
//check vf Module node tree sub header
diff --git a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts
index dc1b4bbf2..a0882f5bf 100644
--- a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts
@@ -12,7 +12,7 @@ describe('Vnf Groups', function () {
cy.initAAIMock();
cy.initVidMock();
cy.permissionVidMock();
- cy.setTestApiParamToVNF();
+ cy.setTestApiParamToGR();
cy.login();
});
@@ -20,6 +20,42 @@ describe('Vnf Groups', function () {
cy.screenshot();
});
+ function updateObject(obj: any, key: string, val: any, value:any) {
+ return JSON.parse(JSON.stringify(obj)
+ .replace(new RegExp(`"${key}":"${val}"`), `"${key}":"${value}"`))
+ }
+
+ function buildReduxStateWithServiceRespone(res: any, serviceId:string, isEcompGeneratedNaming:boolean) :void {
+ res = updateObject(res, "ecomp_generated_naming", !isEcompGeneratedNaming, isEcompGeneratedNaming);
+ cy.window().then((win) => {
+ win.sessionStorage.setItem('reduxState', JSON.stringify({
+ "global": {
+ "name": null
+ },
+ "service": {
+ "serviceHierarchy": {
+ [serviceId] : res
+ },
+ "serviceInstance": {
+ [serviceId]: {
+ "modelInfo" : {
+ "modelVersionId" : serviceId
+ },
+ "existingVNFCounterMap": {},
+ "existingVnfGroupCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "vnfs": {},
+ "vnfGroups": {},
+ "isEcompGeneratedNaming": isEcompGeneratedNaming,
+ "existingNames": {},
+ "vidNotions": res.service.vidNotions
+ }
+ }
+ }
+ }));
+ });
+ }
+
describe('Vnf Group model basic view', function () {
it('Vnf group open new view edit', function () {
@@ -36,7 +72,7 @@ describe('Vnf Groups', function () {
"ServiceWithVnfGroup",
);
- cy.buildReduxStateWithServiceRespone(res, serviceId, false);
+ buildReduxStateWithServiceRespone(res, serviceId, false);
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + serviceId);
cy.getElementByDataTestsId('node-' + groupName).find(`[data-tests-id='node-type-indicator']`).contains('G');
cy.getElementByDataTestsId('node-' + groupName).contains('' + groupName);
diff --git a/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts
index 6700ff425..529d96a3b 100644
--- a/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts
@@ -480,7 +480,7 @@ describe('Drawing board : VRF', function () {
"rollbackOnFailure": "true",
"aicZoneName": null,
"owningEntityName": "WayneHolland",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"modelInfo": {
"modelInvariantId": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb",
"modelVersionId": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
diff --git a/vid-webpack-master/cypress/pipeline/group1.txt b/vid-webpack-master/cypress/pipeline/group1.txt
index 0b3425060..a9b5aef46 100644
--- a/vid-webpack-master/cypress/pipeline/group1.txt
+++ b/vid-webpack-master/cypress/pipeline/group1.txt
@@ -6,3 +6,5 @@ cypress/integration/iFrames/collectionResource.e2e.ts
cypress/integration/iFrames/commitDialog.e2e.ts
cypress/integration/iFrames/drawingBoard.e2e.ts
cypress/integration/iFrames/instantiation-templates.e2e.ts
+cypress/integration/iFrames/instantiation.templates.modal.e2e.ts
+cypress/integration/iFrames/instantiationStatus.e2e.ts
diff --git a/vid-webpack-master/cypress/pipeline/group2.txt b/vid-webpack-master/cypress/pipeline/group2.txt
deleted file mode 100644
index 7d808dd8a..000000000
--- a/vid-webpack-master/cypress/pipeline/group2.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-cypress/integration/iFrames/network.popup.e2e.ts
-cypress/integration/iFrames/permission.e2e.ts
-cypress/integration/iFrames/pnf.e2e.ts
-cypress/integration/iFrames/retry.e2e.ts
-cypress/integration/iFrames/searchExistingInstance.e2e.ts
-cypress/integration/iFrames/service.popup.e2e.ts
-cypress/integration/iFrames/serviceWithNetwork.e2e.ts
-cypress/integration/iFrames/serviceWithVnfNetwork.e2e.ts
-cypress/integration/iFrames/softDeleteAndResume.e2e.ts
-cypress/integration/iFrames/tenantIsolation.e2e.ts
-cypress/integration/iFrames/viewEdit.e2e.ts
-cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
-cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts
-cypress/integration/iFrames/vnf.popup.e2e.ts
-cypress/integration/iFrames/vnfGroups.e2e.ts
-cypress/integration/iFrames/vrf.e2e.ts
-cypress/integration/iFrames/welcomePage.e2e.ts
-cypress/integration/shared/error.message.popup.e2e.ts
-cypress/integration/shared/spinner.e2e.ts
diff --git a/vid-webpack-master/cypress/pipeline/run_group2.sh b/vid-webpack-master/cypress/pipeline/run_group2.sh
deleted file mode 100644
index edee7efac..000000000
--- a/vid-webpack-master/cypress/pipeline/run_group2.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-. $HOME/.nvm/nvm.sh
-
-set -x
-
-CYPRESS_HOME_DIR=$1
-TESTS_GROUP_FILE=cypress/pipeline/group2.txt
-
-cd ${CYPRESS_HOME_DIR}
-
-cat ${TESTS_GROUP_FILE}
-npm run cypress:headless --max-old-space-size=4096 -- --spec=$(cat ${TESTS_GROUP_FILE} | tr '\n' ',')
diff --git a/vid-webpack-master/cypress/support/application/application.session.actions.ts b/vid-webpack-master/cypress/support/application/application.session.actions.ts
index c054b2640..9126ae1a4 100644
--- a/vid-webpack-master/cypress/support/application/application.session.actions.ts
+++ b/vid-webpack-master/cypress/support/application/application.session.actions.ts
@@ -5,7 +5,6 @@ declare namespace Cypress {
clearSessionStorage: typeof clearSessionStorage;
setTestApiParamToGR: typeof setTestApiParamToGR;
setTestApiParamToVNF: typeof setTestApiParamToVNF;
- buildReduxStateWithServiceRespone: typeof buildReduxStateWithServiceRespone;
}
}
@@ -44,42 +43,8 @@ function setTestApiParamToVNF() : void {
});
}
-function updateObject(obj: any, key: string, val: any, value:any) {
- return JSON.parse(JSON.stringify(obj)
- .replace(new RegExp(`"${key}":"${val}"`), `"${key}":"${value}"`))
-}
-
-function buildReduxStateWithServiceRespone(res: any, serviceId:string, isEcompGeneratedNaming:boolean) :void {
- res = updateObject(res, "ecomp_generated_naming", !isEcompGeneratedNaming, isEcompGeneratedNaming);
- cy.window().then((win) => {
- win.sessionStorage.setItem('reduxState', JSON.stringify({
- "global": {
- "name": null
- },
- "service": {
- "serviceHierarchy": {
- [serviceId] : res
- },
- "serviceInstance": {
- [serviceId]: {
- "existingVNFCounterMap": {},
- "existingVnfGroupCounterMap": {},
- "existingNetworksCounterMap": {},
- "vnfs": {},
- "vnfGroups": {},
- "isEcompGeneratedNaming": isEcompGeneratedNaming,
- "existingNames": {},
- "vidNotions": res.service.vidNotions
- }
- }
- }
- }));
- });
-}
-
Cypress.Commands.add('setReduxState', setReduxState);
Cypress.Commands.add('getReduxState', getReduxState);
Cypress.Commands.add('clearSessionStorage', clearSessionStorage);
Cypress.Commands.add('setTestApiParamToGR', setTestApiParamToGR);
Cypress.Commands.add('setTestApiParamToVNF',setTestApiParamToVNF);
-Cypress.Commands.add('buildReduxStateWithServiceRespone', buildReduxStateWithServiceRespone);
diff --git a/vid-webpack-master/cypress/support/index.js b/vid-webpack-master/cypress/support/index.js
index 5062f5100..d9e64c0f5 100644
--- a/vid-webpack-master/cypress/support/index.js
+++ b/vid-webpack-master/cypress/support/index.js
@@ -15,6 +15,7 @@
// Import commands.js using ES2015 syntax:
import './commands';
+import 'cypress-file-upload';
import './steps/login.step';
import './steps/fill.service.popup.step';
import './steps/fill.vnf.popup.step';
@@ -36,12 +37,14 @@ import './steps/drawingBoard/drawingBoardModel.steps';
import './steps/drawingBoard/drawingBoardTree.steps';
import './steps/genericForm/genericFormAction.steps';
import './steps/genericForm/popupViewport.step';
-import './steps/drawingBoard/drawingBoardHeader.steps';
import './steps/drawingBoard/general.steps';
+import './steps/drawingBoard/drawingBoardRecreate.steps';
+import './steps/drawingBoard/drawingBoardHeader.steps';
import './steps/general/clickOutside.step';
import './steps/drawingBoard/drawingBoardComponentInfo.steps';
import './steps/genericForm/checkPopover.step';
+
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json
index d10c2bd32..d0c734bc2 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json
@@ -17,7 +17,7 @@
},
"requestParameters": {
"userParams": [],
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"usePreload": false
},
"cloudConfiguration": {
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
index c7740207c..e2b9d8ad7 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
@@ -22,5 +22,6 @@
"FLAG_2004_INSTANTIATION_STATUS_FILTER": true,
"FLAG_2004_INSTANTIATION_TEMPLATES_POPUP" : false,
"FLAG_2002_UNLIMITED_MAX" : true,
- "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true
+ "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true,
+ "FLAG_2006_VFM_SDNC_PRELOAD_FILES" : true
}
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json
index bc37b6bed..847ebf0d5 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json
@@ -32,7 +32,7 @@
"subscriberName":"SILVIA ROBBINS",
"owningEntityName":"WayneHolland",
"rollbackOnFailure":"true",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte":true,
"action": "Create"
}
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts
new file mode 100644
index 000000000..16f418bc9
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts
@@ -0,0 +1,52 @@
+declare namespace Cypress {
+ interface Chainable {
+ loadDrawingBoardWithRecreateMode: typeof loadDrawingBoardWithRecreateMode ,
+ loadDrawingBoardWithRecreateModeNetwork: typeof loadDrawingBoardWithRecreateModeNetwork,
+ loadDrawingBoardWithRecreateModeInternal: typeof loadDrawingBoardWithRecreateModeInternal
+ }
+}
+
+function loadDrawingBoardWithRecreateMode(templateWithVnfSetup : any) {
+ cy.loadDrawingBoardWithRecreateModeInternal(
+ '../../' + templateWithVnfSetup.instanceTemplateFile,
+ templateWithVnfSetup.serviceModelId,
+ templateWithVnfSetup.serviceModelFile);
+}
+
+function loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup : any) {
+ cy.loadDrawingBoardWithRecreateModeInternal(
+ '../../' + templateWithNetworkSetup.instanceTemplateFile,
+ templateWithNetworkSetup.serviceModelId,
+ templateWithNetworkSetup.serviceModelFile);
+}
+
+function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) {
+ const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";
+
+ const drawingBoardAction = `RECREATE`;
+ const templateTopologyEndpoint = "templateTopology";
+ cy.route(`**/rest/models/services/${serviceModelIdToLoad}`,
+ 'fixture:' + serviceModel)
+ .as('serviceModel');
+
+ cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`,
+ 'fixture:' + instanceTemplate)
+ .as('templateTopology');
+
+ // When...
+
+ cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
+ `?jobId=${templateUuid}` +
+ `&serviceModelId=${serviceModelIdToLoad}`);
+
+ cy.wait('@serviceModel');
+ cy.wait('@templateTopology');
+}
+
+
+
+
+
+Cypress.Commands.add('loadDrawingBoardWithRecreateMode', loadDrawingBoardWithRecreateMode);
+Cypress.Commands.add('loadDrawingBoardWithRecreateModeNetwork', loadDrawingBoardWithRecreateModeNetwork);
+Cypress.Commands.add('loadDrawingBoardWithRecreateModeInternal', loadDrawingBoardWithRecreateModeInternal);
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
index 8d2bb8a24..797fff095 100644
--- a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
@@ -1,7 +1,10 @@
declare namespace Cypress {
interface Chainable {
updateServiceShouldNotOverrideChild: typeof updateServiceShouldNotOverrideChild
- openServiceContextMenu: typeof openServiceContextMenu
+ openServiceContextMenu: typeof openServiceContextMenu,
+ drawingBoardTreeClickOnContextMenuOptionByName : typeof drawingBoardTreeClickOnContextMenuOptionByName,
+ nodeAction: typeof nodeAction,
+ editNode : typeof editNode
}
}
@@ -18,7 +21,6 @@ function updateServiceShouldNotOverrideChild() : void {
});
});
});
-
}
@@ -26,5 +28,36 @@ function openServiceContextMenu() : Chainable<any> {
return cy.getElementByDataTestsId('openMenuBtn').click({force: true});
}
+function nodeAction(dataTestId: string, action: string, index ?: number) {
+ return cy.drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId, index)
+ .drawingBoardTreeClickOnContextMenuOptionByName(action)
+}
+
+function drawingBoardTreeClickOnContextMenuOptionByName(optionName : string) : Chainable<any> {
+ switch (optionName) {
+ case 'Duplicate':
+ return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
+ case 'Remove':
+ return cy.getElementByDataTestsId('context-menu-remove').click({force : true});
+ case 'Edit':
+ return cy.getElementByDataTestsId('context-menu-edit').click({force : true});
+ case 'Delete':
+ return cy.getElementByDataTestsId('context-menu-delete').trigger('mouseover').click();
+ case 'Upgrade':
+ return cy.getElementByDataTestsId('context-menu-upgrade').trigger('mouseover').click();
+ case 'Undo Upgrade':
+ return cy.getElementByDataTestsId('context-menu-undoUpgrade').trigger('mouseover').click();
+ default:
+ return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
+ }
+}
+
+function editNode(dataTestId: string, index ?: number) {
+ return cy.nodeAction(dataTestId, 'Edit', index);
+}
+
Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild);
Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu);
+Cypress.Commands.add('drawingBoardTreeClickOnContextMenuOptionByName', drawingBoardTreeClickOnContextMenuOptionByName);
+Cypress.Commands.add('nodeAction', nodeAction);
+Cypress.Commands.add('editNode', editNode);
diff --git a/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json b/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json
new file mode 100644
index 000000000..c317c4183
--- /dev/null
+++ b/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json
@@ -0,0 +1,3 @@
+{
+ "comment" : "invalid file, just for upload mock file"
+}
diff --git a/vid-webpack-master/package.cypress.json b/vid-webpack-master/package.cypress.json
index da6aa602f..8ce197f32 100644
--- a/vid-webpack-master/package.cypress.json
+++ b/vid-webpack-master/package.cypress.json
@@ -16,6 +16,7 @@
"cypress": "3.6.1",
"typescript": "3.1.6",
"rxjs": "^6.3.3",
- "rxjs-compat": "^6.3.3"
+ "rxjs-compat": "^6.3.3",
+ "cypress-file-upload": "^3.5.3"
}
}
diff --git a/vid-webpack-master/package.json b/vid-webpack-master/package.json
index 1843de030..fdaf3e3d5 100755
--- a/vid-webpack-master/package.json
+++ b/vid-webpack-master/package.json
@@ -59,6 +59,7 @@
"moment": "^2.24.0",
"ng-multiselect-dropdown": "0.1.3",
"ng2-bootstrap-modal": "1.0.1",
+ "ng2-file-upload": "^1.4.0",
"ngx-bootstrap": "^2.0.2",
"ngx-contextmenu": "^5.1.1",
"ngx-datatable": "1.0.3",
@@ -88,8 +89,10 @@
"@types/node": "^10.12.18",
"angular2-template-loader": "0.6.2",
"babel-jest": "24.1.0",
+ "blueimp-file-upload": "^10.7.0",
"codelyzer": "^5.0.1",
"cypress": "3.6.1",
+ "cypress-file-upload": "^3.5.3",
"hammerjs": "2.0.8",
"husky": "^1.3.1",
"istanbul-reports": "2.1.1",
diff --git a/vid-webpack-master/pom.xml b/vid-webpack-master/pom.xml
index 59802d2d4..bfca33ed7 100644
--- a/vid-webpack-master/pom.xml
+++ b/vid-webpack-master/pom.xml
@@ -9,7 +9,7 @@
inherit from a parent maven module. -->
<groupId>org.onap.vid</groupId>
<artifactId>vid-webpack-master</artifactId>
- <version>6.0.2-SNAPSHOT</version>
+ <version>6.0.3-SNAPSHOT</version>
<packaging>war</packaging>
<name>VID UI</name>
<description>VID UI</description>
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/basic.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/basic.model.info.ts
index 5ae64376a..9c102069b 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/basic.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/basic.model.info.ts
@@ -63,8 +63,9 @@ export interface ILevelNodeInfo {
* @param model - The model of current object
* @param parentModel
* @param storeKey - instance storeKey if exist (for duplicate)
+ * @param serviceModelId
************************************************************/
- createInstanceTreeNode(instance: any, model: any, parentModel: any, storeKey: string): any
+ createInstanceTreeNode(instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any
/***********************************************************
* return if instance has some missing data
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
index 339951de5..c9c718f44 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
@@ -29,16 +29,16 @@ export class CollectionResourceModelInfo implements ILevelNodeInfo{
updateDynamicInputsDataFromModel = (currentModel): any => [];
getModel = (collectionResourceModelId: string, instance: CollectionResourceInstance, serviceHierarchy): CollectionResourceModel => {
- const originalModelName = instance.originalName ? instance.originalName : collectionResourceModelId;
- return new CollectionResourceModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new CollectionResourceModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, collectionResourceModelId));
};
- createInstanceTreeNode = (instance: CollectionResourceInstance, model: CollectionResourceModel, parentModel, storeKey: string): CollectionResourceTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let node = new CollectionResourceTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
return node;
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
index d9702b4c4..31c44390d 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
@@ -31,14 +31,14 @@ export class ConfigurationModelInfo implements ILevelNodeInfo{
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (configurationModelId : string, serviceHierarchy) : any =>{
- const model = this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, configurationModelId);
+ const model = this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, configurationModelId);
if (!_.isNil(model)) {
return model;
}
return {};
};
- createInstanceTreeNode(instance: any, model: any, storeKey: string): any {return null;}
+ createInstanceTreeNode(instance: any, model: any, storeKey: string, serviceModelId: string): any {return null;}
childNames: string[];
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts
index 6c8382808..951145870 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts
@@ -69,7 +69,7 @@ describe('NCF Model Info', () => {
typeName: "NCF"
};
- const ncfTreeNode: NcfTreeNode = ncfModel.createInstanceTreeNode(instance, {}, parentModel, "6b3536cf-3a12-457f-abb5-fa2203e0d923");
+ const ncfTreeNode: NcfTreeNode = ncfModel.createInstanceTreeNode(instance, {}, parentModel, "6b3536cf-3a12-457f-abb5-fa2203e0d923", "dd182d7d-6949-4b90-b3cc-5befe400742e");
expect(ncfTreeNode).toMatchObject(expected);
});
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts
index 4db41c0d1..5c03b379b 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts
@@ -37,7 +37,7 @@ export class NcfModelInfo implements ILevelNodeInfo {
};
- createInstanceTreeNode = (instance: Level1Instance, model: Level1Model, parentModel, storeKey: string): NcfTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let modelVersion: string = null;
if (parentModel.networksCollection && instance.originalName) {
const ncfRealModel: NcfModelInterface = parentModel.networksCollection[instance.originalName];
@@ -47,7 +47,7 @@ export class NcfModelInfo implements ILevelNodeInfo {
}
let node = new NcfTreeNode(instance, model, storeKey, modelVersion);
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.typeName = this.typeName;
return node;
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
index 7c240a9b9..ae28fc2d9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
@@ -71,9 +71,9 @@ export class NetworkModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (networkModelId: string, instance: NetworkInstance, serviceHierarchy): NetworkModel => {
- const originalModelName = instance.originalName ? instance.originalName : networkModelId;
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
return new NetworkModel(
- this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName),
+ this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, networkModelId),
this._featureFlagsService.getAllFlags());
};
@@ -85,11 +85,11 @@ export class NetworkModelInfo implements ILevelNodeInfo {
* @param parentModel
* @param storeKey - store key if exist
************************************************************/
- createInstanceTreeNode = (instance: NetworkInstance, model: NetworkModel, parentModel, storeKey: string): NetworkTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let node = new NetworkTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
node = this._sharedTreeService.addingStatusProperty(node);
@@ -234,8 +234,8 @@ export class NetworkModelInfo implements ILevelNodeInfo {
});
}
},
- visible: (node) => node.data.parentType !== 'VRF' && this._sharedTreeService.shouldShowDelete(node),
- enable: (node) => node.data.parentType !== 'VRF' && this._sharedTreeService.shouldShowDelete(node)
+ visible: (node) => node.data.parentType !== 'VRF' && this._sharedTreeService.shouldShowDelete(node, serviceModelId),
+ enable: (node) => node.data.parentType !== 'VRF' && this._sharedTreeService.shouldShowDelete(node, serviceModelId)
},
undoDelete: {
method: (node, serviceModelId) => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
index 05e05a744..b87551547 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
@@ -21,7 +21,7 @@ export class PnfModelInfo implements ILevelNodeInfo{
childNames: string[];
componentInfoType = ComponentInfoType.PNF;
- createInstanceTreeNode = (instance: PnfInstance, model: PNFModel, parentModel: any, storeKey: string): PnfTreeNode => null;
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => null;
getInfo(model, instance): ModelInformationItem[] {
return [];
@@ -32,8 +32,8 @@ export class PnfModelInfo implements ILevelNodeInfo{
}
getModel = (pnfModelId: string, instance: PnfInstance, serviceHierarchy): PNFModel => {
- const originalModelName = instance.originalName ? instance.originalName : pnfModelId;
- return new PNFModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new PNFModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, pnfModelId));
};
getNextLevelObject(): any { return null; }
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
index 86455ce60..f31a3b2e8 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
@@ -54,8 +54,8 @@ export class RelatedVnfMemberInfoModel implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vnfModelId: string, instance: VnfInstance, serviceHierarchy): VNFModel => {
- const originalModelName = instance.originalName ? instance.originalName : vnfModelId;
- return new VNFModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new VNFModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, vnfModelId));
};
@@ -65,12 +65,13 @@ export class RelatedVnfMemberInfoModel implements ILevelNodeInfo {
* @param model - vnf model
* @param parentModel
* @param storeKey - store key if exist
+ * @param serviceModelId
************************************************************/
- createInstanceTreeNode = (instance: VnfInstance, model: VNFModel, parentModel, storeKey: string): VnfTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let node = new VnfTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage: "";
node = this._sharedTreeService.addingStatusProperty(node);
@@ -128,8 +129,8 @@ export class RelatedVnfMemberInfoModel implements ILevelNodeInfo {
method : (node, serviceModelId) => {
this._store.dispatch(deleteActionRelatedVnfMemberInstance(node.parent.data.vnfGroupStoreKey, node.data.vnfStoreKey, serviceModelId));
},
- visible: (node) => this._sharedTreeService.shouldShowDelete(node),
- enable: (node) => this._sharedTreeService.shouldShowDelete(node)
+ visible: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId),
+ enable: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId)
},
undoDelete : {
method : (node, serviceModelId) => {
@@ -137,7 +138,7 @@ export class RelatedVnfMemberInfoModel implements ILevelNodeInfo {
},
visible: (node) => this._sharedTreeService.shouldShowUndoDelete(node),
- enable: (node, serviceModelId) => this._sharedTreeService.shouldShowUndoDelete(node) && this._sharedTreeService.shouldShowDelete(node.parent) && !this._sharedTreeService.isServiceOnDeleteMode(serviceModelId)
+ enable: (node, serviceModelId) => this._sharedTreeService.shouldShowUndoDelete(node) && this._sharedTreeService.shouldShowDelete(node.parent, serviceModelId) && !this._sharedTreeService.isServiceOnDeleteMode(serviceModelId)
}
}
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
index 1b92eb81b..dcc6a29f8 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
@@ -79,14 +79,14 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vfModuleModelId: string, instance, serviceHierarchy): Partial<VfModule> => {
- const model = this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, vfModuleModelId);
+ const model = this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, vfModuleModelId);
if (!_.isNil(model)) {
return new VfModule(model, this._featureFlagsService.getAllFlags());
}
return {};
};
- createNode(instance: VfModuleInstance, currentModel: VfModule, parentModel: VNFModel, modelName: string, index: number): VfModuleTreeNode {
+ createNode(instance: VfModuleInstance, currentModel: VfModule, parentModel: VNFModel, modelName: string, index: number, serviceModelId: string): VfModuleTreeNode {
let dynamicModelName = Object.keys(instance)[index];
instance = instance[Object.keys(instance)[index]];
const isEcompGeneratedNaming: boolean = this.isEcompGeneratedNaming(currentModel, parentModel);
@@ -96,7 +96,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
newVfModule.missingData = this._sharedTreeService.hasMissingData(instance, newVfModule.dynamicInputs, isEcompGeneratedNaming, []);
newVfModule.typeName = this.typeName;
- newVfModule.menuActions = this.getMenuAction(<any>newVfModule, currentModel.uuid);
+ newVfModule.menuActions = this.getMenuAction(<any>newVfModule, serviceModelId);
newVfModule.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
newVfModule.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
@@ -104,16 +104,16 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
return newVfModule;
}
- createInstanceTreeNode(instance: VfModuleInstance, currentModel: VfModule, parentModel: VNFModel, modelName: string): VfModuleTreeNode | VfModuleTreeNode[] {
+ createInstanceTreeNode(instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any {
let numberOfChilds = Object.keys(instance).length;
if (numberOfChilds > 1) {
let result: VfModuleTreeNode[] = [];
for (let i = 0; i < numberOfChilds; i++) {
- result.push(this.createNode(instance, currentModel, parentModel, modelName, i));
+ result.push(this.createNode(instance, model, parentModel, storeKey, i, serviceModelId));
}
return result;
} else {
- return this.createNode(instance, currentModel, parentModel, modelName, 0);
+ return this.createNode(instance, model, parentModel, storeKey, 0, serviceModelId);
}
}
@@ -355,8 +355,8 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
method: (node, serviceModelId) => {
this._store.dispatch(deleteActionVfModuleInstance(node.data.dynamicModelName, node.parent.data.vnfStoreKey, serviceModelId))
},
- visible: (node) => this._sharedTreeService.shouldShowDelete(node),
- enable: (node) => this._sharedTreeService.shouldShowDelete(node)
+ visible: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId),
+ enable: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId)
},
undoDelete: {
method: (node, serviceModelId) => {
@@ -364,7 +364,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
this._store.dispatch(deleteVFModuleField(node.data.modelName, node.parent.data.vnfStoreKey, node.data.servicedId ,node.data.dynamicModelName, 'retainAssignments'));
},
visible: (node) => this._sharedTreeService.shouldShowUndoDelete(node),
- enable: (node, serviceModelId) => this._sharedTreeService.shouldShowUndoDelete(node) && this._sharedTreeService.shouldShowDelete(node.parent) && !this._sharedTreeService.isServiceOnDeleteMode(serviceModelId)
+ enable: (node, serviceModelId) => this._sharedTreeService.shouldShowUndoDelete(node) && this._sharedTreeService.shouldShowDelete(node.parent, serviceModelId) && !this._sharedTreeService.isServiceOnDeleteMode(serviceModelId)
},
upgrade: {
method: (node, serviceModelId) => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
index 1215bb80e..b2b7b43e2 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
@@ -88,25 +88,25 @@ export class VnfModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vnfModelId: string, instance: VnfInstance, serviceHierarchy): VNFModel => {
- const originalModelName = instance.originalName ? instance.originalName : vnfModelId;
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
return new VNFModel(
- this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName),
+ this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, vnfModelId),
this._featureFlagsService.getAllFlags());
};
-
/***********************************************************
* return vnf instance tree node
* @param instance - vnf instance
* @param model - vnf model
* @param parentModel
* @param storeKey - store key if exist
+ * @param serviceModelId
************************************************************/
- createInstanceTreeNode = (instance: VnfInstance, model: VNFModel, parentModel, storeKey: string): VnfTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let node = new VnfTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
node = this._sharedTreeService.addingStatusProperty(node);
@@ -271,8 +271,8 @@ export class VnfModelInfo implements ILevelNodeInfo {
});
}
},
- visible: (node) => this._sharedTreeService.shouldShowDelete(node),
- enable: (node) => this._sharedTreeService.shouldShowDelete(node)
+ visible: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId),
+ enable: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId)
},
undoDelete: {
method: (node, serviceModelId) => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
index fa785bc73..d89f307d9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
@@ -83,12 +83,12 @@ export class VnfGroupingModelInfo implements ILevelNodeInfo {
getType = (): string => 'VnfGroup';
- createInstanceTreeNode(instance: any, model: any, parentModel: any, storeKey: string): any {
+ createInstanceTreeNode(instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any {
let node = new VnfGroupTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node = this._sharedTreeService.addingStatusProperty(node);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
node.limitMembers = (!_.isNil(model.properties.quantity)) ? model.properties.quantity : null;
@@ -96,8 +96,8 @@ export class VnfGroupingModelInfo implements ILevelNodeInfo {
}
getModel(modelId: string, instance: any, serviceHierarchy): any {
- const originalModelName = instance.originalName ? instance.originalName : modelId;
- return new VnfGroupModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new VnfGroupModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, modelId));
}
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean {
@@ -275,8 +275,8 @@ export class VnfGroupingModelInfo implements ILevelNodeInfo {
});
}
},
- visible: (node) => this._sharedTreeService.shouldShowDelete(node),
- enable: (node) => this._sharedTreeService.shouldShowDelete(node)
+ visible: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId),
+ enable: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId)
},
undoDelete: {
method: (node, serviceModelId) => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vpn/vpn.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vpn/vpn.model.info.ts
index b951162f8..0fbbc4a2d 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vpn/vpn.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vpn/vpn.model.info.ts
@@ -34,12 +34,12 @@ export class VpnModelInfo implements ILevelNodeInfo {
};
- createInstanceTreeNode = (instance: NetworkInstance, model: any, parentModel, storeKey: string): VpnTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let node = new VpnTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node = this._sharedTreeService.addingStatusProperty(node);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
node = this._sharedTreeService.addingStatusProperty(node);
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
index 03f60211c..7b7437c5e 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
@@ -51,16 +51,16 @@ export class VrfModelInfo implements ILevelNodeInfo {
updateDynamicInputsDataFromModel = (currentModel): any => [];
getModel = (vrfModelId: string, instance: VrfInstance, serviceHierarchy): VrfModel => {
- const originalModelName = instance.originalName ? instance.originalName : vrfModelId;
- return new VrfModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new VrfModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, vrfModelId));
};
- createInstanceTreeNode = (instance: VrfInstance, model: VrfModel, parentModel, storeKey: string): VrfTreeNode => {
+ createInstanceTreeNode = (instance: any, model: any, parentModel: any, storeKey: string, serviceModelId: string): any => {
let node = new VrfTreeNode(instance, model, storeKey);
node.missingData = this.hasMissingData(instance, node, model.isEcompGeneratedNaming);
node.typeName = this.typeName;
- node.menuActions = this.getMenuAction(<any>node, model.uuid);
+ node.menuActions = this.getMenuAction(<any>node, serviceModelId);
node.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed;
node.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : "";
return node;
@@ -157,8 +157,8 @@ export class VrfModelInfo implements ILevelNodeInfo {
method: (node, serviceModelId) => {
this._store.dispatch(deleteActionVrfInstance(node.data.vrfStoreKey, serviceModelId));
},
- visible: (node) => this._sharedTreeService.shouldShowDelete(node),
- enable: (node) => this._sharedTreeService.shouldShowDelete(node)
+ visible: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId),
+ enable: (node) => this._sharedTreeService.shouldShowDelete(node, serviceModelId)
},
undoDelete: {
method: (node, serviceModelId) => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts
index 8ddb4ba2d..89d901f55 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.ts
@@ -34,10 +34,11 @@ export class ObjectToInstanceTreeService {
this.numberOfFailed = 0;
this.numberOfElements = 0;
let _this = this;
+ const serviceModelId:string = serviceInstance.modelInfo.modelVersionId;
const firstLevelOptions: ILevelNodeInfo[] = _this._objectToTreeService.getFirstLevelOptions();
for (let option of firstLevelOptions) {
_.forOwn(serviceInstance[option.name], function (instance, modelName) {
- nodes.push(_this.getNodeInstance(modelName, null, instance, serviceHierarchy, option));
+ nodes.push(_this.getNodeInstance(modelName, null, instance, serviceHierarchy, option, serviceModelId));
});
}
return this.sortElementsByPosition(nodes);
@@ -71,18 +72,19 @@ export class ObjectToInstanceTreeService {
* @param instance
* @param serviceHierarchy - The service Hierarchy store
* @param option
+ * @param serviceModelId
* @param parentType
****************************************************************/
- getNodeInstance(modelName: string, parentModel: any, instance: any, serviceHierarchy, option: ILevelNodeInfo, parentType ?: string) {
+ getNodeInstance(modelName: string, parentModel: any, instance: any, serviceHierarchy, option: ILevelNodeInfo, serviceModelId: string, parentType ?: string) {
const model = option.getModel(modelName, instance, serviceHierarchy);
- let optionalNodes = option.createInstanceTreeNode(instance, model, parentModel, modelName);
+ let optionalNodes = option.createInstanceTreeNode(instance, model, parentModel, modelName, serviceModelId);
this.increaseNumberOfFailed(optionalNodes);
this.increaseNumberOfExcitingElements();
let nodes: any[] = _.isArray(optionalNodes) ? optionalNodes : [optionalNodes];
for (let node of nodes) {
node = this.addingExtraDataToNode(node, modelName, parentModel, instance, serviceHierarchy, option, parentType);
- let children = this.addNextInstanceTreeNode(instance, model, option, node, serviceHierarchy);
+ let children = this.addNextInstanceTreeNode(instance, model, option, node, serviceHierarchy, serviceModelId);
if (!_.isNil(children) && children.length > 0) {
node.children = this.sortElementsByPosition(children);
}
@@ -119,8 +121,9 @@ export class ObjectToInstanceTreeService {
* @param levelNodeInfo
* @param parentNode
* @param serviceHierarchy - The service Hierarchy store
+ * @param serviceModelId
****************************************************************/
- addNextInstanceTreeNode(parentInstance, parentModel, levelNodeInfo: ILevelNodeInfo, parentNode, serviceHierarchy): any[] {
+ addNextInstanceTreeNode(parentInstance, parentModel, levelNodeInfo: ILevelNodeInfo, parentNode, serviceHierarchy, serviceModelId: string): any[] {
if (!_.isNil(levelNodeInfo.childNames)&& levelNodeInfo.childNames.length > 0) {
const that = this;
parentNode.children = [];
@@ -130,7 +133,7 @@ export class ObjectToInstanceTreeService {
let nextLevelNodeInfo = levelNodeInfo.getNextLevelObject.apply(that, [childName]);
Object.keys(parentInstance[childName]).map((modelName) => {
let nextLevelInstance = parentInstance[childName][modelName];
- let nodes: any[] | any = that.getNodeInstance(modelName, parentModel, nextLevelInstance, serviceHierarchy, nextLevelNodeInfo, parentType);
+ let nodes: any[] | any = that.getNodeInstance(modelName, parentModel, nextLevelInstance, serviceHierarchy, nextLevelNodeInfo, serviceModelId, parentType);
if (_.isArray(nodes)) {
parentNode.children = parentNode.children.concat(nodes);
} else {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
index 87094e3bb..b4c58364b 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
@@ -63,7 +63,7 @@ function getNodeWithData(menuAction:string){
};
nodeData['menuActions'][menuAction] = {
method: (node, serviceModelId) => {}
- }
+ };
const node = {
parent: {
data: nodeData,
@@ -134,7 +134,7 @@ describe('Shared Tree Service', () => {
test('SharedTreeService upgradeBottomUp should call redux actions', () => {
const serviceModelId = "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd";
- const node = getNodeWithData("upgrade")
+ const node = getNodeWithData("upgrade");
spyOn(node.parent.data.menuActions['upgrade'], 'method');
service.upgradeBottomUp(node, serviceModelId);
expect(node.parent.data.menuActions['upgrade'].method).toBeCalledWith(node.parent, serviceModelId);
@@ -144,7 +144,7 @@ describe('Shared Tree Service', () => {
test('SharedTreeService undoUpgradeBottomUp should call redux actions', () => {
const serviceModelId = "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd";
- const node = getNodeWithData("undoUpgrade")
+ const node = getNodeWithData("undoUpgrade");
spyOn(node.parent.data.menuActions['undoUpgrade'], 'method');
service.undoUpgradeBottomUp(node, serviceModelId);
expect(node.parent.data.menuActions['undoUpgrade'].method).toBeCalledWith(node.parent, serviceModelId);
@@ -179,7 +179,7 @@ describe('Shared Tree Service', () => {
let serviceModelFromHierarchy =
getStore().service.serviceHierarchy["1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"];
- expect(service.modelByIdentifier(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
+ expect(service.modelByIdentifiers(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
.toHaveProperty("modelCustomizationName", expectedModelCustomizationName);
});
@@ -192,7 +192,7 @@ describe('Shared Tree Service', () => {
let serviceModelFromHierarchy =
getStore().service.serviceHierarchy["1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"];
- expect(service.modelByIdentifier(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
+ expect(service.modelByIdentifiers(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
.toBeUndefined();
});
@@ -264,7 +264,6 @@ describe('Shared Tree Service', () => {
});
-
test('statusProperties should be prop on node according to node properties', () => {
let node = service.addingStatusProperty({orchStatus: 'completed', provStatus: 'inProgress', inMaint: false});
expect(node.statusProperties).toBeDefined();
@@ -284,6 +283,39 @@ describe('Shared Tree Service', () => {
testId: 'inMaint'
})]);
});
+
+ each([
+ [false, 'method is not in menu actions', ServiceInstanceActions.None, DrawingBoardModes.EDIT, {}, true],
+ [false, 'there is no action in node', null, DrawingBoardModes.EDIT, {someMethod: "someValue"}, true],
+ [true, 'edit mode, action is none, method in menu action', ServiceInstanceActions.None, DrawingBoardModes.EDIT, {someMethod: "someValue"}, true],
+ [false, 'edit mode, action is none, method in menu action, macro service', ServiceInstanceActions.None, DrawingBoardModes.EDIT, {someMethod: "someValue"}, false],
+ [false, 'edit mode, action is not none, method in menu action', ServiceInstanceActions.Resume, DrawingBoardModes.EDIT, {someMethod: "someValue"}, true],
+ [false, 'edit mode, action is CREATE, method in menu action', ServiceInstanceActions.Resume, DrawingBoardModes.EDIT, {someMethod: "someValue"}, true]
+ ]).test('shouldShowButtonGeneric return %s if %s ', (expected, description, action, mode, menuActions, isALaCarte) => {
+ jest.spyOn(store, 'getState').mockReturnValue(<any>{
+ global: {
+ drawingBoardStatus: mode
+ },
+ service : {
+ serviceInstance: {
+ someModelId : {
+ isALaCarte
+ }
+ }
+
+ }
+ });
+ let node = <any>{
+ data:{
+ action: action,
+ menuActions: menuActions
+ },
+ };
+
+ let res = service.shouldShowButtonGeneric(node, "someMethod", "someModelId");
+ expect(res).toBe(expected);
+ });
+
const enableRemoveAndEditItemsDataProvider = [
['Create action CREATE mode', DrawingBoardModes.CREATE ,ServiceInstanceActions.Create, true],
['Create action VIEW mode',DrawingBoardModes.VIEW , ServiceInstanceActions.Create,false],
@@ -306,205 +338,8 @@ describe('Shared Tree Service', () => {
let res = service.shouldShowRemoveAndEdit(node);
expect(res).toBe(enabled);
});
+
});
-function generateService() {
- return {
- "vnfs": {
- "2017-488_PASQUALE-vPE 0": {
- "inMaint": false,
- "rollbackOnFailure": "true",
- "originalName": "2017-488_PASQUALE-vPE 0",
- "isMissingData": false,
- "trackById": "stigekyxrqi",
- "vfModules": {
- "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
- "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0gytfi": {
- "isMissingData": false,
- "sdncPreReload": null,
- "modelInfo": {
- "modelType": "VFmodule",
- "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
- "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
- "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
- "modelVersion": "5",
- "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
- "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"
- },
- "instanceParams": [{}],
- "trackById": "3oj23o7nupo"
- }
- }
- },
- "vnfStoreKey": "2017-488_PASQUALE-vPE 0",
- "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
- "productFamilyId": "d8a6ed93-251c-47ca-adc9-86671fd19f4c",
- "lcpCloudRegionId": "AAIAIC25",
- "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
- "lineOfBusiness": "ONAP",
- "platformName": "xxx1",
- "modelInfo": {
- "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
- "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
- "modelName": "2017-488_PASQUALE-vPE",
- "modelVersion": "5.0",
- "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
- "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
- "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
- },
- "legacyRegion": "11111111",
- "instanceParams": [{}]
- },
- "2017-388_PASQUALE-vPE 0": {
- "inMaint": false,
- "rollbackOnFailure": "true",
- "originalName": "2017-388_PASQUALE-vPE 0",
- "isMissingData": false,
- "trackById": "nib719t5vca",
- "vfModules": {},
- "vnfStoreKey": "2017-388_PASQUALE-vPE 0",
- "productFamilyId": "d8a6ed93-251c-47ca-adc9-86671fd19f4c",
- "lcpCloudRegionId": "AAIAIC25",
- "legacyRegion": "11111",
- "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
- "platformName": "platform",
- "lineOfBusiness": "zzz1",
- "instanceParams": [{}],
- "modelInfo": {
- "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
- "modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168",
- "modelName": "2017-388_PASQUALE-vPE",
- "modelVersion": "4.0",
- "modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
- "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
- "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168"
- },
- "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168"
- },
- "2017-388_PASQUALE-vPE 1": {
- "inMaint": false,
- "rollbackOnFailure": "true",
- "originalName": "2017-388_PASQUALE-vPE 1",
- "isMissingData": false,
- "trackById": "cv7l1ak8vpe",
- "vfModules": {},
- "vnfStoreKey": "2017-388_PASQUALE-vPE 1",
- "productFamilyId": "d8a6ed93-251c-47ca-adc9-86671fd19f4c",
- "lcpCloudRegionId": "AAIAIC25",
- "legacyRegion": "123",
- "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
- "platformName": "platform",
- "lineOfBusiness": "ONAP",
- "instanceParams": [{}],
- "modelInfo": {
- "modelInvariantId": "00beb8f9-6d39-452f-816d-c709b9cbb87d",
- "modelVersionId": "0903e1c0-8e03-4936-b5c2-260653b96413",
- "modelName": "2017-388_PASQUALE-vPE",
- "modelVersion": "1.0",
- "modelCustomizationId": "280dec31-f16d-488b-9668-4aae55d6648a",
- "modelCustomizationName": "2017-388_PASQUALE-vPE 1",
- "uuid": "0903e1c0-8e03-4936-b5c2-260653b96413"
- },
- "uuid": "0903e1c0-8e03-4936-b5c2-260653b96413"
- }
- },
- "instanceParams": [{}],
- "validationCounter": 0,
- "existingNames": {"yoav": ""},
- "existingVNFCounterMap": {
- "69e09f68-8b63-4cc9-b9ff-860960b5db09": 1,
- "afacccf6-397d-45d6-b5ae-94c39734b168": 1,
- "0903e1c0-8e03-4936-b5c2-260653b96413": 1
- },
- "existingVnfGroupCounterMap": {
- "daeb6568-cef8-417f-9075-ed259ce59f48": 0,
- "c2b300e6-45de-4e5e-abda-3032bee2de56": -1
- },
- "existingNetworksCounterMap": {"ddc3f20c-08b5-40fd-af72-c6d14636b986": 1},
- "networks": {
- "ExtVL 0": {
- "inMaint": false,
- "rollbackOnFailure": "true",
- "originalName": "ExtVL 0",
- "isMissingData": false,
- "trackById": "s6okajvv2n8",
- "networkStoreKey": "ExtVL 0",
- "productFamilyId": "d8a6ed93-251c-47ca-adc9-86671fd19f4c",
- "lcpCloudRegionId": "AAIAIC25",
- "legacyRegion": "12355555",
- "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
- "platformName": "platform",
- "lineOfBusiness": null,
- "instanceParams": [{}],
- "modelInfo": {
- "modelInvariantId": "379f816b-a7aa-422f-be30-17114ff50b7c",
- "modelVersionId": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
- "modelName": "ExtVL",
- "modelVersion": "37.0",
- "modelCustomizationId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
- "modelCustomizationName": "ExtVL 0",
- "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986"
- },
- "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986"
- }
- },
- "vnfGroups": {
- "groupingservicefortest..ResourceInstanceGroup..0": {
- "inMaint": false,
- "rollbackOnFailure": "true",
- "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
- "isMissingData": false,
- "trackById": "se0obn93qq",
- "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
- "instanceName": "groupingservicefortestResourceInstanceGroup0",
- "instanceParams": [{}],
- "modelInfo": {
- "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
- "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
- "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
- "modelVersion": "1",
- "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
- "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
- },
- "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
- }
- },
- "instanceName": "yoav",
- "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
- "subscriptionServiceType": "TYLER SILVIA",
- "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
- "productFamilyId": "d8a6ed93-251c-47ca-adc9-86671fd19f4c",
- "lcpCloudRegionId": "AAIAIC25",
- "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
- "aicZoneId": "ATL53",
- "pause": null,
- "projectName": "WATKINS",
- "rollbackOnFailure": "true",
- "bulkSize": 1,
- "aicZoneName": "AAIATLTE-ATL53",
- "owningEntityName": "WayneHolland",
- "testApi": "VNF_API",
- "isEcompGeneratedNaming": false,
- "tenantName": "USP-SIP-IC-24335-T-01",
- "modelInfo": {
- "modelInvariantId": "cdb90b57-ed78-4d44-a5b4-7f43a02ec632",
- "modelVersionId": "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd",
- "modelName": "action-data",
- "modelVersion": "1.0",
- "uuid": "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"
- },
- "isALaCarte": false,
- "name": "action-data",
- "version": "1.0",
- "description": "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
- "category": "Network L1-3",
- "uuid": "1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd",
- "invariantUuid": "cdb90b57-ed78-4d44-a5b4-7f43a02ec632",
- "serviceType": "pnf",
- "serviceRole": "Testing",
- "vidNotions": {"instantiationUI": "legacy", "modelCategory": "other", "viewEditUI": "legacy"},
- "isMultiStepDesign": true
- };
-}
function getStore() {
return {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index 6c985ec6a..d60bbd3c9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -54,23 +54,39 @@ export class SharedTreeService {
: (nodeInstance.modelInfo.modelCustomizationId || nodeInstance.modelInfo.modelInvariantId);
};
+ modelUniqueNameOrId = (instance): string =>
+ instance.originalName ? instance.originalName : this.modelUniqueId(instance);
+
/**
* Finds a model inside a full service model
* @param serviceModelFromHierarchy
* @param modelTypeName "vnfs" | "networks" | "vfModules" | "collectionResources" | ...
- * @param modelUniqueIdOrName Either an entry name (i.e. "originalName"), modelCustomizationId or modelInvariantId.
+ * @param modelUniqueNameOrId Either an entry name (i.e. "originalName"), modelCustomizationId or modelInvariantId.
* Note that modelInvariantId will work only where model lacks a modelCustomizationId.
+ * @param modeName An optional entry name (i.e. "originalName"); will not try to use as id
*/
- modelByIdentifier = (serviceModelFromHierarchy, modelTypeName: string, modelUniqueIdOrName: string): any => {
- if (_.isNil(serviceModelFromHierarchy)) return undefined;
+ modelByIdentifiers = (serviceModelFromHierarchy, modelTypeName: string, modelUniqueNameOrId: string, modeName?: string): any => {
+ const logErrorAndReturnUndefined = () =>
+ console.info(`modelByIdentifiers: could not find a model matching query`, {
+ modelTypeName, modelUniqueNameOrId, modeName, serviceModelFromHierarchy
+ });
+
+ if (_.isNil(serviceModelFromHierarchy)) return logErrorAndReturnUndefined();
const modelsOfType = serviceModelFromHierarchy[modelTypeName];
- if (_.isNil(modelsOfType)) return undefined;
+ if (_.isNil(modelsOfType)) return logErrorAndReturnUndefined();
+
+ const modelIfModelIdentifierIsEntryName = modelsOfType[modelUniqueNameOrId];
+ const modelIfModeNameExists = _.isNil(modeName) ? null : modelsOfType[modeName];
- const modelIfModelIdentifierIsEntryName = modelsOfType[modelUniqueIdOrName];
- return _.isNil(modelIfModelIdentifierIsEntryName)
- ? _.find(modelsOfType, o => (o.customizationUuid || o.invariantUuid) === modelUniqueIdOrName)
- : modelIfModelIdentifierIsEntryName;
+ if (!_.isNil(modelIfModelIdentifierIsEntryName)) {
+ return modelIfModelIdentifierIsEntryName;
+ } else if (!_.isNil(modelIfModeNameExists)) {
+ return modelIfModeNameExists;
+ } else {
+ // try modelUniqueNameOrId as an id
+ return _.find(modelsOfType, o => (o.customizationUuid || o.invariantUuid) === modelUniqueNameOrId) || logErrorAndReturnUndefined()
+ }
};
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean, requiredFields: string[]): boolean {
@@ -139,8 +155,8 @@ export class SharedTreeService {
/**********************************************
* should return true if can delete
**********************************************/
- shouldShowDelete(node): boolean {
- return this.shouldShowButtonGeneric(node, "delete")
+ shouldShowDelete(node, serviceModelId): boolean {
+ return this.shouldShowButtonGeneric(node, "delete", serviceModelId)
}
/**********************************************
@@ -193,7 +209,7 @@ export class SharedTreeService {
shouldShowUpgrade(node, serviceModelId): boolean {
if (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
this.isThereAnUpdatedLatestVersion(serviceModelId)) {
- return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE);
+ return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE, serviceModelId);
}
else {
return false
@@ -201,12 +217,22 @@ export class SharedTreeService {
}
private isThereAnUpdatedLatestVersion(serviceModelId) : boolean{
- let serviceInstance = this._store.getState().service.serviceInstance[serviceModelId];
+ let serviceInstance = this.getServiceInstance(serviceModelId);
return !_.isNil(serviceInstance.latestAvailableVersion) && (Number(serviceInstance.modelInfo.modelVersion) < serviceInstance.latestAvailableVersion);
}
- private shouldShowButtonGeneric(node, method) {
+ private getServiceInstance(serviceModelId): any {
+ return this._store.getState().service.serviceInstance[serviceModelId];
+ }
+
+ shouldShowButtonGeneric(node, method, serviceModelId) {
const mode = this._store.getState().global.drawingBoardStatus;
+ const isMacro = !(this.getServiceInstance(serviceModelId).isALaCarte);
+
+ if (isMacro) { //if macro action allowed only for service level
+ return false;
+ }
+
if (!_.isNil(node) && !_.isNil(node.data) && !_.isNil(node.data.action) && !_.isNil(node.data.menuActions[method])) {
if (mode !== DrawingBoardModes.EDIT || node.data.action === ServiceInstanceActions.Create) {
return false;
@@ -288,7 +314,7 @@ export class SharedTreeService {
************************************************/
getExistingInstancesWithDeleteMode(node, serviceModelId: string, type: string): number {
let counter = 0;
- const existingInstances = this._store.getState().service.serviceInstance[serviceModelId][type];
+ const existingInstances = this.getServiceInstance(serviceModelId)[type];
const modelUniqueId = node.data.modelUniqueId;
if (!_.isNil(existingInstances)) {
for (let instanceKey in existingInstances) {
diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.html b/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.html
index 26362ebed..fe7744e43 100644
--- a/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.html
+++ b/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.html
@@ -8,4 +8,9 @@
data-toggle="toggle">
<label class="checkbox-label"
for="{{data?.dataTestId}}">{{data?.displayName}}</label>
+ <div *ngFor="let extraContent of data?.extraContents" class="form-conrtols">
+ <div [ngSwitch]="extraContent.type">
+ <upload-files *ngSwitchCase="'UPLOAD_FILE'" [uploadFilesModel]="extraContent" [form]="form"></upload-files>
+ </div>
+ </div>
</div>
diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.scss b/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.scss
index 005e28cc6..81180e06f 100644
--- a/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.scss
+++ b/vid-webpack-master/src/app/shared/components/formControls/component/checkbox/checkbox.formControl.component.scss
@@ -11,6 +11,7 @@
.details-item label {
position: relative;
cursor: pointer;
+ float: left;
}
.details-item label:before {
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts
index acfaf78ab..83f722704 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts
@@ -133,13 +133,14 @@ export class SharedControllersService {
})
};
- getSDNCControl = (instance: any): FormControlModel => {
+ getSDNCControl = (instance: any, extraContents? : object[]): FormControlModel => {
return new CheckboxFormControl({
controlName: SDN_C_PRE_LOAD,
displayName: 'SDN-C pre-load',
dataTestId: 'sdncPreLoad',
value: instance ? instance.sdncPreLoad : false,
- validations: [new ValidatorModel(ValidatorOptions.required, 'is required')]
+ validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
+ extraContents
})
};
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
index b3bb1fe54..49deb3a50 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
@@ -4,7 +4,7 @@ import {NgRedux} from '@angular-redux/store';
import {ControlGeneratorUtil, SDN_C_PRE_LOAD} from "../control.generator.util.service";
import {AaiService} from "../../../../services/aaiService/aai.service";
import {GenericFormService} from "../../generic-form.service";
-import {FormBuilder} from "@angular/forms";
+import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
import {LogService} from "../../../../utils/log/log.service";
import {
FormControlModel,
@@ -16,6 +16,7 @@ import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flag
import {VfModuleInstance} from "../../../../models/vfModuleInstance";
import {VfModule} from "../../../../models/vfModule";
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {AppState} from "../../../../store/reducers";
import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockAppStore<T> {
@@ -919,6 +920,7 @@ describe('VFModule Control Generator', () => {
let injector;
let service: VfModuleControlGenerator;
let httpMock: HttpTestingController;
+ let store : NgRedux<AppState>;
beforeAll(done => (async () => {
TestBed.configureTestingModule({
@@ -939,6 +941,7 @@ describe('VFModule Control Generator', () => {
injector = getTestBed();
service = injector.get(VfModuleControlGenerator);
httpMock = injector.get(HttpTestingController);
+ store = injector.get(NgRedux);
jest.spyOn(console, 'error');
})().then(done).catch(done.fail));
@@ -1164,5 +1167,29 @@ describe('VFModule Control Generator', () => {
expect(controls[i].controlName).toEqual(orderedControls[i]);
}
});
+
+
+ test('when flag is active - response should contains upload file', ()=>{
+ spyOn(store, 'getState').and.returnValue( {
+ "global": {
+ "flags": {
+ "FLAG_2006_VFM_SDNC_PRELOAD_FILES" : true
+ }
+ }
+ });
+
+ const extraContent = service.getSdncExtraContents();
+ console.log("extraContent", extraContent);
+ const uploadFileData = <any>extraContent[0];
+
+ expect(uploadFileData.type).toEqual('UPLOAD_FILE');
+ expect(uploadFileData.dataTestId).toEqual('sdnc_pereload_upload_link');
+ expect(uploadFileData.uploadMethod).toBeDefined();
+ expect(uploadFileData.isDisabled).toBeDefined();
+ expect(uploadFileData.onSuccess).toBeDefined();
+ expect(uploadFileData.onFailed).toBeDefined();
+
+ })
+
});
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
index b00312d5f..702181581 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
@@ -3,7 +3,7 @@ import {GenericFormService} from "../../generic-form.service";
import {AaiService} from "../../../../services/aaiService/aai.service";
import {NgRedux} from "@angular-redux/store";
import {HttpClient} from "@angular/common/http";
-import {ControlGeneratorUtil} from "../control.generator.util.service";
+import {ControlGeneratorUtil, SDN_C_PRE_LOAD} from "../control.generator.util.service";
import {
CustomValidatorOptions,
FormControlModel,
@@ -20,6 +20,8 @@ import {VNFModel} from "../../../../models/vnfModel";
import {VnfInstance} from "../../../../models/vnfInstance";
import * as _ from 'lodash';
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {MessageModal} from "../../../messageModal/message-modal.service";
+import {ButtonType} from "../../../customModal/models/button.type";
import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
export enum FormControlNames {
@@ -36,7 +38,7 @@ export enum FormControlNames {
export class VfModuleControlGenerator {
aaiService: AaiService;
vfModuleModel: VfModule;
- isUpdateMode : boolean;
+ isUpdateMode: boolean;
constructor(private genericFormService: GenericFormService,
private _basicControlGenerator: ControlGeneratorUtil,
@@ -54,7 +56,7 @@ export class VfModuleControlGenerator {
if (isUpdateMode && this.store.getState().service.serviceInstance[serviceId] &&
_.has(this.store.getState().service.serviceInstance[serviceId].vnfs, vnfStoreKey) &&
_.has(this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey].vfModules, UUIDData['modelName'])) {
- vfModuleInstance = Object.assign({},this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey].vfModules[UUIDData['modelName']][UUIDData['vFModuleStoreKey']]);
+ vfModuleInstance = Object.assign({}, this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey].vfModules[UUIDData['modelName']][UUIDData['vFModuleStoreKey']]);
}
return vfModuleInstance;
};
@@ -65,11 +67,11 @@ export class VfModuleControlGenerator {
return vfModule;
}
- getMacroFormControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, uuidData : Object, isUpdateMode: boolean): FormControlModel[] {
+ getMacroFormControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, uuidData: Object, isUpdateMode: boolean): FormControlModel[] {
this.isUpdateMode = isUpdateMode;
this.extractVfAccordingToVfModuleUuid(serviceId, uuidData);
if (_.isNil(serviceId) || _.isNil(vnfStoreKey) || _.isNil(vfModuleStoreKey)) {
- if(isUpdateMode){
+ if (isUpdateMode) {
this._logService.error('should provide serviceId, vfModuleStoreKey, vnfStoreKey', serviceId);
return [];
}
@@ -85,21 +87,21 @@ export class VfModuleControlGenerator {
if (!_.isNil(vfModuleModel)) {
result = this.pushInstanceAndVGToForm(result, vfModuleInstance, serviceId, vnfModel, false);
}
- if(this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
+ if (this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
}
return result;
}
private newVNFModel(serviceId: string, vnf: VnfInstance) {
- const vnfModelName: string = vnf.originalName;
+ const vnfModelName: string = this._sharedTreeService.modelUniqueNameOrId(vnf);
const serviceModelFromHierarchy = this.store.getState().service.serviceHierarchy[serviceId];
- const model = this._sharedTreeService.modelByIdentifier(serviceModelFromHierarchy, "vnfs", vnfModelName);
+ const model = this._sharedTreeService.modelByIdentifiers(serviceModelFromHierarchy, "vnfs", vnfModelName);
return new VNFModel(model);
}
- pushInstanceAndVGToForm(result: FormControlModel[], vfModuleElement: any, serviceId: string, vnfModel: any, isALaCarte: boolean) :FormControlModel[]{
+ pushInstanceAndVGToForm(result: FormControlModel[], vfModuleElement: any, serviceId: string, vnfModel: any, isALaCarte: boolean): FormControlModel[] {
result.push(this.getInstanceName(vfModuleElement, serviceId, vnfModel.isEcompGeneratedNaming));
if (this.vfModuleModel.volumeGroupAllowed) {
result.push(this.getVolumeGroupData(vfModuleElement, serviceId, vnfModel.isEcompGeneratedNaming, isALaCarte));
@@ -107,16 +109,16 @@ export class VfModuleControlGenerator {
return result;
}
- getAlaCarteFormControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, uuidData : Object, isUpdateMode: boolean): FormControlModel[] {
+ getAlaCarteFormControls(serviceId: string, vnfStoreKey: string, vfModuleStoreKey: string, uuidData: Object, isUpdateMode: boolean): FormControlModel[] {
this.isUpdateMode = isUpdateMode;
this.extractVfAccordingToVfModuleUuid(serviceId, uuidData);
if (_.isNil(serviceId) || _.isNil(vnfStoreKey) || _.isNil(vfModuleStoreKey)) {
- if(isUpdateMode){
+ if (isUpdateMode) {
this._logService.error('should provide serviceId, vfModuleStoreKey, vnfStoreKey', serviceId);
return [];
}
}
- const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey] ;
+ const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey];
const vnfModel = this.newVNFModel(serviceId, vnf);
const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
@@ -126,26 +128,64 @@ export class VfModuleControlGenerator {
result.push(this._sharedControllersService.getLegacyRegion(vfModuleInstance));
result.push(this._sharedControllersService.getTenantControl(serviceId, vfModuleInstance));
result.push(this._sharedControllersService.getRollbackOnFailureControl(vfModuleInstance));
- result.push(this._sharedControllersService.getSDNCControl(vfModuleInstance));
- if(this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
+ result.push(this._sharedControllersService.getSDNCControl(vfModuleInstance, this.getSdncExtraContents()));
+ if (this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
}
return result;
}
- getInstanceName(instance: any, serviceId: string, isEcompGeneratedNaming: boolean): FormControlModel {
- let formControlModel:FormControlModel = this._sharedControllersService.getInstanceNameController(instance, serviceId, isEcompGeneratedNaming, this.vfModuleModel);
- formControlModel.onBlur = (event, form : FormGroup) => {
- if(!_.isNil(form.controls['volumeGroupName'])&& event.target.value.length > 0){
- form.controls['volumeGroupName'].setValue(event.target.value + "_vol");
+ getSdncExtraContents() : object[] {
+ return _.compact([
+ !!this.store.getState().global.flags['FLAG_2006_VFM_SDNC_PRELOAD_FILES'] ? {
+ type: 'UPLOAD_FILE',
+ dataTestId: 'sdnc_pereload_upload_link',
+ uploadMethod: (form: FormGroup) : Promise<boolean> => {
+ // this -> files item
+ return this._aaiService.sdncPreload().toPromise()
+ .then((response : boolean)=>{
+ return response;
+ }).catch(err => {
+ return false;
+ });
+ },
+ isDisabled: (form: FormGroup): boolean => {
+ return !form.controls[SDN_C_PRE_LOAD].value;
+ },
+ onSuccess: (form: FormGroup): void => {
+ MessageModal.showMessageModal({
+ text: 'The pre-load file(s) have been uploaded successfully.',
+ type: "success",
+ title: 'Success',
+ buttons: [{type: ButtonType.success, size: 'large', text: 'OK', closeModal: true}]
+ })
+ },
+ onFailed: (form: FormGroup) : void=> {
+ MessageModal.showMessageModal({
+ text: 'Failed to upload one or more of the files, please retry.',
+ type: "error",
+ title: 'Failure',
+ buttons: [{type: ButtonType.error, size: 'large', text: 'OK', closeModal: true}]
+ })
}
- };
+ } : null
+ ]);
+ }
+
+
+ getInstanceName(instance: any, serviceId: string, isEcompGeneratedNaming: boolean): FormControlModel {
+ let formControlModel: FormControlModel = this._sharedControllersService.getInstanceNameController(instance, serviceId, isEcompGeneratedNaming, this.vfModuleModel);
+ formControlModel.onBlur = (event, form: FormGroup) => {
+ if (!_.isNil(form.controls['volumeGroupName']) && event.target.value.length > 0) {
+ form.controls['volumeGroupName'].setValue(event.target.value + "_vol");
+ }
+ };
return formControlModel;
}
getDefaultVolumeGroupName(instance: any, isEcompGeneratedNaming: boolean): string {
- if ((!_.isNil(instance) && instance.volumeGroupName)) {
+ if ((!_.isNil(instance) && instance.volumeGroupName)) {
return instance.volumeGroupName;
}
if (isEcompGeneratedNaming) {
@@ -165,12 +205,12 @@ export class VfModuleControlGenerator {
displayName: 'Volume Group Name',
dataTestId: 'volumeGroupName',
validations: validations,
- tooltip : 'When filled, VID will create a Volume Group by this name and associate with this module.\n' +
- 'When empty, the module is created without a Volume Group.',
- isVisible: this.shouldVGNameBeVisible(isEcompGeneratedNaming,isALaCarte),
+ tooltip: 'When filled, VID will create a Volume Group by this name and associate with this module.\n' +
+ 'When empty, the module is created without a Volume Group.',
+ isVisible: this.shouldVGNameBeVisible(isEcompGeneratedNaming, isALaCarte),
value: this.getDefaultVolumeGroupName(instance, isEcompGeneratedNaming),
onKeypress: (event) => {
- const pattern:RegExp = ControlGeneratorUtil.INSTANCE_NAME_REG_EX;
+ const pattern: RegExp = ControlGeneratorUtil.INSTANCE_NAME_REG_EX;
if (pattern) {
if (!pattern.test(event['key'])) {
event.preventDefault();
@@ -182,7 +222,7 @@ export class VfModuleControlGenerator {
}
private shouldVGNameBeVisible(isEcompGeneratedNaming: boolean, isALaCarte: boolean) {
- if((!isALaCarte && !isEcompGeneratedNaming) || isALaCarte){
+ if ((!isALaCarte && !isEcompGeneratedNaming) || isALaCarte) {
return true;
}
return false;
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
index 018130eec..4572fa443 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
@@ -957,7 +957,8 @@ describe('VNF Control Generator', () => {
FormControlNames.INSTANCE_NAME,
FormControlNames.LCPCLOUD_REGION_ID,
FormControlNames.TENANT_ID,
- 'platformName'
+ 'platformName',
+ FormControlNames.PRODUCT_FAMILY_ID
];
for(let i = 0 ; i < mandatoryControls.length ; i++){
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
index 14b31b4b7..169780b29 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
@@ -50,7 +50,7 @@ export class VnfControlGenerator {
if (!_.isNil(vnfModel)) {
result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming));
- result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, false));
+ result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, true));
result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vnfInstance, result));
result.push(this._sharedControllersService.getLegacyRegion(vnfInstance));
result.push(this._sharedControllersService.getTenantControl(serviceId, vnfInstance));
@@ -74,7 +74,7 @@ export class VnfControlGenerator {
if (!_.isNil(vnfModel)) {
const flags = this.store.getState().global.flags;
result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming));
- result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, false));
+ result.push(this._sharedControllersService.getProductFamilyControl(vnfInstance, result, true));
result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vnfInstance, result));
result.push(this._sharedControllersService.getLegacyRegion(vnfInstance));
result.push(this._sharedControllersService.getTenantControl(serviceId, vnfInstance));
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/generic-form.component.html b/vid-webpack-master/src/app/shared/components/genericForm/generic-form.component.html
index edf86823c..627f6426a 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/generic-form.component.html
+++ b/vid-webpack-master/src/app/shared/components/genericForm/generic-form.component.html
@@ -3,7 +3,7 @@
<div *ngFor="let formControl of formControls" class="form-conrtols">
<div [ngSwitch]="formControl.type">
<form-control-input *ngSwitchCase="'INPUT'" [data]="formControl" [form]="dynamicFormGroup"></form-control-input>
- <checkbox-form-control *ngSwitchCase="'CHECKBOX'" [data]="formControl" [form]="dynamicFormGroup" ></checkbox-form-control>
+ <checkbox-form-control *ngSwitchCase="'CHECKBOX'" [data]="formControl" [form]="dynamicFormGroup"></checkbox-form-control>
<dropdown-form-control *ngSwitchCase="'DROPDOWN'" [data]="formControl" [form]="dynamicFormGroup" ></dropdown-form-control>
<file-form-control *ngSwitchCase="'FILE'" [data]="formControl" [form]="dynamicFormGroup"></file-form-control>
<multiselect-form-control *ngSwitchCase="'MULTI_SELECT'"
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.html b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.html
new file mode 100644
index 000000000..6f59c0ce2
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.html
@@ -0,0 +1,15 @@
+<div>
+ <a [attr.data-tests-id]="uploadFilesModel.dataTestId"
+ (click)="uploadFilesTrigger()"
+ href="javascript:void(0)"
+ class="upload-text"
+ [class.disabled]="uploadFilesModel.isDisabled && uploadFilesModel.isDisabled(form)">{{uploadFilesModel.uploadText || 'Upload'}}</a>
+ <span class="hide-span">
+ <input
+ type="file"
+ #fileInput
+ ng2FileSelect
+ [uploader]="uploader"
+ [attr.data-tests-id]="uploadFilesModel.dataTestId + '-input'"/>
+ </span>
+</div>
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.scss b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.scss
new file mode 100644
index 000000000..ce9e14fbe
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.scss
@@ -0,0 +1,23 @@
+.upload-text {
+ margin-left: 30px;
+ font-family: OpenSans-Semibold;
+ font-size: 14px;
+ line-height: 23px;
+}
+
+a.disabled {
+ color: gray;
+ cursor: not-allowed;
+ text-decoration: underline;
+}
+
+.hide-span {
+ visibility: hidden;
+ position: absolute;
+ overflow: hidden;
+ width: 0px;
+ height: 0px;
+ border: none;
+ margin: 0;
+ padding: 0
+}
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.ts b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.ts
new file mode 100644
index 000000000..803d5d053
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component.ts
@@ -0,0 +1,41 @@
+import {Component, ElementRef, Input, OnInit, ViewChild} from "@angular/core";
+import {FileItem, FileUploader} from "ng2-file-upload";
+import {UploadFilesLinkModel} from "./upload-files-link.model";
+import {FormGroup} from "@angular/forms";
+
+@Component({
+ selector: 'upload-files',
+ templateUrl: './upload-files-link.component.html',
+ styleUrls: ['./upload-files-link.component.scss']
+})
+export class UploadFilesLinkComponent implements OnInit {
+ uploader: FileUploader;
+ @Input() uploadFilesModel: UploadFilesLinkModel;
+ @Input() form: FormGroup;
+ @ViewChild('fileInput', {static: false}) fileInput: ElementRef;
+
+ ngOnInit(): void {
+ this.uploader = new FileUploader({});
+
+ this.uploader.onAfterAddingAll = async (files: FileItem[]) => {
+ const result = await this.uploadFilesModel.uploadMethod.call(files, this.form);
+ if (result && this.uploadFilesModel.onSuccess) {
+ this.uploadFilesModel.onSuccess.call(this.form);
+ } else if (!result && this.uploadFilesModel.onFailed) {
+ this.uploadFilesModel.onFailed.call(this.form);
+ }
+ this.uploadFilesModel.uploadText = result ? 'Upload another' : 'Upload'
+ };
+ this.resetUpload();
+ }
+
+ resetUpload(): void {
+ this.fileInput.nativeElement.value = '';
+ }
+
+ uploadFilesTrigger() {
+ if (this.uploadFilesModel.isDisabled && !this.uploadFilesModel.isDisabled(this.form)) {
+ this.fileInput.nativeElement.click();
+ }
+ }
+}
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.model.ts b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.model.ts
new file mode 100644
index 000000000..beb54f43a
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.model.ts
@@ -0,0 +1,30 @@
+import {FileItem} from "ng2-file-upload";
+
+export class UploadFilesLinkModel {
+ uploadText?: string;
+
+ /*********************************************************************
+ Implement success method - run after uploadMethod return true result
+ **********************************************************************/
+ onSuccess?: (...args) => void;
+
+ /*********************************************************************
+ Implement failed method - run after uploadMethod return false result
+ **********************************************************************/
+ onFailed?: (...args) => void;
+
+ /*********************************************************************************
+ Implement upload method and return the upload result status (false/true)
+ *********************************************************************************/
+ uploadMethod: (file: FileItem[], ...args) => Promise<boolean>;
+
+ /********************************
+ Should upload file be disabled
+ ********************************/
+ isDisabled?: (...args) => boolean;
+
+ /********************************
+ a tag data test id
+ ********************************/
+ dataTestId : string;
+}
diff --git a/vid-webpack-master/src/app/shared/components/messageModal/message-modal.model.ts b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.model.ts
new file mode 100644
index 000000000..d29144095
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.model.ts
@@ -0,0 +1,15 @@
+import {ButtonType} from "../customModal/models/button.type";
+
+export class MessageModalModel {
+ title : string;
+ text : string;
+ type : 'error' | 'info' | 'success';
+ buttons : {text: string, size: string, type : ButtonType, closeModal: boolean}[];
+
+ constructor( title : string, text : string, type , buttons : {text: string, size: string, type : ButtonType, closeModal: boolean}[]){
+ this.title = title;
+ this.text = text;
+ this.type = type;
+ this.buttons = buttons;
+ }
+}
diff --git a/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts
new file mode 100644
index 000000000..ffaccb198
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts
@@ -0,0 +1,56 @@
+import {MessageModal} from "./message-modal.service";
+import {getTestBed, TestBed} from "@angular/core/testing";
+import {SdcUiCommon} from "onap-ui-angular";
+import each from "jest-each";
+import {MessageBoxService} from "../messageBox/messageBox.service";
+import {MessageModalModel} from "./message-modal.model";
+import {MessageBoxData} from "../messageBox/messageBox.data";
+
+
+describe('Message Modal Service', () => {
+ let injector;
+ let service: MessageModal;
+
+ beforeAll(done => (async () => {
+ TestBed.configureTestingModule({
+ imports: [],
+ providers: [MessageModal]
+ });
+ await TestBed.compileComponents();
+
+ injector = getTestBed();
+ service = injector.get(MessageModal);
+ })().then(done).catch(done.fail));
+
+
+ each([
+ ["error", SdcUiCommon.ModalType.error],
+ ["info", SdcUiCommon.ModalType.info],
+ ["success", SdcUiCommon.ModalType.success]
+ ]).test('getModalType with type %s should return %s', (inputMessageType, expectedResult) => {
+
+ let message = {
+ type: inputMessageType
+ };
+
+ const type = MessageModal.getModalType(<any>message)
+ expect(type).toEqual(expectedResult);
+ });
+
+ test('showMessageModal should call open modal with all data' , async (done)=>{
+ spyOn(MessageBoxService.openModal, 'next');
+ let message : MessageModalModel = new MessageModalModel('title', 'text', "success", []);
+
+ MessageModal.showMessageModal(message);
+ setTimeout(()=>{
+ const messageBoxData = new MessageBoxData( message.title,
+ message.text,
+ SdcUiCommon.ModalType.success,
+ SdcUiCommon.ModalSize.medium,
+ message.buttons)
+ expect(MessageBoxService.openModal.next).toHaveBeenCalledWith(messageBoxData);
+ done();
+ }, 500)
+ });
+
+});
diff --git a/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.ts b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.ts
new file mode 100644
index 000000000..e1f85bdb0
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.ts
@@ -0,0 +1,39 @@
+import {Injectable} from "@angular/core";
+import {MessageBoxService} from '../messageBox/messageBox.service';
+import {MessageBoxData} from '../messageBox/messageBox.data';
+import {SdcUiCommon} from "onap-ui-angular";
+import {MessageModalModel} from "./message-modal.model";
+
+@Injectable()
+export class MessageModal {
+ static showMessageModal(message: MessageModalModel): void {
+ setTimeout(() => {
+ let messageBoxData: MessageBoxData = new MessageBoxData(
+ message.title,
+ message.text,
+ this.getModalType(message),
+ SdcUiCommon.ModalSize.medium,
+ message.buttons);
+ MessageBoxService.openModal.next(messageBoxData);
+ }
+ , 500);
+ };
+
+
+ static getModalType = (message: MessageModalModel): string => {
+ switch (message.type) {
+ case "error": {
+ return SdcUiCommon.ModalType.error
+ }
+ case "info": {
+ return SdcUiCommon.ModalType.info;
+ }
+ case "success": {
+ return SdcUiCommon.ModalType.success;
+ }
+ }
+ };
+}
+
+
+
diff --git a/vid-webpack-master/src/app/shared/models/formControlModels/checkboxFormControl.model.ts b/vid-webpack-master/src/app/shared/models/formControlModels/checkboxFormControl.model.ts
index f505b5667..1675917d2 100644
--- a/vid-webpack-master/src/app/shared/models/formControlModels/checkboxFormControl.model.ts
+++ b/vid-webpack-master/src/app/shared/models/formControlModels/checkboxFormControl.model.ts
@@ -1,11 +1,13 @@
import {FormControlModel} from "./formControl.model";
import {FormControlType} from "./formControlTypes.enum";
+import * as _ from "lodash";
export class CheckboxFormControl extends FormControlModel{
-
+ extraContents : object[];
constructor(data) {
super(data);
this.type = FormControlType.CHECKBOX;
this.validations = [];
+ this.extraContents = !_.isNil(data.extraContents) ? data.extraContents : null;
}
}
diff --git a/vid-webpack-master/src/app/shared/models/formControlModels/formControl.model.ts b/vid-webpack-master/src/app/shared/models/formControlModels/formControl.model.ts
index 24116549e..b3a53d9f2 100644
--- a/vid-webpack-master/src/app/shared/models/formControlModels/formControl.model.ts
+++ b/vid-webpack-master/src/app/shared/models/formControlModels/formControl.model.ts
@@ -43,6 +43,7 @@ export class FormControlModel {
this.preventionsAttribute = data.preventionsAttribute || [];
this.onBlur = function(){};
this.onChange = data.onChange ? data.onChange: function () {}
+
}
isRequired() : boolean {
diff --git a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
index 1cc5593f7..9026a5648 100644
--- a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
+++ b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.ts
@@ -44,6 +44,11 @@ export class AaiService {
}
+ sdncPreload(): Observable<boolean> {
+ let pathQuery: string = Constants.Path.PRE_LOAD;
+ return this.http.post<boolean>(pathQuery, {})
+ }
+
getServiceModelById = (serviceModelId: string): Observable<any> => {
if (_.has(this.store.getState().service.serviceHierarchy, serviceModelId)) {
return of(<any> JSON.parse(JSON.stringify(this.store.getState().service.serviceHierarchy[serviceModelId])));
diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
index 19a3fc73c..722deca99 100644
--- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
+++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
@@ -15,8 +15,10 @@ export enum Features {
FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS ='FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS',
FLAG_2004_INSTANTIATION_STATUS_FILTER ='FLAG_2004_INSTANTIATION_STATUS_FILTER',
FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE = 'FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE',
+ FLAG_2006_VFM_SDNC_PRELOAD_FILES = 'FLAG_2006_VFM_SDNC_PRELOAD_FILES',
FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO = 'FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO',
- FLAG_2004_INSTANTIATION_TEMPLATES_POPUP = 'FLAG_2004_INSTANTIATION_TEMPLATES_POPUP'
+ FLAG_2004_INSTANTIATION_TEMPLATES_POPUP = 'FLAG_2004_INSTANTIATION_TEMPLATES_POPUP',
+ FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY= 'FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY'
}
@Injectable()
diff --git a/vid-webpack-master/src/app/shared/shared.module.ts b/vid-webpack-master/src/app/shared/shared.module.ts
index 08b7fe520..bae7c11f9 100644
--- a/vid-webpack-master/src/app/shared/shared.module.ts
+++ b/vid-webpack-master/src/app/shared/shared.module.ts
@@ -93,6 +93,9 @@ import {SvgIconComponent} from "./components/customIcon/custom-icon.component";
import {TooltipTemplateComponent} from "./components/customTooltip/custom-tooltip.component";
import {TooltipDirective} from "./components/customTooltip/tooltip.directive";
import {SdcUiComponentsModule} from "onap-ui-angular";
+import {UploadFilesLinkComponent} from "./components/genericForm/genericFormSharedComponent/uploadFiles/upload-files-link.component";
+import { FileUploadModule } from 'ng2-file-upload';
+import {MessageModal} from "./components/messageModal/message-modal.service";
@@ -111,7 +114,8 @@ import {SdcUiComponentsModule} from "onap-ui-angular";
AngularMultiSelectModule,
BootstrapModalModule,
DataTableModule,
- ModalModule.forRoot()
+ ModalModule.forRoot(),
+ FileUploadModule
],
declarations: [
PopoverComponent,
@@ -156,7 +160,8 @@ import {SdcUiComponentsModule} from "onap-ui-angular";
CustomModalButtonComponent,
LoaderComponent,
SvgIconComponent,
- TooltipTemplateComponent
+ TooltipTemplateComponent,
+ UploadFilesLinkComponent
],
exports: [
PopoverComponent,
@@ -197,7 +202,8 @@ import {SdcUiComponentsModule} from "onap-ui-angular";
CustomModalButtonComponent,
LoaderComponent,
SvgIconComponent,
- TooltipTemplateComponent
+ TooltipTemplateComponent,
+ UploadFilesLinkComponent
],
entryComponents : [
GenericFormPopupComponent,
@@ -248,7 +254,8 @@ import {SdcUiComponentsModule} from "onap-ui-angular";
ModelInformationService,
MultiselectFormControlService,
InstantiationTemplatesModalService,
- LoaderService
+ LoaderService,
+ MessageModal
]
})
export class SharedModule {
diff --git a/vid-webpack-master/src/app/shared/utils/constants.ts b/vid-webpack-master/src/app/shared/utils/constants.ts
index da717c8f4..01466f113 100644
--- a/vid-webpack-master/src/app/shared/utils/constants.ts
+++ b/vid-webpack-master/src/app/shared/utils/constants.ts
@@ -97,6 +97,7 @@ export module Constants {
public static SERVICE_MODEL_ID = 'serviceModelId';
public static SERVICES_RETRY_TOPOLOGY = '../../asyncInstantiation/bulkForRetry';
public static INSTANTIATION_TEMPLATE_TOPOLOGY = '../../instantiationTemplates/templateTopology';
+ public static PRE_LOAD = '../../preload';
public static CONFIGURATION_PATH = '../../get_property/{name}/defaultvalue';
public static SERVICES_JOB_AUDIT_PATH = '/auditStatus';
public static SERVICES_PROBE_PATH = "../../probe";
diff --git a/vid-webpack-master/src/styles.scss b/vid-webpack-master/src/styles.scss
index f170f35f5..1d332ed63 100644
--- a/vid-webpack-master/src/styles.scss
+++ b/vid-webpack-master/src/styles.scss
@@ -239,4 +239,6 @@ sdc-checkbox {
display: none !important;
}
-
+sdc-modal {
+ z-index: 10000 !important;
+}