diff options
author | Sara Weiss <sara.weiss@intl.att.com> | 2019-09-19 13:30:42 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-09-24 08:09:53 +0000 |
commit | ec36cb3c0f031d1e3d150d9b456e5184d3a1e604 (patch) | |
tree | 3b06fc30d372329a4dec25e6fc7c10c452db0c86 | |
parent | e5922e48d5ef9a2cbf19693135e11b5b7747a04f (diff) |
change management new filter tests
Issue-ID: VID-596
Change-Id: I591da151bb27a46c217edec552e7c9c670a96aaa
Signed-off-by: Sara Weiss <sara.weiss@intl.att.com>
6 files changed, 194 insertions, 17 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js index 5c29fb4ae..20e964c53 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js @@ -69,7 +69,7 @@ return (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)); }; - $scope.removeVendorFromCloudOwner = function(cloudOwner) { + $scope.removeVendorFromCloudOwner = function (cloudOwner) { return AaiService.removeVendorFromCloudOwner(cloudOwner) }; @@ -541,11 +541,26 @@ }); }; + function isCompatibleVNFRole(vnf) { + + return vnf.properties['nf-role'] === vm.changeManagement['vnfType'] || !vm.changeManagement['vnfType']; + + } + + function isValidVnf(vnf) { + + let result = isCompatibleVNFRole(vnf) && vnf.properties["model-invariant-id"] + && vnf.properties["model-version-id"]; + + return result; + } + function loadCloudRegions() { AaiService.getLcpCloudRegionTenantList( vm.changeManagement.subscriberId, vm.changeManagement.serviceType["service-type"], function (response) { + $scope.isFeatureFlagCloudOwner = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST); $scope.cloudRegionList = _.uniqBy(response, 'cloudRegionOptionId'); }); } @@ -562,6 +577,9 @@ vm.vnfTypes = []; vm.vnfTypesTemp = []; vm.serviceInstances = []; + vm.fromVNFVersions=[]; + vm.vnfNames =[]; + vm.changeManagement.vnfNames =[]; var instances = vm.changeManagement.serviceType["service-instances"]["service-instance"]; // var promiseArrOfGetVnfs = preparePromiseArrOfGetVnfs(instances); @@ -574,10 +592,9 @@ if ($scope.isNewFilterChangeManagmentEnabled()) { vnfRole = vm.changeManagement.vnfType ? vm.changeManagement.vnfType : null; - cloudRegion = vm.changeManagement.cloudRegion ? vm.changeManagement.cloudRegion.cloudRegionId : null; + cloudRegion = vm.changeManagement.cloudRegion ? vm.changeManagement.cloudRegion : null; } - AaiService.getVnfsByCustomerIdAndServiceType( vm.changeManagement.subscriberId, vm.changeManagement.serviceType["service-type"], @@ -635,9 +652,7 @@ vm.serviceInstancesToGetVersions = []; var versions = []; _.forEach(vm.vnfs, function (vnf) { - if (vnf.properties['nf-role'] === vm.changeManagement['vnfType'] - && vnf.properties["model-invariant-id"] - && vnf.properties["model-version-id"]) { + if (isValidVnf(vnf)) { vm.serviceInstancesToGetVersions.push({ "model-invariant-id": vnf.properties["model-invariant-id"], "model-version-id": vnf.properties["model-version-id"] @@ -708,13 +723,15 @@ }; vm.loadVNFNames = function () { + vm.changeManagement.vnfNames =[]; vm.vnfNames = []; + const vnfs = vm.changeManagement.fromVNFVersion ? vm.vnfs : []; _.forEach(vnfs, function (vnf) { var selectedVersionNumber = getVersionNameForId(vm.changeManagement.fromVNFVersion); - if (vnf.properties['nf-role'] === vm.changeManagement.vnfType && + if (isCompatibleVNFRole(vnf) && selectedVersionNumber === getVersionNameForId(vnf.properties["model-version-id"])) { var vServer = {}; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css index 031ffb4d4..dda983409 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css @@ -137,7 +137,7 @@ position: relative; } -.nf-role-input { +.new-filter-field { width: 39% } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html index a839ef547..3f2489dbb 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html @@ -70,23 +70,22 @@ <div ng-if="isNewFilterChangeManagmentEnabled()"> <div class="form-group form-row"> - <div class="col nf-role-input"> + <div class="col new-filter-field"> <label class="control-label">NF Role</label> <input class="form-control" ng-model="vm.changeManagement.vnfType" name="vnfType" id="vnfTypeInput" data-tests-id="vnfType" data-ng-disabled="newChangeManagement.serviceType.$pristine"> </div> - <div class="col nf-role-input"> + <div class="col new-filter-field"> <label class="control-label">Cloud Region</label> - <select name="cloud-region" class="form-control" ng-model="vm.changeManagement.cloudRegion" - name="vnfType" id="cloudRegion" + <select name="cloudRegion" class="form-control" ng-model="vm.changeManagement.cloudRegion" data-tests-id="cloudRegion" id="cloudRegion" data-ng-disabled="newChangeManagement.serviceType.$pristine"> - <option value="" disabled>select cloud Region</option> - <option ng-repeat="option in cloudRegionList" value="{{option.cloudRegionOptionId}}" + <option value="" >select cloud Region</option> + <option ng-repeat="option in cloudRegionList" value="{{option.tenantId}}" data-ng-if="option.isPermitted && !isFeatureFlagCloudOwner">{{option.cloudRegionId}} </option> - <option ng-repeat="option in cloudRegionList" value="{{option.cloudRegionOptionId}}" + <option ng-repeat="option in cloudRegionList" value="{{option.tenantId}}" data-ng-if="option.isPermitted && isFeatureFlagCloudOwner"> {{option.cloudRegionId}} ({{removeVendorFromCloudOwner(option.cloudOwner).toUpperCase()}}) </option> diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java index a81757ef6..689c46387 100644 --- a/vid-automation/src/main/java/vid/automation/test/Constants.java +++ b/vid-automation/src/main/java/vid/automation/test/Constants.java @@ -94,6 +94,9 @@ public class Constants { public static final String newModalSubscriberInputId = "subscriber"; public static final String newModalServiceTypeInputId = "serviceType"; public static final String newModalVNFTypeInputId = "vnfType"; + public static final String newModalVNFTypeInputId1 = "vnfTypeInput"; + public static final String newModalVNFCloudRegion = "cloudRegion"; + public static final String newModalVNFSearchVNF = "searchVNF"; public static final String newModalFromVNFVersionInputId = "fromVNFVersion"; public static final String newModalVNFNameInputId = "vnfName"; public static final String newModalWorkFlowInputId = "workflow"; 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 ed0180dd9..f69880aa5 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 @@ -36,6 +36,7 @@ import org.junit.Assert; import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; import org.onap.simulator.presetGenerator.presets.aai.PresetBaseAAICustomQuery; import org.onap.simulator.presetGenerator.presets.scheduler.PresetDeleteSchedulerChangeManagement; import org.openqa.selenium.JavascriptExecutor; @@ -88,7 +89,15 @@ public class ChangeManagementTest extends VidBaseTestCase { Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalSubscriberInputId)); Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalServiceTypeInputId)); Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFNameInputId)); - Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId)); + + if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) { + Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId1)); + Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFCloudRegion)); + Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFSearchVNF)); + } else { + Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalVNFTypeInputId)); + } + Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalFromVNFVersionInputId)); Assert.assertTrue(Exists.byId(Constants.ChangeManagement.newModalWorkFlowInputId)); Assert.assertTrue(Exists.byId(Constants.generalSubmitButtonId)); @@ -100,6 +109,7 @@ public class ChangeManagementTest extends VidBaseTestCase { String subscriberName = VNF_DATA_WITH_IN_PLACE.subscriberName; String serviceType = VNF_DATA_WITH_IN_PLACE.serviceType; String vnfType = VNF_DATA_WITH_IN_PLACE.vnfType; + String cloudRegion = VNF_DATA_WITH_IN_PLACE.cloudRegion; String vnfSourceVersion = VNF_DATA_WITH_IN_PLACE.vnfSourceVersion; ChangeManagementPage.openNewChangeManagementModal(); Wait.angularHttpRequestsLoaded(); @@ -110,8 +120,15 @@ public class ChangeManagementTest extends VidBaseTestCase { SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalServiceTypeInputId, serviceType); Wait.angularHttpRequestsLoaded(); - SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFTypeInputId, vnfType); + if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) { + Input.text(vnfType, Constants.ChangeManagement.newModalVNFTypeInputId); + SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFCloudRegion, cloudRegion); + Click.byId(Constants.ChangeManagement.newModalVNFSearchVNF); + } else { + SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFTypeInputId, vnfType); + } Wait.angularHttpRequestsLoaded(); + SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalFromVNFVersionInputId, vnfSourceVersion); Wait.angularHttpRequestsLoaded(); Click.byId(Constants.ChangeManagement.newModalVNFNameInputId); @@ -154,6 +171,7 @@ public class ChangeManagementTest extends VidBaseTestCase { static String subscriberName = "Emanuel"; static String serviceType = "vRichardson"; static String vnfType = "vMobileDNS"; + static String cloudRegion = "AAIAIC25 (AIC)"; static String vnfSourceVersion = "1.0"; static String vnfName = "zolson3amdns02test2"; static String vnfTargetVersion = "5.0"; @@ -217,6 +235,18 @@ public class ChangeManagementTest extends VidBaseTestCase { } }, APPEND); } + + + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.APPEND); + + if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) { + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetTenants( + VNF_DATA_WITH_IN_PLACE.subscriberId, + VNF_DATA_WITH_IN_PLACE.serviceType, + "presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json"), SimulatorApi.RegistrationStrategy.APPEND); + + } + registerDefaultTablesData(); resetGetServicesCache(); } diff --git a/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json b/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json new file mode 100644 index 000000000..8cd6d19a7 --- /dev/null +++ b/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json @@ -0,0 +1,128 @@ +{ + "service-type": "vWINIFRED", + "resource-version": "1494001841964", + "relationship-list": { + "relationship": [ + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/AAIAIC25/tenants/tenant/092eb9e8e4b7412e8787dd091bc58e86", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "irma-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "AAIAIC25" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "092eb9e8e4b7412e8787dd091bc58e86" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "USP-SIP-IC-24335-T-01" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/bae71557c5bb4d5aac6743a4e5f1d054", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "irma-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "hvf6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "bae71557c5bb4d5aac6743a4e5f1d054" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "AIN Web Tool-15-D-testalexandria" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/229bcdc6eaeb4ca59d55221141d01f8e", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "irma-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "hvf6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "229bcdc6eaeb4ca59d55221141d01f8e" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "AIN Web Tool-15-D-STTest2" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/cb42a77ff45b48a8b8deb83bb64acc74", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "irma-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "hvf6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "cb42a77ff45b48a8b8deb83bb64acc74" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ro-T11" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/fa45ca53c80b492fa8be5477cd84fc2b", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "irma-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "hvf6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "fa45ca53c80b492fa8be5477cd84fc2b" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ro-T112" + } + ] + } + ] + } +} |