diff options
23 files changed, 623 insertions, 185 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt index 8c769d68d..ac5c2751c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt @@ -22,6 +22,7 @@ package org.onap.vid.job.command import com.fasterxml.jackson.module.kotlin.convertValue +import org.apache.commons.lang3.ObjectUtils.defaultIfNull import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate import org.onap.vid.changeManagement.RequestDetailsWrapper import org.onap.vid.exceptions.AbortingException diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java index 75658f2b1..642843a0c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java @@ -58,6 +58,9 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { protected String statusMessage; + protected Integer position; + + private static final Map<String, Action> actionStingToEnumMap = ImmutableMap.<String, Action>builder() .put("Delete", Action.Delete) .put("Create", Action.Create) @@ -70,17 +73,18 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { protected BaseResource(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { this.modelInfo = modelInfo; this.modelInfo.setModelType(getModelType()); this.rollbackOnFailure = rollbackOnFailure; @@ -93,6 +97,7 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { this.trackById = trackById; this.isFailed = isFailed!= null ? isFailed: false; this.statusMessage = statusMessage; + this.position = position; } private Action actionStringToEnum(String actionAsString) { @@ -163,6 +168,14 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { this.statusMessage = statusMessage; } + public Integer getPosition() { + return position; + } + + public void setPosition(Integer position) { + this.position = position; + } + @JsonIgnore public abstract Collection<? extends BaseResource> getChildren(); diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java index b945f1327..f23c2e73e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java @@ -34,16 +34,18 @@ public class InstanceGroup extends BaseResource implements JobAdapter.AsyncJobRe private final Map<String, InstanceGroupMember> vnfGroupMembers; public InstanceGroup(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("vnfs") Map<String, InstanceGroupMember> vnfGroupMembers, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("vnfs") Map<String, InstanceGroupMember> vnfGroupMembers, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { - super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.vnfGroupMembers = vnfGroupMembers; } diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java index 7bfaf02b1..e9f34ccfb 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java @@ -30,11 +30,13 @@ import org.onap.vid.mso.model.ModelInfo; public class InstanceGroupMember extends BaseResource implements JobAdapter.AsyncJobRequest{ public InstanceGroupMember(@JsonProperty("instanceId") String instanceId, - @JsonProperty("action") String action, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage); + @JsonProperty("action") String action, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage, + position); } @Override diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java index 797e28a02..b9a0aeb85 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java @@ -39,22 +39,24 @@ public class Network extends BaseResource implements JobAdapter.AsyncJobRequest private final String lineOfBusiness; public Network(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("productFamilyId") String productFamilyId, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("platformName") String platformName, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, - @JsonProperty("lineOfBusinessName") String lineOfBusiness, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + @JsonProperty("productFamilyId") String productFamilyId, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("platformName") String platformName, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, + @JsonProperty("lineOfBusinessName") String lineOfBusiness, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.productFamilyId = productFamilyId; this.platformName = platformName; this.lineOfBusiness = lineOfBusiness; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java index afc8534a1..8828faf1d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java @@ -104,7 +104,8 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, @JsonProperty("vidNotions") VidNotions vidNotions) { - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + null); this.owningEntityId = owningEntityId; this.owningEntityName = owningEntityName; this.projectName = projectName; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java index 233850d58..41da85e35 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java @@ -42,22 +42,24 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest @JsonInclude(NON_NULL) private Boolean usePreload; private Map<String, String> supplementaryParams; - public VfModule( @JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("volumeGroupName") String volumeGroupInstanceName, - @JsonProperty("action") String action, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, - @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("sdncPreLoad") Boolean usePreload, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("volumeGroupName") String volumeGroupInstanceName, + @JsonProperty("action") String action, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, + @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("sdncPreLoad") Boolean usePreload, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.volumeGroupInstanceName = volumeGroupInstanceName; this.usePreload = usePreload; this.supplementaryParams = supplementaryParams; @@ -107,8 +109,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest this.getInstanceId(), this.getTrackById(), this.getIsFailed(), - this.getStatusMessage() - ); - + this.getStatusMessage(), + this.getPosition()); } }
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java index 0da3f0695..fc71f279f 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java @@ -44,23 +44,25 @@ public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest { private final Map<String, Map<String, VfModule>> vfModules; public Vnf(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("productFamilyId") String productFamilyId, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("platformName") String platformName, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, - @JsonProperty("lineOfBusinessName") String lineOfBusiness, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + @JsonProperty("productFamilyId") String productFamilyId, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("platformName") String platformName, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, + @JsonProperty("lineOfBusinessName") String lineOfBusiness, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.productFamilyId = productFamilyId; this.platformName = platformName; this.lineOfBusiness = lineOfBusiness; 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 f70d6250e..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,6 +69,10 @@ return (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)); }; + $scope.removeVendorFromCloudOwner = function (cloudOwner) { + return AaiService.removeVendorFromCloudOwner(cloudOwner) + }; + vm.isDisabledVNFmodelVersion = function (vnfTypePristine) { if ($scope.isNewFilterChangeManagmentEnabled()) { return !vm.isSearchedVNF; @@ -537,8 +541,34 @@ }); }; + 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'); + }); + } + vm.serviceTypeChanged = function () { - if (!$scope.isNewFilterChangeManagmentEnabled()) { + if ($scope.isNewFilterChangeManagmentEnabled()) { + loadCloudRegions(); + } else { vm.searchVNFs(); } }; @@ -547,23 +577,30 @@ 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); vm.vnfs = []; vm.vfModules = []; - let vnfRole = $scope.isNewFilterChangeManagmentEnabled() ? vm.changeManagement.vnfType : null; + + let vnfRole = null; let cloudRegion = null; + if ($scope.isNewFilterChangeManagmentEnabled()) { + vnfRole = vm.changeManagement.vnfType ? vm.changeManagement.vnfType : null; + cloudRegion = vm.changeManagement.cloudRegion ? vm.changeManagement.cloudRegion : null; + } AaiService.getVnfsByCustomerIdAndServiceType( vm.changeManagement.subscriberId, vm.changeManagement.serviceType["service-type"], vnfRole, cloudRegion, - ). - then(function (response) { + ).then(function (response) { vm.isSearchedVNF = true; var vnfsData = response.data.results; if (vnfsData) { @@ -601,6 +638,9 @@ vm.vnfTypes.push(vnf.properties['nf-role']) }); } + if ($scope.isNewFilterChangeManagmentEnabled()) { + vm.loadVNFVersions(); + } } ); }; @@ -612,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"] @@ -685,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 19b5f2b92..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,8 +137,8 @@ position: relative; } -.nf-role-input { - width: 50% +.new-filter-field { + width: 39% } /*LESS*/ 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 40bb92b7e..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,22 +70,37 @@ <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" + name="vnfType" id="vnfTypeInput" data-tests-id="vnfType" data-ng-disabled="newChangeManagement.serviceType.$pristine"> </div> + <div class="col new-filter-field"> + <label class="control-label">Cloud Region</label> + <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="" >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.tenantId}}" + data-ng-if="option.isPermitted && isFeatureFlagCloudOwner"> + {{option.cloudRegionId}} ({{removeVendorFromCloudOwner(option.cloudOwner).toUpperCase()}}) + </option> + </select> + </div> + <div class="col"> - <button class="search-vnf" type="button" id="searchVNF" name="searchVNFs" class="btn btn-primary" + <button class="btn btn-primary search-vnf" type="button" id="searchVNF" name="searchVNFs" ng-click="vm.searchVNFs()" - ng-disabled="newChangeManagement.subscriber.$pristine || newChangeManagement.serviceType.$pristine"> + ng-disabled="newChangeManagement.subscriber.$pristine || newChangeManagement.serviceType.$pristine" + data-tests-id="searchVNFs"> Search VNFs </button> </div> </div> - </div> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js index 994a3e4ac..0e1beefb6 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js @@ -86,6 +86,23 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }).join("&"); } + function getConfigParams(vnfRole, cloudRegion) { + if (!featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)) { + return null + } + + let data = { + vnfRole: vnfRole, + cloudRegion: cloudRegion, + }; + + let config = { + params: data + }; + + return config; + } + return { getSubscriberName: function (globalCustomerId, successCallbackFunction) { @@ -630,24 +647,17 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }, getVnfsByCustomerIdAndServiceType: function (globalSubscriberId, serviceType, vnfRole, cloudRegion) { - var deferred = $q.defer(); + let deferred = $q.defer(); let url = globalSubscriberId + COMPONENT.FORWARD_SLASH + serviceType - if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)){ - if (vnfRole) { - url + COMPONENT.FORWARD_SLASH + vnfRole - } - if (cloudRegion) { - url + COMPONENT.FORWARD_SLASH + cloudRegion; - } - } - + const path = COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + url; + let config = getConfigParams(vnfRole, cloudRegion); if (UtilityService.hasContents(globalSubscriberId) && UtilityService.hasContents(serviceType)) { - $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + url) + $http.get(path, config) .success(function (response) { if (response) { deferred.resolve({data: response}); 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 3e38ba883..83cc61ea4 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 @@ -39,6 +39,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; +import java.util.List; import java.util.Map; import java.util.UUID; import javax.ws.rs.core.Response; @@ -295,10 +296,10 @@ public class AaiControllerTest { given(aaiService.getAaiZones()).willReturn(new AaiResponse(aicZones, "", HttpStatus.OK.value())); mockMvc.perform(get("/aai_get_aic_zones") - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().json(objectMapper.writeValueAsString(aicZones))); + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(objectMapper.writeValueAsString(aicZones))); } @Test @@ -308,32 +309,32 @@ public class AaiControllerTest { .willReturn(new AaiResponse(null, expectedErrorMessage, HttpStatus.INTERNAL_SERVER_ERROR.value())); mockMvc.perform(get("/aai_get_aic_zones") - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isInternalServerError()) - .andExpect(content().string(expectedErrorMessage)); + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isInternalServerError()) + .andExpect(content().string(expectedErrorMessage)); } @Test public void getSpecificPnf_shouldReturnPnfObjectForPnfId() throws Exception { String pnfId = "MyPnfId"; Pnf pnf = Pnf.builder() - .withPnfId(pnfId) - .withPnfName("TestPnf") - .withPnfName2("pnfName2") - .withPnfName2Source("pnfNameSource") - .withEquipModel("model") - .withEquipType("type") - .withEquipVendor("vendor") - .build(); + .withPnfId(pnfId) + .withPnfName("TestPnf") + .withPnfName2("pnfName2") + .withPnfName2Source("pnfNameSource") + .withEquipModel("model") + .withEquipType("type") + .withEquipVendor("vendor") + .build(); AaiResponse<Pnf> aaiResponse = new AaiResponse<>(pnf, "", HttpStatus.OK.value()); given(aaiService.getSpecificPnf(pnfId)).willReturn(aaiResponse); mockMvc.perform(get("/aai_get_pnfs/pnf/{pnf_id}", pnfId) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().json(objectMapper.writeValueAsString(pnf))); + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(objectMapper.writeValueAsString(pnf))); } @Test @@ -343,10 +344,10 @@ public class AaiControllerTest { given(aaiService.getSpecificPnf(pnfId)).willThrow(new RuntimeException(expectedErrorMessage)); mockMvc.perform(get("/aai_get_pnfs/pnf/{pnf_id}", pnfId) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isInternalServerError()) - .andExpect(content().string(expectedErrorMessage)); + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isInternalServerError()) + .andExpect(content().string(expectedErrorMessage)); } public void getPNFInstances_shouldReturnOKResponseFromAAIService() throws Exception { @@ -366,12 +367,12 @@ public class AaiControllerTest { equipModel)).willReturn(aaiResponse); mockMvc.perform( - get(urlTemplate, globalCustomerId, serviceType, modelVersionId, - modelInvariantId, cloudRegion, equipVendor, equipModel) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(expectedResponseBody)); + get(urlTemplate, globalCustomerId, serviceType, modelVersionId, + modelInvariantId, cloudRegion, equipVendor, equipModel) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); } @Test @@ -385,12 +386,12 @@ public class AaiControllerTest { .getVersionByInvariantId(request.versions)).willReturn(response); mockMvc.perform( - post("/aai_get_version_by_invariant_id") - .content(objectMapper.writeValueAsString(request)) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(expectedResponse)); + post("/aai_get_version_by_invariant_id") + .content(objectMapper.writeValueAsString(request)) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponse)); } @Test @@ -408,12 +409,12 @@ public class AaiControllerTest { .willReturn(aaiResponse); mockMvc.perform( - get("/aai_sub_details/{subscriberId}", subscriberId) - .param("omitServiceInstances", Boolean.toString(omitServiceInstances)) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(objectMapper.writeValueAsString(okResponseBody))); + get("/aai_sub_details/{subscriberId}", subscriberId) + .param("omitServiceInstances", Boolean.toString(omitServiceInstances)) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(objectMapper.writeValueAsString(okResponseBody))); } @Test @@ -437,50 +438,98 @@ public class AaiControllerTest { @Test public void getPortMirroringConfigData_givenThreeIds_ReturnsThreeResults() { - final AaiResponseTranslator.PortMirroringConfigDataOk toBeReturnedForA = new AaiResponseTranslator.PortMirroringConfigDataOk("foobar"); - final AaiResponseTranslator.PortMirroringConfigDataError toBeReturnedForB = new AaiResponseTranslator.PortMirroringConfigDataError("foo", "{ baz: qux }"); - final AaiResponseTranslator.PortMirroringConfigDataOk toBeReturnedForC = new AaiResponseTranslator.PortMirroringConfigDataOk("corge"); + final AaiResponseTranslator.PortMirroringConfigDataOk toBeReturnedForA = new AaiResponseTranslator.PortMirroringConfigDataOk( + "foobar"); + final AaiResponseTranslator.PortMirroringConfigDataError toBeReturnedForB = new AaiResponseTranslator.PortMirroringConfigDataError( + "foo", "{ baz: qux }"); + final AaiResponseTranslator.PortMirroringConfigDataOk toBeReturnedForC = new AaiResponseTranslator.PortMirroringConfigDataOk( + "corge"); Mockito - .doReturn(toBeReturnedForA) - .doReturn(toBeReturnedForB) - .doReturn(toBeReturnedForC) - .when(aaiService).getPortMirroringConfigData(Mockito.anyString()); + .doReturn(toBeReturnedForA) + .doReturn(toBeReturnedForB) + .doReturn(toBeReturnedForC) + .when(aaiService).getPortMirroringConfigData(Mockito.anyString()); - final Map<String, AaiResponseTranslator.PortMirroringConfigData> result = aaiController.getPortMirroringConfigsData(ImmutableList.of("a", "b", "c")); + final Map<String, AaiResponseTranslator.PortMirroringConfigData> result = aaiController + .getPortMirroringConfigsData(ImmutableList.of("a", "b", "c")); assertThat(result, is(ImmutableMap.of( - "a", toBeReturnedForA, - "b", toBeReturnedForB, - "c", toBeReturnedForC + "a", toBeReturnedForA, + "b", toBeReturnedForB, + "c", toBeReturnedForC ))); } @Test public void getSubscriberDetails_shouldIncludeServiceInstancesFromSubscriberData_whenFeatureDisabled_andOmitFlagIsFalse() - throws Exception { + throws Exception { boolean isFeatureActive = false; boolean omitServiceInstances = false; getSubscriberDetails_assertServiceInstancesInclusion(isFeatureActive, omitServiceInstances); } private void getSubscriberDetails_assertServiceInstancesInclusion(boolean isFeatureActive, - boolean omitServiceInstances) throws Exception { + boolean omitServiceInstances) throws Exception { String subscriberId = "subscriberId"; 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), - eq(isFeatureActive && omitServiceInstances))) - .willReturn(aaiResponse); + eq(isFeatureActive && omitServiceInstances))) + .willReturn(aaiResponse); mockMvc.perform( - get("/aai_sub_details/{subscriberId}", subscriberId) - .param("omitServiceInstances", Boolean.toString(omitServiceInstances)) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(objectMapper.writeValueAsString(okResponseBody))); + get("/aai_sub_details/{subscriberId}", subscriberId) + .param("omitServiceInstances", Boolean.toString(omitServiceInstances)) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(objectMapper.writeValueAsString(okResponseBody))); + } + + @Test + public void getSpecificConfiguration_shouldReturnOkResponse() throws Exception { + String configurationId = "testGlobalCustomerId"; + String expectedResponseBody = "OK_RESPONSE"; + Response response = mock(Response.class); + given(response.readEntity(String.class)).willReturn(expectedResponseBody); + given(response.getStatus()).willReturn(HttpStatus.OK.value()); + + given(aaiRestInterface.RestGet( + eq("VidAaiController"), + anyString(), + eq(Unchecked.toURI("network/configurations/configuration/" + configurationId)), + eq(false)).getResponse()).willReturn(response); + + mockMvc + .perform( + get("/aai_get_configuration/{configuration_id}", configurationId) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); } + + @Test + public void getServiceInstanceAssociatedPnfs_shouldReturnPnfs() throws Exception { + String globalCustomerId = "testCustomerId"; + String serviceType = "testServiceType"; + String serviceInstanceId = "testServiceInstanceId"; + List<String> expectedPnfs = ImmutableList.of("pnf1", "pnf2", "pnf3"); + + given(aaiService.getServiceInstanceAssociatedPnfs(globalCustomerId, serviceType, serviceInstanceId)) + .willReturn(expectedPnfs); + + mockMvc + .perform( + get("/aai_get_service_instance_pnfs/{globalCustomerId}/{serviceType}/{serviceInstanceId}", + globalCustomerId, serviceType, serviceInstanceId) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(objectMapper.writeValueAsString(expectedPnfs))); + } + } diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java index a32450510..5aa6505d4 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java @@ -127,6 +127,137 @@ public class MsoControllerTest { } @Test + public void shouldCreateVfModuleInstance() throws Exception { + // given + RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class); + String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + String vnfInstanceId = "fe9000-0009-9999"; + + MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test"); + given(msoBusinessLogic + .createVfModuleInstance(objectEqualTo(requestDetails), eq(serviceInstanceId), eq(vnfInstanceId))) + .willReturn(expectedResponse); + + // when & then + mockMvc.perform(post(format("/mso/mso_create_vfmodule_instance/%s/vnfs/%s", serviceInstanceId, vnfInstanceId)) + .content(asJson(requestDetails)) + .contentType(APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(asJson(expectedResponse))); + + then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails)); + } + + @Test + public void shouldCreateConfigurationInstance() throws Exception { + // given + RequestDetailsWrapper requestDetails = modelGenerator.nextObject(RequestDetailsWrapper.class); + String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + + MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test"); + given(msoBusinessLogic + .createConfigurationInstance(objectEqualTo(requestDetails), eq(serviceInstanceId))) + .willReturn(expectedResponse); + + // when & then + mockMvc.perform(post(format("/mso/mso_create_configuration_instance/%s/configurations/", serviceInstanceId)) + .content(asJson(requestDetails)) + .contentType(APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(asJson(expectedResponse))); + + then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails.getRequestDetails())); + } + + @Test + public void shouldDeleteE2eSvcInstance() throws Exception { + // given + RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class); + String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + String configurationId = "28630972-d548-4d5f-acc2-ad1d748d023d"; + + MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test"); + given(msoBusinessLogic + .setConfigurationActiveStatus(objectEqualTo(requestDetails), eq(serviceInstanceId), eq(configurationId), eq(true))) + .willReturn(expectedResponse); + + // when & then + mockMvc.perform(post(format("/mso/mso_activate_configuration/%s/configurations/%s", serviceInstanceId, configurationId)) + .content(asJson(requestDetails)) + .contentType(APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(asJson(expectedResponse))); + + then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails)); + } + + @Test + public void shouldDeactivateConfiguration() throws Exception { + // given + RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class); + String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + String configurationId = "28630972-d548-4d5f-acc2-ad1d748d023d"; + + MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test"); + given(msoBusinessLogic + .setConfigurationActiveStatus(objectEqualTo(requestDetails), eq(serviceInstanceId), eq(configurationId), eq(false))) + .willReturn(expectedResponse); + + // when & then + mockMvc.perform(post(format("/mso/mso_deactivate_configuration/%s/configurations/%s", serviceInstanceId, configurationId)) + .content(asJson(requestDetails)) + .contentType(APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(asJson(expectedResponse))); + + then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails)); + } + + @Test + public void shouldDisablePortOnConfiguration() throws Exception { + // given + RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class); + String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + String configurationId = "28630972-d548-4d5f-acc2-ad1d748d023d"; + + MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test"); + given(msoBusinessLogic + .setPortOnConfigurationStatus(objectEqualTo(requestDetails), eq(serviceInstanceId), eq(configurationId), eq(false))) + .willReturn(expectedResponse); + + // when & then + mockMvc.perform(post(format("/mso/mso_disable_port_configuration/%s/configurations/%s", serviceInstanceId, configurationId)) + .content(asJson(requestDetails)) + .contentType(APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(asJson(expectedResponse))); + + then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails)); + } + + @Test + public void shouldEnablePortOnConfiguration() throws Exception { + // given + RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class); + String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014"; + String configurationId = "28630972-d548-4d5f-acc2-ad1d748d023d"; + + MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test"); + given(msoBusinessLogic + .setPortOnConfigurationStatus(objectEqualTo(requestDetails), eq(serviceInstanceId), eq(configurationId), eq(true))) + .willReturn(expectedResponse); + + // when & then + mockMvc.perform(post(format("/mso/mso_enable_port_configuration/%s/configurations/%s", serviceInstanceId, configurationId)) + .content(asJson(requestDetails)) + .contentType(APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(asJson(expectedResponse))); + + then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails)); + } + + @Test public void shouldCreateVolumeInstance() throws Exception { // given RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class); diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java index 2780e1515..9501614b7 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java @@ -273,30 +273,35 @@ public class ResourceCommandTest { } static InstanceGroup createGroup(List<InstanceGroupMember> groupMembers, Action action) { - return new InstanceGroup(mock(ModelInfo.class), null, action.name(), false, null, convertToMap(groupMembers), null, null, null); + return new InstanceGroup(mock(ModelInfo.class), null, action.name(), false, null, convertToMap(groupMembers), null, null, null, + null); } static InstanceGroupMember createMember(Action action) { - return new InstanceGroupMember(null, action.toString(), null, null, null); + return new InstanceGroupMember(null, action.toString(), null, null, null, null); } static Vnf createVnf(List<VfModule> vfModules, Action action) { Map<String, Map<String, VfModule>> vfModulesMap = new HashMap<>(); vfModulesMap.put("abc",convertToMap(vfModules)); - return new Vnf(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null, vfModulesMap, null, null, null); + return new Vnf(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null, vfModulesMap, null, null, null, + null); } static Vnf createVnf(Action action) { - return new Vnf(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null,null, null, null, null); + return new Vnf(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null,null, null, null, null, + null); } static VfModule createVfModule(Action action) { - return new VfModule(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, false, false, null, null, null, null); + return new VfModule(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, false, false, null, null, null, null, + null); } static Network createNetwork(Action action) { - return new Network(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null, null, null, null); + return new Network(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null, null, null, null, + null); } } diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java index 9cc97116b..9c0260e85 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java @@ -171,11 +171,12 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests vfModuleInfo.setModelInvariantId("22222222-f63c-463e-ba94-286933b895f9"); vfModuleInfo.setModelVersion("10.0"); return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), "mdt1", null, - "88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, true, null, UUID.randomUUID().toString(), null, null); + "88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, true, null, UUID.randomUUID().toString(), null, null, + null); } return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), null, null, null, - instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null, null); + instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null, null, null); } protected ModelInfo createVfModuleModelInfo(String modelName, String modelVersion, String modelVersionId, String modelInvariantId, String modelCustomizationId, String modelCustomizationName) { @@ -184,7 +185,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName, String lcpCloudRegionId, String tenantId) { return new VfModule( vfModuleModelInfo, instanceName, null, Action.Upgrade.name(), lcpCloudRegionId, null, tenantId, - null, null, true, null, null, UUID.randomUUID().toString(), null, null); + null, null, true, null, null, UUID.randomUUID().toString(), null, null, null); } protected ModelInfo createVnfModelInfo(boolean isAlacarte) { @@ -267,7 +268,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests Vnf vnf = new Vnf(vnfModelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", (isUserProvidedNaming ? VNF_NAME : null), Action.Create.name(), "platformName", "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", vnfInstanceParams,"lineOfBusinessName" , false, null, vfModules, - UUID.randomUUID().toString(), null, null); + UUID.randomUUID().toString(), null, null, null); vnfs.put(vnf.getModelInfo().getModelName(), vnf); return vnfs; @@ -320,7 +321,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests details->new Network(createNetworkModelInfo(isALaCarte, details.modelCustomizationId), "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", details.name, Action.Create.name(), "platformName", "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", instanceParams,"lineOfBusinessName" , - false, null, UUID.randomUUID().toString(), null, null)); + false, null, UUID.randomUUID().toString(), null, null, null)); // I can't tell why compiler don't like the statement if it's only one line... return networkStream.collect(Collectors.toMap(network -> network.getModelInfo().getModelCustomizationId(), network -> network)); } @@ -335,7 +336,8 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests modelInfo.setModelInvariantId("11111111-f63c-463e-ba94-286933b895f9"); modelInfo.setModelVersion("10.0"); - return new InstanceGroup(modelInfo, (isUserProvidedNaming ? VNF_GROUP_NAME : null), action.name(), false, null, emptyMap(), UUID.randomUUID().toString(), null, null); + return new InstanceGroup(modelInfo, (isUserProvidedNaming ? VNF_GROUP_NAME : null), action.name(), false, null, emptyMap(), UUID.randomUUID().toString(), null, null, + null); } protected ModelInfo createServiceModelInfo() { diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java index ce0aa42f2..c1a6abc73 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java @@ -1048,7 +1048,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT public void whenLcpRegionNotEmpty_thenCloudRegionIdOfResourceIsLegacy() { String legacyCloudRegion = "legacyCloudRegion"; Vnf vnf = new Vnf(new ModelInfo(), null, null, Action.Create.name(), null, "anyCloudRegion", legacyCloudRegion, - null, null, null, false, null, null, UUID.randomUUID().toString(), null, null); + null, null, null, false, null, null, UUID.randomUUID().toString(), null, null, null); assertThat(vnf.getLcpCloudRegionId(), equalTo(legacyCloudRegion)); } diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java index 2c70b3ddc..e28ea304f 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java @@ -533,7 +533,8 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { " }" + "}"; Vnf vnfDetails = new Vnf(createVnfModelInfo(true), "productFamily", "instanceName", Action.Delete.name(), "platform", "AAIAIC25", null, - "092eb9e8e4b7412e8787dd091bc58e86", null, null, false, "VNF_INSTANCE_ID", null, UUID.randomUUID().toString(), null, null); + "092eb9e8e4b7412e8787dd091bc58e86", null, null, false, "VNF_INSTANCE_ID", null, UUID.randomUUID().toString(), null, null, + null); RequestDetailsWrapper<VnfInstantiationRequestDetails> result = msoRequestBuilder.generateDeleteVnfRequest(vnfDetails, "az2018"); MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); 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 0f75df67e..500d98130 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 @@ -40,6 +40,7 @@ import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions; 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; @@ -93,7 +94,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)); @@ -105,6 +114,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(); @@ -115,8 +125,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); @@ -159,6 +176,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"; @@ -222,6 +240,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" + } + ] + } + ] + } +} diff --git a/vid-webpack-master/cypress/pipeline/run_group1.sh b/vid-webpack-master/cypress/pipeline/run_group1.sh index d60b85312..526fd7dec 100644 --- a/vid-webpack-master/cypress/pipeline/run_group1.sh +++ b/vid-webpack-master/cypress/pipeline/run_group1.sh @@ -10,4 +10,4 @@ TESTS_GROUP_FILE=cypress/pipeline/group1.txt cd ${CYPRESS_HOME_DIR} cat ${TESTS_GROUP_FILE} -npm run cypress:headless -- --spec=$(cat ${TESTS_GROUP_FILE} | tr '\n' ',') +npm run cypress:headless --max-old-space-size=4096 -- --spec=$(cat ${TESTS_GROUP_FILE} | tr '\n' ',') diff --git a/vid-webpack-master/cypress/pipeline/run_group2.sh b/vid-webpack-master/cypress/pipeline/run_group2.sh index 2f30fa7df..43cfbc63f 100644 --- a/vid-webpack-master/cypress/pipeline/run_group2.sh +++ b/vid-webpack-master/cypress/pipeline/run_group2.sh @@ -14,4 +14,4 @@ cd ${CYPRESS_HOME_DIR} ls -1 cypress/integration/*/*.e2e.ts | comm -3 - ${TESTS_GROUP_FILE_1} > ${TESTS_GROUP_FILE} cat ${TESTS_GROUP_FILE} -npm run cypress:headless -- --spec=$(cat ${TESTS_GROUP_FILE} | tr '\n' ',') +npm run cypress:headless --max-old-space-size=4096 -- --spec=$(cat ${TESTS_GROUP_FILE} | tr '\n' ',') |