diff options
26 files changed, 2098 insertions, 548 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java index c43779df1..c82f5485e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java +++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java @@ -27,10 +27,15 @@ import static java.util.stream.Collectors.toMap; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.apache.commons.lang3.StringUtils.isEmpty; +import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import java.io.IOException; +import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; @@ -44,10 +49,12 @@ import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.http.HttpStatus; import org.apache.http.client.utils.URIBuilder; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -281,6 +288,36 @@ public class AaiClient implements AaiClientInterface { .collect(toMap(SimpleResult::getNodeType, SimpleResult::getProperties)); } + @Override + public AaiResponse getVnfsByParamsForChangeManagement(String subscriberId, String serviceType, @Nullable String nfRole, + @Nullable String cloudRegion) { + String payloadAsString = ""; + ResponseWithRequestInfo response; + ImmutableMap<String, Serializable> payload = getMapForAAIQueryByParams(subscriberId, serviceType, + nfRole, cloudRegion); + try { + payloadAsString = JACKSON_OBJECT_MAPPER.writeValueAsString(payload); + } catch (JsonProcessingException e) { + logger.error(e.getMessage()); + ExceptionUtils.rethrow(e); + } + response = doAaiPut(QUERY_FORMAT_SIMPLE, payloadAsString, false, false); + AaiResponseWithRequestInfo aaiResponse = processAaiResponse(response, JsonNode.class, false); + verifyAaiResponseValidityOrThrowExc(aaiResponse, aaiResponse.getAaiResponse().getHttpCode()); + return aaiResponse.getAaiResponse(); + } + + private ImmutableMap<String, Serializable> getMapForAAIQueryByParams(String subscriberId, + String serviceType, @Nullable String nfRole, @Nullable String cloudRegion) { + String nfRoleParam = nfRole != null ? "?nfRole=" + nfRole : ""; + String query = "query/vnfs-fromServiceInstance-filter" + nfRoleParam; + return ImmutableMap.of( + "start", ImmutableList + .of("/business/customers/customer/" + subscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances"), + "query", query + ); + } + private boolean isResourceExistByStatusCode(ResponseWithRequestInfo responseWithRequestInfo) { // 200 - is found // 404 - resource not found @@ -315,19 +352,20 @@ public class AaiClient implements AaiClientInterface { } final AaiResponseWithRequestInfo<T> aaiResponse = processAaiResponse(responseWithRequestInfo, clz, VidObjectMapperType.FASTERXML, true); + verifyAaiResponseValidityOrThrowExc(aaiResponse, responseWithRequestInfo.getResponse().getStatus()); + return aaiResponse.getAaiResponse().getT(); + } + private void verifyAaiResponseValidityOrThrowExc(AaiResponseWithRequestInfo aaiResponse, int httpCode) { if (aaiResponse.getAaiResponse().getHttpCode() > 399 || aaiResponse.getAaiResponse().getT() == null) { throw new ExceptionWithRequestInfo(aaiResponse.getHttpMethod(), - aaiResponse.getRequestedUrl(), - aaiResponse.getRawData(), - responseWithRequestInfo.getResponse().getStatus(), - new InvalidAAIResponseException(aaiResponse.getAaiResponse())); + aaiResponse.getRequestedUrl(), + aaiResponse.getRawData(), + httpCode, + new InvalidAAIResponseException(aaiResponse.getAaiResponse())); } - - return aaiResponse.getAaiResponse().getT(); } - private String getUrlFromLIst(String url, String paramKey, List<String> params){ int i = 0; for(String param: params){ diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java index 1350461b0..8c3c66d17 100644 --- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java +++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java @@ -21,6 +21,10 @@ package org.onap.vid.aai; import com.fasterxml.jackson.databind.JsonNode; +import java.net.URI; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.Response; import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList; import org.onap.vid.aai.model.AaiGetPnfs.Pnf; import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; @@ -32,11 +36,6 @@ import org.onap.vid.model.SubscriberList; import org.onap.vid.services.ProbeInterface; import org.springframework.http.HttpMethod; -import javax.ws.rs.core.Response; -import java.net.URI; -import java.util.List; -import java.util.Map; - /** * Created by Oren on 7/4/17. */ @@ -103,4 +102,6 @@ public interface AaiClientInterface extends ProbeInterface { void resetCache(String cacheName); Map<String, Properties> getCloudRegionAndTenantByVnfId(String vnfId); + + AaiResponse getVnfsByParamsForChangeManagement(String subscriberId, String serviceType, String nfRole, String cloudRegion); } diff --git a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java index f7087568d..5c65c8af4 100644 --- a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java +++ b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java @@ -21,8 +21,8 @@ package org.onap.vid.client; -import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.onap.vid.client.UnirestPatchKt.patched; +import static org.onap.vid.utils.KotlinUtilsKt.JOSHWORKS_JACKSON_OBJECT_MAPPER; import com.att.eelf.configuration.EELFLogger; import io.joshworks.restclient.http.HttpResponse; @@ -250,27 +250,7 @@ public class SyncRestClient implements SyncRestClientInterface { } private ObjectMapper defaultObjectMapper() { - com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper(); - - return new ObjectMapper() { - @Override - public <T> T readValue(String value, Class<T> aClass) { - try { - return isEmpty(value) ? null : objectMapper.readValue(value, aClass); - } catch (IOException e) { - throw new SyncRestClientException("IOException while reading value", e); - } - } - - @Override - public String writeValue(Object value) { - try { - return objectMapper.writeValueAsString(value); - } catch (IOException e) { - throw new SyncRestClientException("IOException while writing value", e); - } - } - }; + return JOSHWORKS_JACKSON_OBJECT_MAPPER; } private CloseableHttpClient defaultHttpClient() { 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 e0d211c24..d1f7a97b5 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 @@ -20,7 +20,9 @@ package org.onap.vid.controller; +import java.util.List; import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.onap.vid.aai.AaiClientInterface; import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; @@ -29,15 +31,20 @@ import org.onap.vid.aai.model.Permissions; 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.RoleProvider; import org.onap.vid.services.AaiService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import org.togglz.core.manager.FeatureManager; /** * Controller to handle a&ai new requests. @@ -49,12 +56,14 @@ public class AaiController2 extends VidRestrictedBaseController { private final AaiService aaiService; private final RoleProvider roleProvider; private final AaiClientInterface aaiClient; + private final FeatureManager featureManager; @Autowired - public AaiController2(AaiService aaiService, RoleProvider roleProvider, AaiClientInterface aaiClient) { + public AaiController2(AaiService aaiService, RoleProvider roleProvider, AaiClientInterface aaiClient, FeatureManager featureManager) { this.aaiService = aaiService; this.roleProvider = roleProvider; this.aaiClient = aaiClient; + this.featureManager = featureManager; } @RequestMapping(value = "/aai_get_homing_by_vfmodule/{vnfInstanceId}/{vfModuleId}", method = RequestMethod.GET) @@ -123,4 +132,16 @@ public class AaiController2 extends VidRestrictedBaseController { public ModelVer getNewestModelVersionByInvariant(@PathVariable("invariantId") String invariantId) { return aaiService.getNewestModelVersionByInvariantId(invariantId); } + + @GetMapping(value = "/get_vnf_data_by_globalid_and_service_type/{globalCustomerId}/{serviceType}") + public Object getVnfDataByGlobalIdAndServiceType( + @PathVariable("globalCustomerId") String globalCustomerId, + @PathVariable("serviceType") String serviceType, + @RequestParam(name="nfRole", required = false) String nfRole, + @RequestParam(name="cloudRegion", required = false) String cloudRegion) { + if (featureManager.isActive(Features.FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG)){ + return aaiClient.getVnfsByParamsForChangeManagement(globalCustomerId, serviceType, nfRole, cloudRegion).getT(); + } + return aaiService.getVNFData(globalCustomerId, serviceType).getT(); + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java index 99845f06d..9faa7ade5 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java @@ -22,13 +22,10 @@ package org.onap.vid.controller; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; -import static org.apache.commons.lang3.StringUtils.isEmpty; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.module.kotlin.KotlinModule; import io.joshworks.restclient.http.mapper.ObjectMapper; import java.io.File; -import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.servlet.ServletContext; @@ -66,6 +63,7 @@ import org.onap.vid.services.AaiServiceImpl; import org.onap.vid.services.ChangeManagementService; import org.onap.vid.services.PombaService; import org.onap.vid.services.PombaServiceImpl; +import org.onap.vid.utils.JoshworksJacksonObjectMapper; import org.onap.vid.utils.Logging; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; @@ -198,28 +196,8 @@ public class WebConfig { } @Bean - public ObjectMapper unirestFasterxmlObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) { - return new ObjectMapper() { - - @Override - public <T> T readValue(String s, Class<T> aClass) { - try { - return isEmpty(s) ? null : objectMapper.readValue(s, aClass); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public String writeValue(Object o) { - try { - return objectMapper.writeValueAsString(o); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - } - }; - + public ObjectMapper unirestFasterxmlObjectMapper() { + return new JoshworksJacksonObjectMapper(); } @Bean 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 394fc9cd4..9abf68bca 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 @@ -74,6 +74,7 @@ public enum Features implements Feature { FLAG_PNP_INSTANTIATION, FLAG_HANDLE_SO_WORKFLOWS, FLAG_CREATE_ERROR_REPORTS, + FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG, FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT, FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH, ; diff --git a/vid-app-common/src/main/java/org/onap/vid/utils/KotlinUtils.kt b/vid-app-common/src/main/java/org/onap/vid/utils/KotlinUtils.kt index cf532624c..81afe29e0 100644 --- a/vid-app-common/src/main/java/org/onap/vid/utils/KotlinUtils.kt +++ b/vid-app-common/src/main/java/org/onap/vid/utils/KotlinUtils.kt @@ -22,9 +22,23 @@ package org.onap.vid.utils import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import org.apache.commons.lang3.StringUtils.isEmpty inline fun <reified E: Enum<E>> getEnumFromMapOfStrings(map: Map<String, Any>, key:String, defaultValue:E): E { return java.lang.Enum.valueOf(E::class.java, (map.getOrDefault(key, defaultValue.name) as String)) } @JvmField val JACKSON_OBJECT_MAPPER: ObjectMapper = jacksonObjectMapper() + +class JoshworksJacksonObjectMapper: io.joshworks.restclient.http.mapper.ObjectMapper { + override fun writeValue(value: Any?): String? { + return JACKSON_OBJECT_MAPPER.writeValueAsString(value) + } + + override fun <T : Any?> readValue(value: String?, valueType: Class<T>?): T? { + return if (isEmpty(value)) null else JACKSON_OBJECT_MAPPER.readValue(value, valueType) + } +} + +@JvmField val JOSHWORKS_JACKSON_OBJECT_MAPPER: + io.joshworks.restclient.http.mapper.ObjectMapper = JoshworksJacksonObjectMapper() diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties index 70eaae964..8438172e3 100644 --- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties +++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties @@ -32,4 +32,5 @@ FLAG_1810_AAI_LOCAL_CACHE = true FLAG_1902_NEW_VIEW_EDIT= false FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER = false FLAG_1902_VNF_GROUPING = true -FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH=false
\ No newline at end of file +FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH=false +FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = false 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 0c6d1d74f..f76d4786f 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 @@ -259,6 +259,7 @@ appDS2 FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE: "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE", FLAG_HANDLE_SO_WORKFLOWS: "FLAG_HANDLE_SO_WORKFLOWS", FLAG_CREATE_ERROR_REPORTS: "FLAG_CREATE_ERROR_REPORTS", + FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH: "FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH", FLAG_VF_MODULE_RESUME_STATUS_CREATE: "FLAG_VF_MODULE_RESUME_STATUS_CREATE", FLAG_1908_RELEASE_TENANT_ISOLATION: "FLAG_1908_RELEASE_TENANT_ISOLATION", FLAG_FLASH_REPLACE_VF_MODULE: "FLAG_FLASH_REPLACE_VF_MODULE", 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 528d3d552..28b3eea5d 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 @@ -21,31 +21,33 @@ (function () { 'use strict'; - appDS2.controller("newChangeManagementModalController", ["$uibModalInstance", "$uibModal",'$q', "AaiService", "changeManagementService", "Upload", - "$log", "$scope", "_", "COMPONENT", "VIDCONFIGURATION","DataService","featureFlags", newChangeManagementModalController]); + appDS2.controller("newChangeManagementModalController", ["$uibModalInstance", "$uibModal", '$q', "AaiService", "changeManagementService", "Upload", + "$log", "$scope", "_", "COMPONENT", "VIDCONFIGURATION", "DataService", "featureFlags", newChangeManagementModalController]); - function newChangeManagementModalController($uibModalInstance, $uibModal,$q, AaiService, changeManagementService, Upload, $log, $scope, _, COMPONENT, VIDCONFIGURATION, DataService, featureFlags) { + function newChangeManagementModalController($uibModalInstance, $uibModal, $q, AaiService, changeManagementService, Upload, $log, $scope, _, COMPONENT, VIDCONFIGURATION, DataService, featureFlags) { var vm = this; vm.hasScheduler = !!VIDCONFIGURATION.SCHEDULER_PORTAL_URL; - vm.errorMsg=''; + vm.errorMsg = ''; + + vm.isSearchedVNF = false; vm.wizardStep = 1; - vm.nextStep = function(){ + vm.nextStep = function () { vm.wizardStep++; - $(".modal-dialog").animate({"width":"1200px"},400,'linear'); + $(".modal-dialog").animate({"width": "1200px"}, 400, 'linear'); }; - vm.prevStep = function(){ + vm.prevStep = function () { vm.wizardStep--; - $(".modal-dialog").animate({"width":"600px"},400,'linear'); + $(".modal-dialog").animate({"width": "600px"}, 400, 'linear'); }; vm.softwareVersionRegex = "[-a-zA-Z0-9\.]+"; var attuid; - $scope.showReportWindow = function() { + $scope.showReportWindow = function () { const modalWindow = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html', controller: 'reportModalController', @@ -59,10 +61,20 @@ }; - $scope.isShowErrorReport = function() { + $scope.isShowErrorReport = function () { return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_CREATE_ERROR_REPORTS); }; + $scope.isNewFilterChangeManagmentEnabled = function () { + return (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)); + }; + + vm.isDisabledVNFmodelVersion = function (vnfTypePristine) { + if ($scope.isNewFilterChangeManagmentEnabled()) { + return !vm.isSearchedVNF; + } else return vnfTypePristine; + }; + function fetchAttUid() { var defer = $q.defer(); if (attuid) { @@ -97,7 +109,7 @@ .catch(function (error) { $log.error(error); vm.errorMsg = err; - }); + }); }; var registerVNFNamesWatcher = function () { @@ -121,29 +133,29 @@ availableVersions.push(extractVNFModel(vnf, response.data.service, newVNFName)); //for scale out screen - if(service.uuid === newVNFName["service-instance-node"][0].properties["model-version-id"]) { + if (service.uuid === newVNFName["service-instance-node"][0].properties["model-version-id"]) { newVNFName.vfModules = vnf.vfModules; newVNFName.category = response.data.service.category; newVNFName.groupModules = _.groupBy(newVNFName.vfModules, "customizationUuid"); //list vfmodules ids in AAI that belong to that vnf instance - var modulesAaiIds = _.filter(newVNFName.relatedTo, function(item){ + var modulesAaiIds = _.filter(newVNFName.relatedTo, function (item) { return item["node-type"] === "vf-module"; - }).map(function(item){ + }).map(function (item) { return item.id; }); _.forEach(newVNFName.vfModules, function (mdl, key) { mdl.scale = false; //defaults to not scale unless user changes it - if(mdl.properties && mdl.properties.maxCountInstances) { + if (mdl.properties && mdl.properties.maxCountInstances) { //how many vf modules of the same customizationId belong to that vnf instance - mdl.currentCount = _.filter(vm.vfModules, function(item){ + mdl.currentCount = _.filter(vm.vfModules, function (item) { return modulesAaiIds.indexOf(item.id) > -1 && item.properties["model-customization-id"] === mdl.customizationUuid; }).length; mdl.scalable = mdl.properties.maxCountInstances - mdl.currentCount > 0; - }else{ + } else { mdl.scalable = false; } }); @@ -151,7 +163,7 @@ } }); var versions = _.uniqBy(availableVersions, 'modelInfo.modelVersion'); - newVNFName.availableVersions = _.sortBy(_.uniq(versions, response.data.service, true),"modelInfo.modelVersion"); + newVNFName.availableVersions = _.sortBy(_.uniq(versions, response.data.service, true), "modelInfo.modelVersion"); }).catch(function (error) { $log.error(error); vm.errorMsg = error; @@ -242,74 +254,74 @@ result.requestDetails = []; _.forEach(changeManagement.vnfNames, function (vnf) { - try{ - var requestInfoData ={}; - var requestParametersData ={}; + try { + var requestInfoData = {}; + var requestParametersData = {}; var moduleToScale = _.find(vnf.vfModules, {"scale": true}); - if (vnf.availableVersions && vnf.availableVersions.length!=0){ + if (vnf.availableVersions && vnf.availableVersions.length != 0) { - requestInfoData ={ + requestInfoData = { source: vnf.availableVersions[0].requestInfo.source, suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback, requestorId: vnf.availableVersions[0].requestInfo.requestorId }; - if(workflowType=='Update'){ + if (workflowType == 'Update') { requestParametersData = { usePreload: vnf.availableVersions[0].requestParameters.usePreload }; - }else if(workflowType=="Replace"){ + } else if (workflowType == "Replace") { requestParametersData = { rebuildVolumeGroups: vnf.availableVersions[0].requestParameters.usePreload }; - }else if(workflowType=="VNF In Place Software Update"){ + } else if (workflowType == "VNF In Place Software Update") { var payloadObj = { - 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, - 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, - 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value + 'existing_software_version': vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, + 'new_software_version': vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, + 'operations_timeout': vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value }; requestParametersData = { payload: JSON.stringify(payloadObj) }; - }else if(workflowType=="VNF Config Update"){ + } else if (workflowType == "VNF Config Update") { requestParametersData = { payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value }; - }else if(workflowType=="VNF Scale Out"){ - if(!moduleToScale) return null; + } else if (workflowType == "VNF Scale Out") { + if (!moduleToScale) return null; - if(moduleToScale.userParams) { + if (moduleToScale.userParams) { requestParametersData = { userParams: moduleToScale.userParams //,usePreload: true }; - }else{ + } else { requestParametersData = { userParams: [] //,usePreload: false }; } } - $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType '+ workflowType); - $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: requestParametersData '+ requestParametersData); + $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType ' + workflowType); + $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: requestParametersData ' + requestParametersData); - }else if(workflowType=="VNF In Place Software Update"){ + } else if (workflowType == "VNF In Place Software Update") { var payloadObj = { - 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, - 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, - 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value + 'existing_software_version': vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, + 'new_software_version': vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, + 'operations_timeout': vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value }; requestParametersData = { payload: JSON.stringify(payloadObj) }; - }else if(workflowType=="VNF Config Update"){ + } else if (workflowType == "VNF Config Update") { requestParametersData = { payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value }; } var data; - if(workflowType=="VNF Scale Out") { + if (workflowType == "VNF Scale Out") { data = { vnfName: vnf.name, vnfInstanceId: vnf.id, @@ -325,11 +337,11 @@ cloudConfiguration: vnf.cloudConfiguration, requestInfo: requestInfoData, relatedInstanceList: [], - requestParameters:requestParametersData, + requestParameters: requestParametersData, configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value) }; requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1); - }else{ + } else { data = { vnfName: vnf.name, vnfInstanceId: vnf.id, @@ -345,18 +357,18 @@ cloudConfiguration: vnf.cloudConfiguration, requestInfo: requestInfoData, relatedInstanceList: [], - requestParameters:requestParametersData + requestParameters: requestParametersData }; } var serviceInstanceId = ''; _.forEach(vnf['service-instance-node'], function (instanceNode) { - if(instanceNode['node-type'] === 'service-instance'){ + if (instanceNode['node-type'] === 'service-instance') { serviceInstanceId = instanceNode.properties['service-instance-id']; } }); - if (vnf.availableVersions && vnf.availableVersions.length!=0){ + if (vnf.availableVersions && vnf.availableVersions.length != 0) { _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) { var rel = related.relatedInstance; var relatedInstance = { @@ -376,7 +388,7 @@ data.relatedInstanceList.push({relatedInstance: relatedInstance}); }); - if(workflowType=="VNF Scale Out") { + if (workflowType == "VNF Scale Out") { //push vnf to related as well as the service instance var relatedInstance = { instanceId: vnf.id, @@ -393,7 +405,7 @@ data.relatedInstanceList.push({relatedInstance: relatedInstance}); } } - }catch(err){ + } catch (err) { $log.error('SchedulerCtrl::extractChangeManagementCallbackDataStr error: ' + err); vm.errorMsg = err; } @@ -405,23 +417,25 @@ function getWorkflowParametersFromForm() { let workflowParameters = - {requestDetails:{ - cloudConfiguration:{}, - requestParameters:{userParams:[{}]} - }}; + { + requestDetails: { + cloudConfiguration: {}, + requestParameters: {userParams: [{}]} + } + }; workflowParameters.requestDetails.cloudConfiguration = vm.changeManagement.vnfNames[0].cloudConfiguration; let parameters = vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow); - parameters.forEach((parameter)=>{ - let inputField = document.getElementById('so-workflow-parameter-'+parameter.soFieldName); - workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName]=inputField.value; - }); + parameters.forEach((parameter) => { + let inputField = document.getElementById('so-workflow-parameter-' + parameter.soFieldName); + workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName] = inputField.value; + }); return workflowParameters; } vm.openModal = function () { - if(vm.hasScheduler) { //scheduling supported + if (vm.hasScheduler) { //scheduling supported vm.scheduleWorkflow(); } else { //no scheduling support @@ -450,13 +464,13 @@ }; vm.executeWorkflow = function () { - if ( vm.localWorkflows && vm.localWorkflows.length > 0 ) { + if (vm.localWorkflows && vm.localWorkflows.length > 0) { vm.triggerLocalWorkflow(); } else { let source = vm.getRemoteWorkflowSource(vm.changeManagement.workflow); - if( source === "NATIVE"){ + if (source === "NATIVE") { vm.triggerLocalWorkflow(); - }else { + } else { vm.triggerRemoteWorkflow(); } } @@ -503,7 +517,13 @@ }); }; - vm.loadVNFTypes = function () { + vm.serviceTypeChanged = function () { + if (!$scope.isNewFilterChangeManagmentEnabled()) { + vm.searchVNFs(); + } + }; + + vm.searchVNFs = function () { vm.vnfTypes = []; vm.vnfTypesTemp = []; vm.serviceInstances = []; @@ -513,11 +533,18 @@ vm.vnfs = []; vm.vfModules = []; + let vnfRole = $scope.isNewFilterChangeManagmentEnabled() ? vm.changeManagement.vnfType : null; + let cloudRegion = null; + AaiService.getVnfsByCustomerIdAndServiceType( vm.changeManagement.subscriberId, - vm.changeManagement.serviceType["service-type"] - ).then(function (response) { + vm.changeManagement.serviceType["service-type"], + vnfRole, + cloudRegion, + ). + then(function (response) { + vm.isSearchedVNF = true; var vnfsData = response.data.results; if (vnfsData) { for (var i = 0; i < vnfsData.length; i++) { @@ -551,7 +578,7 @@ }); _.forEach(filteredVnfs, function (vnf) { - vm.vnfTypes.push(vnf.properties['nf-role']); + vm.vnfTypes.push(vnf.properties['nf-role']) }); } } @@ -632,7 +659,7 @@ }); } - var getVersionNameForId = function(versionId) { + var getVersionNameForId = function (versionId) { var version = _.find(fromVNFVersions, {"key": versionId}); return version.value; }; @@ -656,9 +683,11 @@ var serviceInstancesIds = _.filter(vnf['related-to'], {'node-type': 'service-instance'}) - .map(function (serviceInstance) { return serviceInstance.id }); + .map(function (serviceInstance) { + return serviceInstance.id + }); - var serviceInstances = _.filter(vm.serviceInstances, function(serviceInstance) { + var serviceInstances = _.filter(vm.serviceInstances, function (serviceInstance) { return _.includes(serviceInstancesIds, serviceInstance.id); }); @@ -719,7 +748,7 @@ }).then(function () { vm.loadRemoteWorkFlowsParameters(); }); - }else{ + } else { return vm.loadLocalWorkFlows() .then(vm.loadLocalWorkFlowsParameters) .then(function () { @@ -750,7 +779,7 @@ }; vm.loadLocalWorkFlowsParameters = function () { - vm.localWorkflows.forEach(function(workflow) { + vm.localWorkflows.forEach(function (workflow) { vm.loadLocalWorkFlowParameters(workflow); }); }; @@ -767,8 +796,8 @@ }; vm.loadRemoteWorkFlowsParameters = function () { - vm.remoteWorkflows.forEach(function(workflow) { - if (workflow.source ==='SDC' || workflow.source === 'sdc' ){ + vm.remoteWorkflows.forEach(function (workflow) { + if (workflow.source === 'SDC' || workflow.source === 'sdc') { vm.loadRemoteWorkFlowParameters(workflow); } else { vm.loadLocalWorkFlowParameters(workflow.name); @@ -779,8 +808,8 @@ vm.loadRemoteWorkFlowParameters = function (workflow) { let parameters = []; workflow.workflowInputParameters - .filter( function (param) { - return param.soPayloadLocation === "userParams"; + .filter(function (param) { + return param.soPayloadLocation === "userParams" }) .forEach(function (param) { let workflowParams = vm.repackAttributes(param); @@ -801,7 +830,7 @@ vm.remoteWorkflowsParameters.set(workflow.name, parameters); }; - vm.repackAttributes = function (workflowParam){ + vm.repackAttributes = function (workflowParam) { return { name: workflowParam.label, required: workflowParam.required, @@ -809,38 +838,38 @@ soFieldName: workflowParam.soFieldName, maxLength: '500', pattern: '.*' - }; + } }; vm.getRemoteWorkFlowParameters = function (workflow) { if (workflow && vm.remoteWorkflowsParameters.has(workflow)) { - return vm.remoteWorkflowsParameters.get(workflow); + return vm.remoteWorkflowsParameters.get(workflow) } return []; }; - vm.hasPatternError = function(form, itemName){ + vm.hasPatternError = function (form, itemName) { return form[itemName].$error.pattern; }; - vm.hasAsyncFnError = function(form, itemName){ + vm.hasAsyncFnError = function (form, itemName) { return form[itemName].$error.validateAsyncFn; }; - vm.getIdFor = function(type, id, name){ + vm.getIdFor = function (type, id, name) { return "internal-workflow-parameter-" + type + "-" + id + "-" + (name ? name.split(' ').join('-').toLowerCase() : ""); }; vm.getInternalWorkFlowParameters = function (workflow, type) { - if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) != []) { - return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type); + if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type == type) != []) { + return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type == type); } return []; }; vm.getInternalWorkFlowParameter = function (workflow, type, parameterName) { - if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) != []) { - return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type).filter(parameter => parameter.name === parameterName)[0] + if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type == type) != []) { + return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type == type).filter(parameter => parameter.name === parameterName)[0] } }; @@ -849,7 +878,7 @@ }; vm.getCachedWorkflowDetails = function (workflow) { - return vm.remoteWorkflows.filter( function (remoteWorkflow) { + return vm.remoteWorkflows.filter(function (remoteWorkflow) { return remoteWorkflow.name === workflow; }); @@ -895,7 +924,7 @@ var file = files[0]; var reader = new FileReader(); - reader.onloadend = function(evt) { + reader.onloadend = function (evt) { if (evt.target.readyState === FileReader.DONE) { $scope.$apply(function () { $scope.moduleArr[0].userParams = JSON.parse(evt.target.result); 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 857509320..19b5f2b92 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 @@ -22,6 +22,7 @@ border: 1px solid #D2D2D2; display: flex; } + .scale-out-modules .table-row > div { padding: 0 12px; color: #5A5A5A; @@ -29,82 +30,116 @@ border-right: 1px solid #D2D2D2; line-height: 30px; } + .scale-out-modules .table-row > div:last-child { border-right: none; } + .scale-out-modules .table-row > div:nth-child(1) { flex: 40px 0 0; font-size: 22px; } + .scale-out-modules .table-row > div:nth-child(2) { flex: 200px 1 0; } + .scale-out-modules .table-row > div:nth-child(3) { flex: 200px 1 0; } + .scale-out-modules .table-row > div:nth-child(4), .scale-out-modules .table-row > div:nth-child(5) { flex: 110px 0 0; } + .scale-out-modules .table-row > div:nth-child(6), .scale-out-modules .table-row > div:nth-child(7) { flex: 130px 0 0; } + .scale-out-modules .table-row.open > div { line-height: 29px; border-top: 1px #009FDB solid; border-bottom: 1px #009FDB solid; } + .scale-out-modules .table-row.open > div:last-child { box-shadow: 0px 0px 0px 0px red, 1px 0px 0px 0px #009FDB; } + .scale-out-modules .table-row.open > div:nth-child(1) { border-color: green; } + .scale-out-modules .table-row.open > div:nth-child(2) { color: #009FDB; } + .scale-out-modules .table-header { border-bottom: none; } + .scale-out-modules .table-header > div { background-color: #F2F2F2; color: black; font-size: 12px; } + .scale-out-modules .modules-table:not(.open) + .table-row { border-top: none; } + .scale-out-modules .modules-table { display: none; margin-top: 10px; margin-bottom: 15px; } + .scale-out-modules .modules-table .table-row { margin-left: 60px; } -.scale-out-modules .modules-table .table-row > div:nth-child(1) { + +.scale-out-modules .modules-table .table-row > div:nth-child(1) { flex: 300px 1 0; font-size: 13px; } -.scale-out-modules .modules-table .table-row > div:nth-child(2) { + +.scale-out-modules .modules-table .table-row > div:nth-child(2) { flex: 90px 0 0; } -.scale-out-modules .modules-table .table-row > div:nth-child(3) { + +.scale-out-modules .modules-table .table-row > div:nth-child(3) { flex: 90px 0 0; } -.scale-out-modules .modules-table .table-row > div:nth-child(3) input { + +.scale-out-modules .modules-table .table-row > div:nth-child(3) input { width: 60px; margin-top: 10px; } -.scale-out-modules .modules-table .table-row > div:nth-child(4) { + +.scale-out-modules .modules-table .table-row > div:nth-child(4) { flex: 180px 0 0; } -.scale-out-modules .modules-table .table-row > div:nth-child(5) { + +.scale-out-modules .modules-table .table-row > div:nth-child(5) { flex: 280px 0 0; } + .scale-out-modules .modules-table.open { display: block; } +.search-vnf { + position: absolute; + bottom: 0; +} + +.form-group { + position: relative; +} + +.nf-role-input { + width: 50% +} /*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 de0ec4026..f06d88321 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 @@ -18,56 +18,114 @@ ============LICENSE_END========================================================= --> -<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css"/> <div class="modal-header"> <h3 class="modal-title" id="modal-title">New VNF Change</h3> <span ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> <div ng-if="vm.errorMsg!==''"><font color='red'>{{vm.errorMsg.message}}</font></div> </div> -<form class="form-create" data-tests-id="newChangeManagementForm" name="newChangeManagement" ng-submit="vm.openModal();vm.close();" novalidate> - <div class="modal-body step1" ng-show="vm.wizardStep === 1" > +<form class="form-create" data-tests-id="newChangeManagementForm" name="newChangeManagement" + ng-submit="vm.openModal();vm.close();" novalidate> + <div class="modal-body step1" ng-show="vm.wizardStep === 1"> + <div class="form-group"> <label class="control-label">Subscriber</label> - <select class="form-control" ng-model="vm.changeManagement.subscriberId" ng-change="vm.loadServiceTypes()" name="subscriber" id="subscriber" data-tests-id="subscriberName" required> + <select class="form-control" ng-model="vm.changeManagement.subscriberId" ng-change="vm.loadServiceTypes()" + name="subscriber" id="subscriber" data-tests-id="subscriberName" required> <option value="" disabled>Select subscriber</option> - <option data-tests-id="subscriberNameOption" class="subscriberNameOption" ng-repeat="item in vm.subscribers" ng-value="item['global-customer-id']" ng-disabled="!(item['is-permitted'])">{{item['subscriber-name']}}</option> + <option data-tests-id="subscriberNameOption" class="subscriberNameOption" + ng-repeat="item in vm.subscribers" ng-value="item['global-customer-id']" + ng-disabled="!(item['is-permitted'])">{{item['subscriber-name']}} + </option> </select> </div> + <div class="form-group"> <label class="control-label">Service type</label> - <select class="form-control" ng-model="vm.changeManagement.serviceType" ng-change="vm.loadVNFTypes()" name="serviceType" id="serviceType" ng-options="item['service-type'] disable when !(item['is-permitted']) for item in vm.serviceTypes" required data-ng-disabled="newChangeManagement.subscriber.$pristine" data-tests-id="serviceType"> + <select class="form-control" ng-model="vm.changeManagement.serviceType" + ng-change="vm.serviceTypeChanged()" + name="serviceType" id="serviceType" + ng-options="item['service-type'] disable when !(item['is-permitted']) for item in vm.serviceTypes" + required data-ng-disabled="newChangeManagement.subscriber.$pristine" + data-tests-id="serviceType"> <option value="" disabled>Select service type</option> </select> </div> - <div class="form-group"> - <label class="control-label">NF Role</label> - <select class="form-control" ng-model="vm.changeManagement.vnfType" ng-change="vm.loadVNFVersions()" name="vnfType" id="vnfType" ng-options="item for item in vm.vnfTypes" required data-ng-disabled="newChangeManagement.serviceType.$pristine"> - <option value="" disabled>NF Role</option> - </select> + + + <div ng-if="!isNewFilterChangeManagmentEnabled()"> + + <div class="form-group"> + <label class="control-label">NF Role</label> + <select class="form-control" ng-model="vm.changeManagement.vnfType" ng-change="vm.loadVNFVersions()" + name="vnfType" id="vnfType" ng-options="item for item in vm.vnfTypes" required + data-ng-disabled="newChangeManagement.serviceType.$pristine"> + <option value="" disabled>NF Role</option> + </select> + </div> + + </div> + + + <div ng-if="isNewFilterChangeManagmentEnabled()"> + + <div class="form-group form-row"> + <div class="col nf-role-input"> + <label class="control-label">NF Role</label> + <input class="form-control" ng-model="vm.changeManagement.vnfType" + name="vnfType" id="vnfTypeInput" + data-ng-disabled="newChangeManagement.serviceType.$pristine"> + </div> + + <div class="col"> + <button class="search-vnf" type="button" id="searchVNF" name="searchVNFs" class="btn btn-primary" + ng-click="vm.searchVNFs()" + ng-disabled="newChangeManagement.subscriber.$pristine || newChangeManagement.serviceType.$pristine"> + Search VNFs + </button> + </div> + </div> + </div> + + <div class="form-group"> <label class="control-label">Source VNF Model Version</label> - <select class="form-control" ng-model="vm.changeManagement.fromVNFVersion" ng-change="vm.loadVNFNames()" name="fromVNFVersion" id="fromVNFVersion" ng-options="item.key as item.value for item in vm.fromVNFVersions" required data-ng-disabled="newChangeManagement.vnfType.$pristine"> + <select class="form-control" ng-model="vm.changeManagement.fromVNFVersion" ng-change="vm.loadVNFNames()" + name="fromVNFVersion" id="fromVNFVersion" + ng-options="item.key as item.value for item in vm.fromVNFVersions" required + data-ng-disabled="vm.isDisabledVNFmodelVersion(newChangeManagement.vnfType.$pristine); "> <option value="" disabled>Select VNF Model Version</option> </select> </div> + + <div class="form-group"> <label class="control-label">Available VNF</label> - <multiselect ng-model="vm.changeManagement.vnfNames" ng-change="vm.loadWorkFlows()" name="vnfName" id="vnfName" options="vm.vnfNames" display-prop="name" id-prop="id" required data-ng-disabled="newChangeManagement.fromVNFVersion.$pristine"></multiselect> + <multiselect ng-model="vm.changeManagement.vnfNames" ng-change="vm.loadWorkFlows()" name="vnfName" + id="vnfName" options="vm.vnfNames" display-prop="name" id-prop="id" required + data-ng-disabled="newChangeManagement.fromVNFVersion.$pristine"></multiselect> </div> - <div ng-show="vm.changeManagement.vnfNames && vm.changeManagement.vnfNames.length > 0" class="form-group vnf-versions-container"> + <div ng-show="vm.changeManagement.vnfNames && vm.changeManagement.vnfNames.length > 0" + class="form-group vnf-versions-container"> <table class="table table-bordered"> <tbody> <tr ng-repeat="vnfName in vm.changeManagement.vnfNames"> <td class="col-md-2"><span class="vnf-versions-name">{{vnfName.name}}</span></td> <td class="col-md-2"> - <select ng-model="vnfName.version" ng-change="vm.selectVersionForVNFName(vnfName)" class="vnf-versions-select-as-text" id="{{vnfName['invariant-id']}}-target-version-select"> + <select ng-model="vnfName.version" ng-change="vm.selectVersionForVNFName(vnfName)" + class="vnf-versions-select-as-text" + id="{{vnfName['invariant-id']}}-target-version-select"> <option value="" disabled="" selected="selected">Select Target VNF Model Version</option> - <option ng-repeat="version in vnfName.availableVersions">{{version.modelInfo.modelVersion}}</option> + <option ng-repeat="version in vnfName.availableVersions"> + {{version.modelInfo.modelVersion}} + </option> </select> </td> <td class="col-md-1 vnf-versions-file"> - <input ng-model="vnfName.filePath" onchange="angular.element(this).scope().selectFileForVNFName(this)" type="file" id="{{vnfName['invariant-id']}}" class="vnf-files-select" /> + <input ng-model="vnfName.filePath" + onchange="angular.element(this).scope().selectFileForVNFName(this)" type="file" + id="{{vnfName['invariant-id']}}" class="vnf-files-select"/> <span class="vnf-versions-file">Select File<span class="caret"></span></span></td> </tr> </tbody> @@ -75,30 +133,44 @@ </div> <div class="form-group"> <label class="control-label">Workflow</label> - <select class="form-control" ng-model="vm.changeManagement.workflow" name="workflow" id="workflow" ng-options="item for item in vm.workflows" required data-ng-disabled="newChangeManagement.vnfName.$pristine"> + <select class="form-control" ng-model="vm.changeManagement.workflow" name="workflow" id="workflow" + ng-options="item for item in vm.workflows" required + data-ng-disabled="newChangeManagement.vnfName.$pristine"> <option value="" disabled>Select workflow</option> </select> </div> - <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'FILE')"> + <div class="form-group" ng-if="vm.changeManagement.workflow" + ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'FILE')"> <label class="control-label">{{item.name}}</label> <div class="file-wrapper"> - <input id="{{vm.getIdFor('file',item.id,item.name)}}" ng-change="vm.onChange(item)" class="file-input" type="file" ngf-select ng-model="item.value" ngf-validate-async-fn="vm.uploadConfigFile($file)" ng-attr-name="{{'internal-workflow-parameter-file-name-' + item.id}}" accept="{{item.acceptableFileType}}" ngf-pattern="{{item.acceptableFileType}}" ng-required="{{item.required}}"/> - <label id="{{vm.getIdFor('file',item.id,item.name)}}-label" class="file-input-label">{{item.value&&item.value.name||"Select File"}} </label> + <input id="{{vm.getIdFor('file',item.id,item.name)}}" ng-change="vm.onChange(item)" class="file-input" + type="file" ngf-select ng-model="item.value" ngf-validate-async-fn="vm.uploadConfigFile($file)" + ng-attr-name="{{'internal-workflow-parameter-file-name-' + item.id}}" + accept="{{item.acceptableFileType}}" ngf-pattern="{{item.acceptableFileType}}" + ng-required="{{item.required}}"/> + <label id="{{vm.getIdFor('file',item.id,item.name)}}-label" class="file-input-label"> + {{item.value&&item.value.name||"Select File"}} </label> <label ng-attr-for="{{vm.getIdFor('file',item.id,item.name)}}"><span class="icon-browse"></span></label> </div> - <label id="errorLabel" class="icon-alert error" ng-if="vm.hasPatternError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnPatternError}}</label> - <label id="errorContentLabel" class="icon-alert error" ng-if="vm.hasAsyncFnError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnContentError}}</label> + <label id="errorLabel" class="icon-alert error" + ng-if="vm.hasPatternError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnPatternError}}</label> + <label id="errorContentLabel" class="icon-alert error" + ng-if="vm.hasAsyncFnError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnContentError}}</label> </div> - <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'text')"> + <div class="form-group" ng-if="vm.changeManagement.workflow" + ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'text')"> <label ng-attr-for="{{vm.getIdFor('text',item.id,item.name)}}" class="control-label">{{item.name}}</label> - <input ng-model="item.value" type="text" id="{{vm.getIdFor('text',item.id,item.name)}}" pattern="{{item.pattern}}" ng-required="{{item.required}}"> + <input ng-model="item.value" type="text" id="{{vm.getIdFor('text',item.id,item.name)}}" + pattern="{{item.pattern}}" ng-required="{{item.required}}"> </div> - <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow)"> + <div class="form-group" ng-if="vm.changeManagement.workflow" + ng-repeat="item in vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow)"> <label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label> - <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}"> + <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" + maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}"> </div> </div> @@ -114,7 +186,8 @@ <div>Invariant UUID</div> </div> - <div class="table-row" ng-repeat-start="vnf in vm.changeManagement.vnfNames" ng-click="vnf.isOpen=!!!vnf.isOpen"> + <div class="table-row" ng-repeat-start="vnf in vm.changeManagement.vnfNames" + ng-click="vnf.isOpen=!!!vnf.isOpen"> <div>{{vnf.isOpen ? '-' : '+'}}</div> <div>{{vnf['service-instance-node'][0].properties['service-instance-name']}}</div> <div>{{vnf.name}}</div> @@ -137,12 +210,13 @@ <div>{{moduleArr.length}}</div> <div ng-if="!moduleArr[0].scalable">N/A</div> <div ng-if="moduleArr[0].scalable"> - <input type="checkbox" ng-model="moduleArr[0].scale" /> + <input type="checkbox" ng-model="moduleArr[0].scale"/> </div> <div>{{moduleArr[0].uuid}}</div> <div ng-if="!moduleArr[0].scalable">N/A</div> <div ng-if="moduleArr[0].scalable"> - <input type="file" accept="application/json" onchange="angular.element(this).scope().setPreload(this)" /> + <input type="file" accept="application/json" + onchange="angular.element(this).scope().setPreload(this)"/> </div> </div> </div> @@ -150,13 +224,23 @@ <div class="modal-footer"> <div class="pull-left"> - <button ng-if="vm.wizardStep === 2" ng-click="vm.prevStep();" type="button" id="back" name="back" class="btn btn-primary">Back</button> + <button ng-if="vm.wizardStep === 2" ng-click="vm.prevStep();" type="button" id="back" name="back" + class="btn btn-primary">Back + </button> </div> <div class="pull-right"> <button type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</button> - <button ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2) || vm.hasScheduler" type="submit" id="submit" name="submit" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">{{vm.hasScheduler ? "Schedule" : "Confirm"}}</button> - <button ng-if="(vm.isScaleOut() && vm.wizardStep === 1) && !vm.hasScheduler" ng-click="vm.nextStep();" type="button" id="next" name="next" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">Next</button> - <button ng-if="isShowErrorReport() && vm.errorMsg!==''" ng-click="showReportWindow()" type="button" class="btn btn-danger" >Create report</button> + <button ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2) || vm.hasScheduler" + type="submit" id="submit" name="submit" class="btn btn-primary" + data-ng-disabled="newChangeManagement.$invalid">{{vm.hasScheduler ? "Schedule" : "Confirm"}} + </button> + <button ng-if="(vm.isScaleOut() && vm.wizardStep === 1) && !vm.hasScheduler" ng-click="vm.nextStep();" + type="button" id="next" name="next" class="btn btn-primary" + data-ng-disabled="newChangeManagement.$invalid">Next + </button> + <button ng-if="isShowErrorReport() && vm.errorMsg!==''" ng-click="showReportWindow()" type="button" + class="btn btn-danger">Create report + </button> </div> </div> </form>
\ No newline at end of file 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 0d0fa6d0a..994a3e4ac 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 @@ -32,19 +32,20 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE function getPnfByName(pnfName) { var deferred = $q.defer(); - var url = COMPONENT.AAI_GET_PNF_BY_NAME+ encodeURIComponent(pnfName) ; - var config = { timeout: PropertyService.getServerResponseTimeoutMsec() }; + var url = COMPONENT.AAI_GET_PNF_BY_NAME + encodeURIComponent(pnfName); + var config = {timeout: PropertyService.getServerResponseTimeoutMsec()}; $http.get(url, config) .success(function (response) { deferred.resolve({data: response}); }) - .error(function(data, status, headers, config) { + .error(function (data, status, headers, config) { deferred.reject({message: data, status: status}); }); return deferred.promise; } + function getGlobalCustomerIdFromServiceInstanceResponse(response) { var globalCustomerId = ""; if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) { @@ -63,16 +64,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE } function searchServiceInstances(query) { - return $http.get( COMPONENT.SEARCH_SERVICE_INSTANCES + query, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() + return $http.get(COMPONENT.SEARCH_SERVICE_INSTANCES + query, {}, { + timeout: PropertyService.getServerResponseTimeoutMsec() }).then(function (response) { var displayData = response.data[FIELD.ID.SERVICE_INSTANCES]; if (!displayData || !displayData.length) { displayData = [{ - globalCustomerId : null, - subscriberName : null, - serviceType : FIELD.PROMPT.NO_SERVICE_SUB, - serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE + globalCustomerId: null, + subscriberName: null, + serviceType: FIELD.PROMPT.NO_SERVICE_SUB, + serviceInstanceId: FIELD.PROMPT.NO_SERVICE_INSTANCE }]; } return {displayData: displayData}; @@ -80,11 +81,13 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }; function getJoinedQueryString(queries) { - return queries.filter(function (val) {return val;}).join("&"); + return queries.filter(function (val) { + return val; + }).join("&"); } return { - getSubscriberName : function(globalCustomerId, + getSubscriberName: function (globalCustomerId, successCallbackFunction) { $log .debug("AaiService:getSubscriberName: globalCustomerId: " @@ -93,9 +96,9 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE COMPONENT.AAI_SUB_DETAILS_PATH + globalCustomerId + COMPONENT.ASSIGN + Math.random(), { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { var result = {}; if (response.data) { result.subscriberName = response.data[FIELD.ID.SUBNAME]; @@ -106,7 +109,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE (UtilityService.runHttpErrorHandler); }, - runNamedQuery : function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { + runNamedQuery: function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { var url = COMPONENT.AAI_SUB_VIEWEDIT_PATH + COMPONENT.FORWARD_SLASH + encodeURIComponent(namedQueryId) + @@ -116,72 +119,72 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return $http.get(url, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { if (response.data != null) { successCallback(response); } else { errorCallback(response); } - }, function(response) { + }, function (response) { errorCallback(response); }); }, - getVNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { + getVNFInformationByServiceTypeAndId: function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { var url = COMPONENT.AAI_GET_VNF_INFO + COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId); $http.get(url, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { if (response.data != null) { successCallback(response); } else { errorCallback(response); } - }, function(response) { + }, function (response) { errorCallback(response); }); }, - getPNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { + getPNFInformationByServiceTypeAndId: function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { var url = COMPONENT.AAI_GET_PNF_INSTANCE + COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId); $http.get(url, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { if (response.data != null) { successCallback(response); } else { errorCallback(response); } - }, function(response) { + }, function (response) { errorCallback(response); }); }, - getCRInformationByInstanceId : function (serviceInstanceId) { + getCRInformationByInstanceId: function (serviceInstanceId) { var deferred = $q.defer(); var url = COMPONENT.AAI_GET_CR_INSTANCE + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId); $http.get(url, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { if (response.data != null) { deferred.resolve(response); } else { deferred.resolve(response); } - }, function(response) { + }, function (response) { deferred.resolve(response); }); return deferred.promise; @@ -211,19 +214,19 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return deferred.promise; }, - getSubDetails : function(selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) { + getSubDetails: function (selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) { var subscriber; var displayData; - $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {}, { + $http.get(COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { displayData = []; subscriber = response.data; var subscriberName = subscriber[FIELD.ID.SUBNAME]; if (subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS] != null) { - angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function(serviceSubscription, key) { + angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function (serviceSubscription, key) { var serviceInstanceId = []; var serviceType = ""; if (serviceSubscription[FIELD.ID.SERVICETYPE] != null) { @@ -232,15 +235,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE serviceType = FIELD.PROMPT.NO_SERVICE_SUB; } if (serviceSubscription[FIELD.ID.SERVICE_INSTANCES] != null) { - angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function(instValue, instKey) { + angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function (instValue, instKey) { // put them together, i guess - var inst = { "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID], + var inst = { + "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID], "aaiModelInvariantId": instValue[FIELD.ID.MODEL_INVAR_ID], "aaiModelVersionId": instValue[FIELD.ID.MODEL_VERSION_ID], "serviceInstanceName": instValue[FIELD.ID.SERVICE_INSTANCE_NAME] }; if (selectedServiceInstance != null) { - if ((instValue[FIELD.ID.SERVICE_INSTANCE_ID] == selectedServiceInstance ) || (instValue[FIELD.ID.SERVICE_INSTANCE_NAME] == selectedServiceInstance)) { + if ((instValue[FIELD.ID.SERVICE_INSTANCE_ID] == selectedServiceInstance) || (instValue[FIELD.ID.SERVICE_INSTANCE_NAME] == selectedServiceInstance)) { serviceInstanceId.push(inst); } } else { @@ -248,101 +252,108 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE } }); } else { - serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ]; + serviceInstanceId = [FIELD.PROMPT.NO_SERVICE_INSTANCE]; } - angular.forEach(serviceInstanceId, function(subVal, subKey) { + angular.forEach(serviceInstanceId, function (subVal, subKey) { displayData.push({ - globalCustomerId : selectedSubscriber, - subscriberName : subscriberName, - serviceType : serviceType, - serviceInstanceId : subVal.serviceInstanceId, - aaiModelInvariantId : subVal.aaiModelInvariantId, - aaiModelVersionId - : subVal.aaiModelVersionId, - serviceInstanceName : subVal.serviceInstanceName, + globalCustomerId: selectedSubscriber, + subscriberName: subscriberName, + serviceType: serviceType, + serviceInstanceId: subVal.serviceInstanceId, + aaiModelInvariantId: subVal.aaiModelInvariantId, + aaiModelVersionId: subVal.aaiModelVersionId, + serviceInstanceName: subVal.serviceInstanceName, isPermitted: serviceSubscription[FIELD.ID.IS_PERMITTED] }); }); }); } else { displayData.push({ - globalCustomerId : selectedSubscriber, - subscriberName : subscriberName, - serviceType : FIELD.PROMPT.NO_SERVICE_SUB, - serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE + globalCustomerId: selectedSubscriber, + subscriberName: subscriberName, + serviceType: FIELD.PROMPT.NO_SERVICE_SUB, + serviceInstanceId: FIELD.PROMPT.NO_SERVICE_INSTANCE }); } successCallback(displayData, subscriberName); - }, function(response) { - errorCallback(response);}); + }, function (response) { + errorCallback(response); + }); }, - getSubList : function(successCallback, errorCallback ) { + getSubList: function (successCallback, errorCallback) { - $http.get( FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {}, { + $http.get(FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { var customerList = []; if (response.data.customer != null) { - angular.forEach(response.data.customer, function(subVal, subKey) { - var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME], - "isPermitted": subVal[FIELD.ID.IS_PERMITTED], }; + angular.forEach(response.data.customer, function (subVal, subKey) { + var cust = { + "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], + "subscriberName": subVal[FIELD.ID.SUBNAME], + "isPermitted": subVal[FIELD.ID.IS_PERMITTED], + }; customerList.push(cust); }); successCallback(customerList); } else { errorCallback(response); } - },function(response) { + }, function (response) { errorCallback(response); }); }, - getServiceInstance : getServiceInstance, - getPnfByName : getPnfByName, + getServiceInstance: getServiceInstance, + getPnfByName: getPnfByName, - getGlobalCustomerIdByInstanceIdentifier : function(serviceInstanceIdentifier, findBy) { + getGlobalCustomerIdByInstanceIdentifier: function (serviceInstanceIdentifier, findBy) { serviceInstanceIdentifier.trim(); return getServiceInstance(serviceInstanceIdentifier, findBy) .then(function (response) { return getGlobalCustomerIdFromServiceInstanceResponse(response); - }); + }); }, - getMultipleValueParamQueryString: function(values, paramSubPath) { + getMultipleValueParamQueryString: function (values, paramSubPath) { if (values.length) { - return paramSubPath + values.filter(function (val) {return val;}).join("&" + paramSubPath); + return paramSubPath + values.filter(function (val) { + return val; + }).join("&" + paramSubPath); } }, getJoinedQueryString: getJoinedQueryString, - getServices2 : function(successCallback, errorCallback ) { + getServices2: function (successCallback, errorCallback) { - $http.get( FIELD.ID.AAI_GET_SERVICES, {}, { + $http.get(FIELD.ID.AAI_GET_SERVICES, {}, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(function(response) { + timeout: PropertyService.getServerResponseTimeoutMsec() + }).then(function (response) { var customerList = []; if (response.data != null) { var serviceIdList = []; - angular.forEach(response.data, function(value, key) { - angular.forEach(value, function(subVal, key) { - var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] , - "isPermitted" : subVal[FIELD.ID.IS_PERMITTED] - - };serviceIdList.push(newVal); + angular.forEach(response.data, function (value, key) { + angular.forEach(value, function (subVal, key) { + var newVal = { + "id": subVal[FIELD.ID.SERVICE_ID], "description": subVal[FIELD.ID.SERVICE_DESCRIPTION], + "isPermitted": subVal[FIELD.ID.IS_PERMITTED] + + }; + serviceIdList.push(newVal); }); }); successCallback(serviceIdList); } else { errorCallback(response); } - },function(response) { + }, function (response) { errorCallback(response); }); }, @@ -362,19 +373,19 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }, - getPortMirroringSourcePorts : function (ids) { + getPortMirroringSourcePorts: function (ids) { var defer = $q.defer(); - var url = COMPONENT.AAI_GET_PORT_MIRRORING_SOURCE_PORTS +'?configurationIds=' + ids.join(','); - $http.get(url).then(function(res){ + var url = COMPONENT.AAI_GET_PORT_MIRRORING_SOURCE_PORTS + '?configurationIds=' + ids.join(','); + $http.get(url).then(function (res) { defer.resolve(res); - }).catch(function(err) { + }).catch(function (err) { $log.error(err); defer.resolve({}); }); return defer.promise; }, - getVlansByNetworksMapping : function (globalCustomerId, serviceType, serviceInstanceId, sdcModelUuid) { + getVlansByNetworksMapping: function (globalCustomerId, serviceType, serviceInstanceId, sdcModelUuid) { var defer = $q.defer(); if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS)) { var url = COMPONENT.AAI_GET_PROVIDER_NETWORKS_ASSOCIATIONS + '?' @@ -384,9 +395,9 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE + '&sdcModelUuid=' + sdcModelUuid ; - $http.get(url).then(function(res){ + $http.get(url).then(function (res) { defer.resolve(res.data); - }).catch(function(err) { + }).catch(function (err) { $log.error(err); defer.resolve({}); }); @@ -397,29 +408,30 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return defer.promise; }, - getSubscriptionServiceTypeList : function(globalCustomerId, + getSubscriptionServiceTypeList: function (globalCustomerId, successCallbackFunction) { $log .debug("AaiService:getSubscriptionServiceTypeList: globalCustomerId: " + globalCustomerId); - if ( UtilityService.hasContents(globalCustomerId) ) { + if (UtilityService.hasContents(globalCustomerId)) { $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + globalCustomerId + COMPONENT.ASSIGN + Math.random() + COMPONENT.AAI_OMIT_SERVICE_INSTANCES + true, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data && response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS]) { var serviceTypes = []; var serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION]; for (var i = 0; i < serviceSubscriptions.length; i++) { serviceTypes.push({ - "name":serviceSubscriptions[i][FIELD.ID.SERVICETYPE], + "name": serviceSubscriptions[i][FIELD.ID.SERVICETYPE], "isPermitted": serviceSubscriptions[i][FIELD.ID.IS_PERMITTED], "id": i - });} + }); + } successCallbackFunction(serviceTypes); } else { successCallbackFunction([]); @@ -428,20 +440,20 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE (UtilityService.runHttpErrorHandler); } }, - getLcpCloudRegionTenantList : function(globalCustomerId, serviceType, + getLcpCloudRegionTenantList: function (globalCustomerId, serviceType, successCallbackFunction) { let self = this; $log .debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: " + globalCustomerId); - var url = COMPONENT.AAI_GET_TENANTS + var url = COMPONENT.AAI_GET_TENANTS + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { var lcpCloudRegionTenants = []; var aaiLcpCloudRegionTenants = response.data; @@ -456,24 +468,25 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE "cloudRegionOptionId": cloudRegionOptionId, "tenantName": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_NAME], "tenantId": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_ID], - "isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED]}); + "isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED] + }); } successCallbackFunction(lcpCloudRegionTenants); - }).catch(function(error) { + }).catch(function (error) { (UtilityService.runHttpErrorHandler(error.data, error.status)); }) }, - getSubscribers : function(successCallbackFunction) { + getSubscribers: function (successCallbackFunction) { $log .debug("AaiService:getSubscribers"); - var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random(); + var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data) { successCallbackFunction(response.data.customer); } else { @@ -482,16 +495,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"] (UtilityService.runHttpErrorHandler); }, - getProvOptionsFromSystemProp : function(successCallbackFunction) { + getProvOptionsFromSystemProp: function (successCallbackFunction) { $log .debug("AaiService:getProvOptionsFromSystemProp"); - var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH; + var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH; $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data) { successCallbackFunction(response); } else { @@ -500,7 +513,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"] (UtilityService.runHttpErrorHandler); }, - getLoggedInUserID : function(successCallbackFunction, catchCallbackFunction) { + getLoggedInUserID: function (successCallbackFunction, catchCallbackFunction) { $log .debug("AaiService:getLoggedInUserID"); var url = COMPONENT.GET_USER_ID; @@ -510,25 +523,25 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE transformResponse: [function (data) { return data; }], - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data) { successCallbackFunction(response); } else { successCallbackFunction([]); } - })["catch"] (function(response, status) { + })["catch"](function (response, status) { if (catchCallbackFunction) { catchCallbackFunction(); } UtilityService.runHttpErrorHandler(response, status); }) }, - getServices : function(successCallbackFunction) { + getServices: function (successCallbackFunction) { $log .debug("AaiService:getServices"); - var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random(); $http.get(url, { @@ -547,21 +560,22 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE getAicZones: function (successCallbackFunction) { $log .debug("getAicZones:getAicZones"); - var url = COMPONENT.AAI_GET_AIC_ZONES +COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_AIC_ZONES + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data) { successCallbackFunction(response); } else { successCallbackFunction([]); } })["catch"] - (UtilityService.runHttpErrorHandler);}, - getAicZoneForPNF: function (globalCustomerId,serviceType,serviceInstanceId,successCallbackFunction) { + (UtilityService.runHttpErrorHandler); + }, + getAicZoneForPNF: function (globalCustomerId, serviceType, serviceInstanceId, successCallbackFunction) { $log .debug("getAicZones:getAicZones"); var url = COMPONENT.AAI_GET_AIC_ZONE_FOR_PNF @@ -570,23 +584,24 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE .replace('@serviceType', serviceType); $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { successCallbackFunction(response.data); })["catch"] - (UtilityService.runHttpErrorHandler);}, + (UtilityService.runHttpErrorHandler); + }, - getServiceModels : function(globalCustomerId,serviceType,successCallbackFunction) { + getServiceModels: function (globalCustomerId, serviceType, successCallbackFunction) { $log .debug("AaiService:getServices"); - var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH+globalCustomerId+ COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data) { successCallbackFunction(response); } else { @@ -595,16 +610,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"] (UtilityService.runHttpErrorHandler); }, - getServiceModelsByServiceType : function(namedQueryId,globalCustomerId,serviceType,successCallbackFunction) { + getServiceModelsByServiceType: function (namedQueryId, globalCustomerId, serviceType, successCallbackFunction) { $log .debug("AaiService:getServiceModelsByServiceType"); - var url = COMPONENT.AAI_GET_SERVICES_BY_TYPE+COMPONENT.FORWARD_SLASH+namedQueryId+COMPONENT.FORWARD_SLASH+globalCustomerId+COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_SERVICES_BY_TYPE + COMPONENT.FORWARD_SLASH + namedQueryId + COMPONENT.FORWARD_SLASH + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout : PropertyService + timeout: PropertyService .getServerResponseTimeoutMsec() - }).then(function(response) { + }).then(function (response) { if (response.data) { successCallbackFunction(response); } else { @@ -614,16 +629,27 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE (UtilityService.runHttpErrorHandler); }, - getVnfsByCustomerIdAndServiceType: function(globalSubscriberId, serviceType){ + getVnfsByCustomerIdAndServiceType: function (globalSubscriberId, serviceType, vnfRole, cloudRegion) { var 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; + } + } + + if (UtilityService.hasContents(globalSubscriberId) && - UtilityService.hasContents(serviceType) ) { + UtilityService.hasContents(serviceType)) { - $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + globalSubscriberId + COMPONENT.FORWARD_SLASH - + serviceType ) + $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + url) .success(function (response) { - if(response) { + if (response) { deferred.resolve({data: response}); } else { deferred.resolve({data: []}); @@ -636,15 +662,15 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return deferred.promise; }, - getVnfVersionsByInvariantId: function(modelInvariantId){ + getVnfVersionsByInvariantId: function (modelInvariantId) { var deferred = $q.defer(); if (UtilityService.hasContents(modelInvariantId)) { var body = {"versions": modelInvariantId}; - $http.post(( COMPONENT.AAI_GET_VERSION_BY_INVARIANT_ID),body) + $http.post((COMPONENT.AAI_GET_VERSION_BY_INVARIANT_ID), body) .success(function (response) { - if(response) { + if (response) { deferred.resolve({data: response}); } else { deferred.resolve({data: []}); @@ -658,15 +684,14 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }, - - getSubscriberServiceTypes: function(subscriberUuid) { + getSubscriberServiceTypes: function (subscriberUuid) { var deferred = $q.defer(); $log.debug("AaiService:getSubscriberServiceTypes: subscriberUuid: " + subscriberUuid); if (UtilityService.hasContents(subscriberUuid)) { $http.get(COMPONENT.AAI_SUB_DETAILS_PATH + subscriberUuid + COMPONENT.ASSIGN + Math.random()) .success(function (response) { - if(response && [FIELD.ID.SERVICE_SUBSCRIPTIONS]) { + if (response && [FIELD.ID.SERVICE_SUBSCRIPTIONS]) { deferred.resolve({data: response[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION]}); } else { deferred.resolve({data: []}); @@ -678,30 +703,30 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return deferred.promise; }, - getVnfInstancesList: function(globalSubscriberId, serviceType, modelVersionId ,modelInvariantId, cloudRegionId) { + getVnfInstancesList: function (globalSubscriberId, serviceType, modelVersionId, modelInvariantId, cloudRegionId) { var deferred = $q.defer(); $http.get([COMPONENT.AAI_GET_VNF_INSTANCES_LIST, - globalSubscriberId, - serviceType, - modelVersionId, - modelInvariantId, - cloudRegionId] + globalSubscriberId, + serviceType, + modelVersionId, + modelInvariantId, + cloudRegionId] .join(COMPONENT.FORWARD_SLASH)) .success(function (response) { deferred.resolve(response); }).error(function (data, status) { - deferred.reject({message: data, status: status}); + deferred.reject({message: data, status: status}); }); return deferred.promise; }, getPnfInstancesList: function (globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegionId, equipVendor, equipModel) { var deferred = $q.defer(); $http.get([COMPONENT.AAI_GET_PNF_INSTANCES_LIST, - globalCustomerId, serviceType, - modelVersionId, modelInvariantId, - cloudRegionId, - equipVendor, equipModel - ].join(COMPONENT.FORWARD_SLASH)) + globalCustomerId, serviceType, + modelVersionId, modelInvariantId, + cloudRegionId, + equipVendor, equipModel + ].join(COMPONENT.FORWARD_SLASH)) .success(function (response) { deferred.resolve(response); }).error(function (data, status) { @@ -709,19 +734,19 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }); return deferred.promise; }, - getByUri: function(uri) { + getByUri: function (uri) { var deferred = $q.defer(); $http.get(COMPONENT.AAI_GET_BY_URI + uri) .success(function (response) { deferred.resolve({data: []}); }).error(function (data, status, headers, config) { - deferred.reject({message: data, status: status}); - }); + deferred.reject({message: data, status: status}); + }); return deferred.promise; }, - getConfiguration: function(configurationId) { + getConfiguration: function (configurationId) { var deferred = $q.defer(); $http.get(COMPONENT.AAI_GET_CONFIGURATION + configurationId) @@ -765,7 +790,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return ('option-' + cloudOwner + '-' + cloudRegionId).toLowerCase(); }, - getHomingData: function(vnfInstanceId, vfModuleId) { + getHomingData: function (vnfInstanceId, vfModuleId) { let self = this; var url = COMPONENT.AAI_GET_HOMING_DATA.replace('@vnfInstanceId', vnfInstanceId) .replace('@vfModuleId', vfModuleId); @@ -791,7 +816,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }, - removeVendorFromCloudOwner: function(cloudOwner) { + removeVendorFromCloudOwner: function (cloudOwner) { // Handle the case where cloud owner is formatted // like "{vendor}-{cloud-name}" return cloudOwner.trim().replace(/^[^-]*-/, ''); diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java index 7c08e942a..9629e4634 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java @@ -137,6 +137,23 @@ public class AaiClientTest { }; } + @Test + public void testAaiPutCustomQueryByParams() { + String globalCustomerId = "globalCustomerId1-360-as988q"; + String serviceType = "TEST1-360"; + String nfRole = "test360"; + String queryFormat = "query?format=simple"; + final ResponseWithRequestInfo mockedResponseWithRequestInfo = mockedResponseWithRequestInfo(Response.Status.OK, + TestUtils.readFileAsString("/payload_jsons/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json"), + "query?format=simple&Mock=True", + HttpMethod.PUT); + when(aaiClientMock.getVnfsByParamsForChangeManagement(anyString(), anyString(),anyString(), nullable(String.class))).thenCallRealMethod(); + when(aaiClientMock.doAaiPut(eq(queryFormat), anyString(), anyBoolean(), anyBoolean())).thenReturn(mockedResponseWithRequestInfo); + AaiResponse response = aaiClientMock.getVnfsByParamsForChangeManagement(globalCustomerId, serviceType, nfRole, null); + verify(aaiClientMock).doAaiPut(anyString(), anyString(),anyBoolean(),anyBoolean()); + response.toString(); + } + @Test(dataProvider = "logicalLinkData") public void getLogicalLink_Link_Is_Empty(String link, String expectedUrl) { @@ -518,7 +535,7 @@ public class AaiClientTest { } @Test(expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = "A&AI has no homing data associated to vfModule 'vfModuleId' of vnf 'vnfInstanceId'") - public void getVfMoudule_Homing_Arguments_Are_Valid_But_Not_Exists() { + public void getVfModule_Homing_Arguments_Are_Valid_But_Not_Exists() { when(aaiClientMock.getHomingDataByVfModule(any(String.class), any(String.class))).thenCallRealMethod(); Response generalEmptyResponse = mock(Response.class); @@ -536,7 +553,7 @@ public class AaiClientTest { } @Test(dataProvider = "invalidDataId", expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = "Failed to retrieve homing data associated to vfModule from A&AI, VNF InstanceId or VF Module Id is missing.") - public void getVfMoudule_Homing_Arguments_Are_Empty_Or_Null(String data) { + public void getVfModule_Homing_Arguments_Are_Empty_Or_Null(String data) { when(aaiClientMock.getHomingDataByVfModule(any(), any())).thenCallRealMethod(); aaiClientMock.getHomingDataByVfModule(data, data); } diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java index a9fe256c1..2b9521121 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java @@ -3,6 +3,7 @@ * VID * ================================================================================ * Copyright (C) 2018 - 2019 Nokia Intellectual Property. All rights reserved. + * Modifications 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. @@ -22,11 +23,11 @@ package org.onap.vid.aai; import static org.mockito.Mockito.mock; import static org.mockito.MockitoAnnotations.initMocks; +import static org.onap.vid.utils.KotlinUtilsKt.JOSHWORKS_JACKSON_OBJECT_MAPPER; import com.fasterxml.jackson.core.JsonProcessingException; import com.xebialabs.restito.semantics.Action; import io.joshworks.restclient.http.HttpResponse; -import io.joshworks.restclient.http.mapper.ObjectMapper; import java.io.IOException; import org.assertj.core.api.Assertions; import org.glassfish.grizzly.http.util.HttpStatus; @@ -122,7 +123,7 @@ public class AaiOverTLSClientServerTest { @NotNull private AaiOverTLSClient createAaiOverTLSClient() { return new AaiOverTLSClient( - new SyncRestClient(getFasterXmlObjectMapper(), mock(Logging.class)), + new SyncRestClient(JOSHWORKS_JACKSON_OBJECT_MAPPER, mock(Logging.class)), propertySupplier, serverUtil.constructTargetUrl("http", "") ); @@ -130,7 +131,6 @@ public class AaiOverTLSClientServerTest { @Test public void shouldGetSubscribers() throws ParseException, JsonProcessingException { - ObjectMapper objectMapper = getFasterXmlObjectMapper(); AaiOverTLSClient aaiOverTLSClient = createAaiOverTLSClient(); serverUtil.prepareGetCall("/business/customers", new JSONParser().parse(subscribersResponsePayload), Action.status(HttpStatus.OK_200)); @@ -142,29 +142,4 @@ public class AaiOverTLSClientServerTest { Assertions.assertThat(allSubscribers.getStatus()).isEqualTo(200); } - private ObjectMapper getFasterXmlObjectMapper() { - return new ObjectMapper() { - - com.fasterxml.jackson.databind.ObjectMapper om = new com.fasterxml.jackson.databind.ObjectMapper(); - - @Override - public <T> T readValue(String s, Class<T> aClass) { - try { - return om.readValue(s, aClass); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public String writeValue(Object o) { - try { - return om.writeValueAsString(o); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - }; - } - } 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 f9a374948..3e38ba883 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 @@ -88,7 +88,6 @@ public class AaiControllerTest { private RoleProvider roleProvider; @Mock private SystemPropertiesWrapper systemPropertiesWrapper; - @Mock private FeatureManager featureManager; @@ -98,7 +97,7 @@ public class AaiControllerTest { @Before public void setUp() { aaiController = new AaiController(aaiService, aaiRestInterface, roleProvider, systemPropertiesWrapper, - featureManager); + featureManager); mockMvc = MockMvcBuilders.standaloneSetup(aaiController).build(); } @@ -112,12 +111,12 @@ public class AaiControllerTest { given(aaiService.getAicZoneForPnf(globalCustomerId, serviceType, serviceId)).willReturn(aaiResponse); mockMvc.perform( - get("/aai_get_aic_zone_for_pnf/{globalCustomerId}/{serviceType}/{serviceId}", globalCustomerId, serviceType, - serviceId) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(objectMapper.writeValueAsString(expectedResponseBody))); + get("/aai_get_aic_zone_for_pnf/{globalCustomerId}/{serviceType}/{serviceId}", globalCustomerId, serviceType, + serviceId) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(objectMapper.writeValueAsString(expectedResponseBody))); } @Test @@ -128,10 +127,10 @@ public class AaiControllerTest { given(aaiService.getInstanceGroupsByVnfInstanceId(vnfInstanceId)).willReturn(aaiResponse); mockMvc.perform(get("/aai_get_instance_groups_by_vnf_instance_id/{vnfInstanceId}", vnfInstanceId) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(objectMapper.writeValueAsString(expectedResponseBody))); + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(objectMapper.writeValueAsString(expectedResponseBody))); } @Test @@ -144,17 +143,17 @@ public class AaiControllerTest { given(response.getStatus()).willReturn(HttpStatus.OK.value()); given(aaiRestInterface.RestGet(eq("VidAaiController"), anyString(), eq(Unchecked.toURI( - "search/nodes-query?search-node-type=service-instance&filter=service-instance-id:EQUALS:" - + serviceInstanceId)), - eq(false)).getResponse()).willReturn(response); + "search/nodes-query?search-node-type=service-instance&filter=service-instance-id:EQUALS:" + + serviceInstanceId)), + eq(false)).getResponse()).willReturn(response); mockMvc - .perform(get("/aai_get_service_instance/{service-instance-id}/{service-instance-type}", serviceInstanceId, - serviceInstanceType) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(expectedResponseBody)); + .perform(get("/aai_get_service_instance/{service-instance-id}/{service-instance-type}", serviceInstanceId, + serviceInstanceType) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); } @Test @@ -167,17 +166,17 @@ public class AaiControllerTest { given(response.getStatus()).willReturn(HttpStatus.OK.value()); given(aaiRestInterface.RestGet(eq("VidAaiController"), anyString(), eq(Unchecked.toURI( - "search/nodes-query?search-node-type=service-instance&filter=service-instance-name:EQUALS:" - + serviceInstanceId)), - eq(false)).getResponse()).willReturn(response); + "search/nodes-query?search-node-type=service-instance&filter=service-instance-name:EQUALS:" + + serviceInstanceId)), + eq(false)).getResponse()).willReturn(response); mockMvc - .perform(get("/aai_get_service_instance/{service-instance-id}/{service-instance-type}", serviceInstanceId, - serviceInstanceType) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(expectedResponseBody)); + .perform(get("/aai_get_service_instance/{service-instance-id}/{service-instance-type}", serviceInstanceId, + serviceInstanceType) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); } @Test @@ -190,21 +189,21 @@ public class AaiControllerTest { given(response.getStatus()).willReturn(HttpStatus.OK.value()); given(aaiRestInterface.RestGet( - eq("VidAaiController"), - anyString(), - eq(Unchecked.toURI( - "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" - + serviceSubscriptionId + "?depth=0")), - eq(false)).getResponse()).willReturn(response); + eq("VidAaiController"), + anyString(), + eq(Unchecked.toURI( + "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + + serviceSubscriptionId + "?depth=0")), + eq(false)).getResponse()).willReturn(response); mockMvc - .perform( - get("/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}", globalCustomerId, - serviceSubscriptionId) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(expectedResponseBody)); + .perform( + get("/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}", globalCustomerId, + serviceSubscriptionId) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); } @Test @@ -213,21 +212,21 @@ public class AaiControllerTest { String serviceSubscriptionId = "testServiceSubscriptionId"; String expectedResponseBody = "Failed to fetch data from A&AI, check server logs for details."; given(aaiRestInterface.RestGet( - eq("VidAaiController"), - anyString(), - eq(Unchecked.toURI( - "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" - + serviceSubscriptionId + "?depth=0")), - eq(false)).getResponse()).willReturn(null); + eq("VidAaiController"), + anyString(), + eq(Unchecked.toURI( + "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + + serviceSubscriptionId + "?depth=0")), + eq(false)).getResponse()).willReturn(null); mockMvc - .perform( - get("/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}", globalCustomerId, - serviceSubscriptionId) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isInternalServerError()) - .andExpect(content().string(expectedResponseBody)); + .perform( + get("/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}", globalCustomerId, + serviceSubscriptionId) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isInternalServerError()) + .andExpect(content().string(expectedResponseBody)); } @Test @@ -235,18 +234,18 @@ public class AaiControllerTest { PortMirroringConfigDataOk okConfigData = new PortMirroringConfigDataOk("foo"); PortMirroringConfigDataError errorConfigData = new PortMirroringConfigDataError("bar", "{ baz: qux }"); Map<String, PortMirroringConfigData> expectedJson = ImmutableMap.of( - ID_1, okConfigData, - ID_2, errorConfigData); + ID_1, okConfigData, + ID_2, errorConfigData); given(aaiService.getPortMirroringConfigData(ID_1)).willReturn(okConfigData); given(aaiService.getPortMirroringConfigData(ID_2)).willReturn(errorConfigData); mockMvc - .perform(get("/aai_getPortMirroringConfigsData") - .param("configurationIds", ID_1, ID_2) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().json(objectMapper.writeValueAsString(expectedJson))); + .perform(get("/aai_getPortMirroringConfigsData") + .param("configurationIds", ID_1, ID_2) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(objectMapper.writeValueAsString(expectedJson))); } @Test @@ -254,18 +253,18 @@ public class AaiControllerTest { PortDetailsOk portDetailsOk = new PortDetailsOk("foo", "testInterface", true); PortDetailsError portDetailsError = new PortDetailsError("bar", "{ baz: qux }"); Multimap<String, PortDetails> expectedJson = ImmutableMultimap.of( - ID_1, portDetailsOk, - ID_2, portDetailsError); + ID_1, portDetailsOk, + ID_2, portDetailsError); given(aaiService.getPortMirroringSourcePorts(ID_1)).willReturn(Lists.newArrayList(portDetailsOk)); given(aaiService.getPortMirroringSourcePorts(ID_2)).willReturn(Lists.newArrayList(portDetailsError)); mockMvc - .perform(get("/aai_getPortMirroringSourcePorts") - .param("configurationIds", ID_1, ID_2) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().json(objectMapper.writeValueAsString(expectedJson.asMap()))); + .perform(get("/aai_getPortMirroringSourcePorts") + .param("configurationIds", ID_1, ID_2) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().json(objectMapper.writeValueAsString(expectedJson.asMap()))); } @Test @@ -279,15 +278,15 @@ public class AaiControllerTest { String expectedResponseBody = "myResponse"; AaiResponse<String> aaiResponse = new AaiResponse<>(expectedResponseBody, "", HttpStatus.OK.value()); given(aaiService - .getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion)) - .willReturn(aaiResponse); + .getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion)) + .willReturn(aaiResponse); mockMvc - .perform(get(urlTemplate, globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(expectedResponseBody)); + .perform(get(urlTemplate, globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); } @Test @@ -306,7 +305,7 @@ public class AaiControllerTest { public void getAicZones_shouldReturnErrorResponse_whenAaiHttpStatusOtherThanOK() throws Exception { String expectedErrorMessage = "Calling AAI Failed"; given(aaiService.getAaiZones()) - .willReturn(new AaiResponse(null, expectedErrorMessage, HttpStatus.INTERNAL_SERVER_ERROR.value())); + .willReturn(new AaiResponse(null, expectedErrorMessage, HttpStatus.INTERNAL_SERVER_ERROR.value())); mockMvc.perform(get("/aai_get_aic_zones") .contentType(MediaType.APPLICATION_JSON) @@ -363,8 +362,8 @@ public class AaiControllerTest { AaiResponse<String> aaiResponse = new AaiResponse<>(expectedResponseBody, "", HttpStatus.OK.value()); given(aaiService - .getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion, equipVendor, - equipModel)).willReturn(aaiResponse); + .getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion, equipVendor, + equipModel)).willReturn(aaiResponse); mockMvc.perform( get(urlTemplate, globalCustomerId, serviceType, modelVersionId, @@ -383,7 +382,7 @@ public class AaiControllerTest { Response response = mock(Response.class); given(response.readEntity(String.class)).willReturn(expectedResponse); given(aaiService - .getVersionByInvariantId(request.versions)).willReturn(response); + .getVersionByInvariantId(request.versions)).willReturn(response); mockMvc.perform( post("/aai_get_version_by_invariant_id") @@ -396,7 +395,7 @@ public class AaiControllerTest { @Test public void getSubscriberDetails_shouldOmitServiceInstancesFromSubscriberData_whenFeatureEnabled_andOmitFlagIsTrue() - throws Exception { + throws Exception { boolean isFeatureActive = true; boolean omitServiceInstances = true; @@ -405,8 +404,8 @@ public class AaiControllerTest { 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) @@ -419,7 +418,7 @@ public class AaiControllerTest { @Test public void getSubscriberDetails_shouldIncludeServiceInstancesFromSubscriberData_whenFeatureEnabled_andOmitFlagIsFalse() - throws Exception { + throws Exception { boolean isFeatureActive = true; boolean omitServiceInstances = false; @@ -428,7 +427,7 @@ public class AaiControllerTest { @Test public void getSubscriberDetails_shouldIncludeServiceInstancesFromSubscriberData_whenFeatureDisabled_andOmitFlagIsTrue() - throws Exception { + throws Exception { boolean isFeatureActive = false; boolean omitServiceInstances = 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 36af92c0c..ac3da50ab 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 @@ -55,7 +55,7 @@ public class ServicePermissionsTest { when(roleProvider.getUserRolesValidator(any())).thenReturn(roleValidator); when(roleValidator.isServicePermitted(subscriberId, serviceType)).thenReturn(expected); - AaiController2 aaiController2 = new AaiController2(null, roleProvider, null); + AaiController2 aaiController2 = new AaiController2(null, roleProvider, null, null); Permissions permissions = aaiController2.servicePermissions(unimportantRequest(), subscriberId, serviceType); assertThat(permissions, is(new Permissions(expected))); diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java index f89eae25e..457007500 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java @@ -29,8 +29,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID; import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID; +import static org.onap.vid.utils.KotlinUtilsKt.JOSHWORKS_JACKSON_OBJECT_MAPPER; -import com.fasterxml.jackson.databind.ObjectMapper; import com.xebialabs.restito.server.StubServer; import io.joshworks.restclient.http.HttpResponse; import java.io.IOException; @@ -48,7 +48,6 @@ import org.junit.Test; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.client.SyncRestClient; import org.onap.vid.controller.MsoController; -import org.onap.vid.controller.WebConfig; import org.onap.vid.mso.MsoProperties; import org.onap.vid.mso.MsoResponseWrapper; import org.onap.vid.mso.MsoResponseWrapperInterface; @@ -474,8 +473,7 @@ public class MsoRestClientNewTest { } private MsoRestClientNew msoRestClient() { - final WebConfig webConfig = new WebConfig(); - return new MsoRestClientNew(new SyncRestClient(webConfig.unirestFasterxmlObjectMapper(new ObjectMapper()), mock(Logging.class)), + return new MsoRestClientNew(new SyncRestClient(JOSHWORKS_JACKSON_OBJECT_MAPPER, mock(Logging.class)), baseUrl(), null, new SystemPropertiesWrapper(), mock(Logging.class)); } diff --git a/vid-app-common/src/test/java/org/onap/vid/utils/LoggingUtilsTest.java b/vid-app-common/src/test/java/org/onap/vid/utils/LoggingUtilsTest.java index ae769a322..c22b59c69 100644 --- a/vid-app-common/src/test/java/org/onap/vid/utils/LoggingUtilsTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/utils/LoggingUtilsTest.java @@ -20,27 +20,56 @@ package org.onap.vid.utils; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.ArgumentMatchers.contains; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.onap.vid.testUtils.RegExMatcher.matchesRegEx; +import static org.testng.AssertJUnit.assertEquals; + +import com.att.eelf.configuration.EELFLogger; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import javax.crypto.BadPaddingException; +import javax.net.ssl.SSLHandshakeException; +import javax.ws.rs.ProcessingException; +import org.mockito.ArgumentCaptor; import org.onap.vid.exceptions.GenericUncheckedException; +import org.springframework.http.HttpMethod; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import sun.security.provider.certpath.SunCertPathBuilderException; import sun.security.validator.ValidatorException; -import javax.crypto.BadPaddingException; -import javax.net.ssl.SSLHandshakeException; -import javax.ws.rs.ProcessingException; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; +public class LoggingUtilsTest { -import static org.hamcrest.MatcherAssert.assertThat; -import static org.onap.vid.testUtils.RegExMatcher.matchesRegEx; + private EELFLogger loggerMock; -public class LoggingUtilsTest { + private Logging logginService = new Logging(); + + @BeforeMethod + public void setUp() { + loggerMock = mock(EELFLogger.class); + } + + @Test + public void whenLogRequest_thenLoggedInDebug() { + //when + String url = "someUrl"; + logginService.logRequest(loggerMock, HttpMethod.GET, url); + + //then + ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class); + verify(loggerMock).debug(contains("Sending"), argumentCaptor.capture()); + assertEquals("GET", argumentCaptor.getAllValues().get(0)); + assertEquals(url, argumentCaptor.getAllValues().get(1)); + } @DataProvider public static Object[][] exceptions() { diff --git a/vid-app-common/src/test/resources/payload_jsons/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json b/vid-app-common/src/test/resources/payload_jsons/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json new file mode 100644 index 000000000..d9a120a49 --- /dev/null +++ b/vid-app-common/src/test/resources/payload_jsons/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json @@ -0,0 +1,295 @@ +{ + "results": [ + { + "service-instance": { + "service-instance-id": "serviceInstanceID1-369-as988q", + "service-instance-name": "EUd8Test", + "service-type": "xBoJHJbWTest", + "service-role": "sc7OWTest", + "environment-context": "O7OVp5Test", + "workload-context": "VmnxNeJIgWq7HTest", + "model-invariant-id": "modelInvariantValue2-369 -as988q", + "model-version-id": "modelVersionKey2-369-as988q", + "widget-model-id": "HT7KA2FoRKH3cTest", + "widget-model-version": "CsGp5Test", + "bandwidth-total": "1Yijkk1Test", + "vhn-portal-url": "40PzTest", + "service-instance-location-id": "zcAaHJTAt5Hj8Test", + "resource-version": "1563820653329", + "selflink": "mZP2EVvwwHnlTest", + "orchestration-status": "6QvhzNgLudLBTest", + "relationship-list": { + "relationship": [ + { + "related-to": "generic-vnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/test-gvnf2-369-as988q", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "test-gvnf2-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "test-name2-gvnf-369" + } + ] + }, + { + "related-to": "generic-vnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/test-gvnf1-369-as988q", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "test-gvnf1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "test-name-gvnf-369" + } + ] + } + ] + } + } + }, + { + "model-ver": { + "model-version-id": "modelVersionKey2-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820653007" + } + }, + { + "model": { + "model-invariant-id": "modelInvariantValue2-369-as988q", + "model-type": "widget3", + "resource-version": "1563820652703", + "model-vers": { + "model-ver": [ + { + "model-version-id": "modelVersionKey2-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820653007" + } + ] + } + } + }, + { + "generic-vnf": { + "vnf-id": "test-gvnf2-369-as988q", + "vnf-name": "test-name2-gvnf-369", + "vnf-type": "SW", + "service-id": "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4", + "equipment-role": "UCPE", + "orchestration-status": "created", + "ipv4-oam-address": "12.80.1.18", + "nm-lan-v6-address": "2001:1890:e00e:fffe::33c4", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1563820654611", + "model-invariant-id": "modelInvariantValue-369-as988q", + "model-version-id": "modelVersionKey-369-as988q", + "nf-role": "test360", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/business/customers/customer/globalCustomerId1-369-as988q/service-subscriptions/service-subscription/TEST1-369/service-instances/service-instance/serviceInstanceID1-369-as988q", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "globalCustomerId1-369-as988q" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "TEST1-369" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "serviceInstanceID1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "EUd8Test" + } + ] + } + ] + } + } + }, + { + "model-ver": { + "model-version-id": "modelVersionKey-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820652380" + } + }, + { + "model": { + "model-invariant-id": "modelInvariantValue-369-as988q", + "model-type": "service", + "resource-version": "1563820652072", + "model-vers": { + "model-ver": [ + { + "model-version-id": "modelVersionKey-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820652380" + } + ] + } + } + }, + { + "generic-vnf": { + "vnf-id": "test-gvnf1-369-as988q", + "vnf-name": "test-name-gvnf-369", + "vnf-type": "SW", + "service-id": "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4", + "equipment-role": "UCPE", + "orchestration-status": "created", + "ipv4-oam-address": "12.80.1.18", + "nm-lan-v6-address": "2001:1890:e00e:fffe::33c4", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1563820654296", + "model-invariant-id": "modelInvariantValue-369-as988q", + "model-version-id": "modelVersionKey-369-as988q", + "nf-role": "test360", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/business/customers/customer/globalCustomerId1-369-as988q/service-subscriptions/service-subscription/TEST1-369/service-instances/service-instance/serviceInstanceID1-369-as988q", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "globalCustomerId1-369-as988q" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "TEST1-369" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "serviceInstanceID1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "EUd8Test" + } + ] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloudOwnerKeyValue1-369-as988q/cloudRegionIdKeyValue1-369-as988q/tenants/tenant/tenantID1-369-as988q/vservers/vserver/vserver1-369-test-as988q", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "cloudOwnerKeyValue1-369-as988q" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "cloudRegionIdKeyValue1-369-as988q" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "tenantID1-369-as988q" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "vserver1-369-test-as988q" + } + ], + "related-to-property": [ + { + "property-key": "vserver.vserver-name", + "property-value": "vserver-name11-369-as988q" + } + ] + } + ] + } + } + }, + { + "tenant": { + "tenant-id": "tenantID1-369-as988q", + "tenant-name": "tenant-name1-369-as988q", + "resource-version": "1563820651384", + "vservers": { + "vserver": [ + { + "vserver-id": "vserver1-369-test-as988q", + "vserver-name": "vserver-name11-369-as988q", + "vserver-name2": "vserver-name22-360-as988q", + "prov-status": "ACTIVE", + "vserver-selflink": "TRINITY vserverLink", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1563820654917", + "relationship-list": { + "relationship": [ + { + "related-to": "generic-vnf", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/test-gvnf1-369-as988q", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "test-gvnf1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "test-name-gvnf-369" + } + ] + } + ] + } + } + ] + } + } + }, + { + "cloud-region": { + "cloud-owner": "cloudOwnerKeyValue1-369-as988q", + "cloud-region-id": "cloudRegionIdKeyValue1-369-as988q", + "resource-version": "1563820651058", + "orchestration-disabled": false, + "in-maint": false, + "tenants": { + "tenant": [ + { + "tenant-id": "tenantID1-369-as988q", + "tenant-name": "tenant-name1-369-as988q", + "resource-version": "1563820651384" + } + ] + } + } + } + ] +}
\ No newline at end of file diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java new file mode 100644 index 000000000..a979bae53 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java @@ -0,0 +1,54 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public abstract class PresetBaseAAICustomQuery extends BaseAAIPreset { + + private final String requestBodyStart; + private final String requestBodyQuery; + private final FORMAT format; + + public enum FORMAT { + RESOURCE, SIMPLE; + + public String value() { + return this.name().toLowerCase(); + } + } + public PresetBaseAAICustomQuery(FORMAT format, String requestBodyStart, String requestBodyQuery) { + this.format = format; + this.requestBodyStart = requestBodyStart; + this.requestBodyQuery = requestBodyQuery; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.PUT; + } + + @Override + public String getReqPath() { + return getRootPath() + "/query"; + } + + @Override + public Map<String, List> getQueryParams() { + return ImmutableMap.of( + "format", Collections.singletonList(format.value()) + ); + } + + @Override + public Object getRequestBody() { + return ImmutableMap.of( + "start", new String[] {requestBodyStart}, + "query", requestBodyQuery + ); + } + +} 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 dbc603c26..2d888bfc8 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,7 +40,8 @@ import static org.hamcrest.core.IsNot.not; public class ChangeManagementTest extends VidBaseTestCase { - public static final String SCHEDULED_ID = "0b87fe60-50b0-4bac-a0a7-49e951b0ba9e"; + public static final String SCHEDULED_ID = "0b87fe60-50b0-4bac-a0a7-49e951b0ba9e"; + @Test public void testLeftPanelChangeManagementButton() { Assert.assertTrue(Wait.byText(Constants.SideMenu.VNF_CHANGES)); @@ -79,8 +80,10 @@ public class ChangeManagementTest extends VidBaseTestCase { SelectOption.waitForOptionInSelect(subscriberName, "subscriberName"); ChangeManagementPage.selectSubscriberById(subscriberId); Wait.angularHttpRequestsLoaded(); + SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalServiceTypeInputId, serviceType); Wait.angularHttpRequestsLoaded(); + SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalVNFTypeInputId, vnfType); Wait.angularHttpRequestsLoaded(); SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalFromVNFVersionInputId, vnfSourceVersion); @@ -161,16 +164,16 @@ public class ChangeManagementTest extends VidBaseTestCase { SimulatorApi.clearAll(); SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND, "changeManagement/ecompportal_getSessionSlotCheckInterval.json" - , "changeManagement/get_aai_sub_details.json" - , "changeManagement/get_sdc_catalog_services_2f80c596.json" - , "changeManagement/get_service-design-and-creation.json" - , "changeManagement/get_vnf_data_by_globalid_and_service_type.json" - , "changeManagement/service-design-and-creation.json" - , "changeManagement/mso_get_manual_task.json" - , "changeManagement/mso_post_manual_task.json" - , "changeManagement/mso_get_change_managements_scaleout.json" + , "changeManagement/get_aai_sub_details.json" + , "changeManagement/get_sdc_catalog_services_2f80c596.json" + , "changeManagement/get_service-design-and-creation.json" + , "changeManagement/get_vnf_data_by_globalid_and_service_type.json" + , "changeManagement/service-design-and-creation.json" + , "changeManagement/mso_get_manual_task.json" + , "changeManagement/mso_post_manual_task.json" + , "changeManagement/mso_get_change_managements_scaleout.json" ); - SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.APPEND); registerDefaultTablesData(); resetGetServicesCache(); @@ -178,9 +181,9 @@ public class ChangeManagementTest extends VidBaseTestCase { private void registerDefaultTablesData() { SimulatorApi.registerExpectation( - new String[] {"changeManagement/get_scheduler_details_short.json", + new String[]{"changeManagement/get_scheduler_details_short.json", "changeManagement/mso_get_change_managements.json" - ,"changeManagement/delete_scheduled_task.json"}, + , "changeManagement/delete_scheduled_task.json"}, ImmutableMap.of( "<SCHEDULE_ID>", SCHEDULED_ID, "<IN_PROGRESS_DATE>", "Fri, 08 Sep 2017 19:34:32 GMT"), SimulatorApi.RegistrationStrategy.APPEND @@ -259,7 +262,7 @@ public class ChangeManagementTest extends VidBaseTestCase { @Test public void clickOnScheduledJob_SuccessfulMessageAppear() { - SimulatorApi.registerExpectationFromPreset(new PresetDeleteSchedulerChangeManagement(),SimulatorApi.RegistrationStrategy.APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetDeleteSchedulerChangeManagement(), SimulatorApi.RegistrationStrategy.APPEND); ChangeManagementPage.openChangeManagementPage(); GeneralUIUtils.ultimateWait(); @@ -279,13 +282,14 @@ public class ChangeManagementTest extends VidBaseTestCase { } - private void clickAndAssertOnCancelButton(String scheduledID){ - Wait.waitByTestId("icon-status-"+ scheduledID, 5); - Click.byTestId("icon-status-"+ scheduledID); + private void clickAndAssertOnCancelButton(String scheduledID) { + Wait.waitByTestId("icon-status-" + scheduledID, 5); + Click.byTestId("icon-status-" + scheduledID); GeneralUIUtils.ultimateWait(); WebElement cancelPendingConfirmationMessage = Get.byTestId("btn-cancel-workflow"); - assertThat(cancelPendingConfirmationMessage.getText(),containsString("Are you sure you want to delete workflow")); + assertThat(cancelPendingConfirmationMessage.getText(), containsString("Are you sure you want to delete workflow")); } + private void clickAndAssertClickOnCancelWorkflowButtonOnPendingPopUp() { try { @@ -293,14 +297,14 @@ public class ChangeManagementTest extends VidBaseTestCase { GeneralUIUtils.ultimateWait(); Assert.assertTrue(Exists.byClassAndText(Constants.generalModalTitleClass, "Success")); } finally { - if (Exists.byClassAndText("modal-title", "Pending")){ + if (Exists.byClassAndText("modal-title", "Pending")) { Click.byClass("pull-right modal-close"); } } - Click.byClassAndVisibleText("btn","OK"); + Click.byClassAndVisibleText("btn", "OK"); } - private void assertCorrectJobDeleted (String vnfName){ + private void assertCorrectJobDeleted(String vnfName) { WebElement canceledScheduledJobRow = GeneralUIUtils.getWebElementByTestID("pending-table-cm-row"); String scheduledVnfName = ((RemoteWebElement) canceledScheduledJobRow).findElementsByTagName("td").get(1).getText(); String scheduledState = ((RemoteWebElement) canceledScheduledJobRow).findElementsByTagName("td").get(5).getText(); @@ -308,14 +312,14 @@ public class ChangeManagementTest extends VidBaseTestCase { Assert.assertEquals("Deleted", scheduledState); } - private void assertAndCheckStatusCellOnDeletedSheduledJob(String scheduledId, String classString){ + private void assertAndCheckStatusCellOnDeletedSheduledJob(String scheduledId, String classString) { boolean isNotDisplayed = GeneralUIUtils.waitForElementInVisibilityByTestId("icon-status-" + scheduledId, 5); Assert.assertTrue(isNotDisplayed); } - public void updateSimulatorWithParametersOfScheduledJod(String jasonFile){ + public void updateSimulatorWithParametersOfScheduledJod(String jasonFile) { SimulatorApi.registerExpectation( - new String[] {"changeManagement/"+jasonFile}, + new String[]{"changeManagement/" + jasonFile}, ImmutableMap.of("<SCHEDULE_ID>", SCHEDULED_ID), SimulatorApi.RegistrationStrategy.APPEND ); } @@ -330,7 +334,7 @@ public class ChangeManagementTest extends VidBaseTestCase { @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false) @Test - public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() { + public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() { List<String> workflows = getListOfWorkflowsFor(VNF_DATA_WITH_IN_PLACE.vnfName); assertThat(workflows, hasItem(VNF_DATA_WITH_IN_PLACE.workflowName)); } @@ -438,19 +442,18 @@ public class ChangeManagementTest extends VidBaseTestCase { @DataProvider public static Object[][] dataForUpdateWorkflowPartialWithInPlace() { - return new Object[][] { - { "1111", "22222", "33333" } + return new Object[][]{ + {"1111", "22222", "33333"} , {"8", "3t3MhTRqkyjB85o5NC9OacAw", "B.bJ6f7KYI6Wz-----DMR0.fyNM9r4"} , {"78058488", "n", "WkH"} }; } - - // Deleted testVidToMsoCallbackDataWithInPlaceSWUpdate test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid. + // Deleted testVidToMsoCallbackDataWithInPlaceSWUpdate test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid. // Deleted testUploadConfigUpdateFile test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid. - + @FeatureTogglingTest(value = Features.FLAG_NEW_FILTER_CHANGE_MANAGMENT, flagActive = false) @Test public void testUploadConfigUpdateNonCsvFile() { String fileName = "non-valid.json"; @@ -470,7 +473,7 @@ public class ChangeManagementTest extends VidBaseTestCase { @DataProvider public static Object[][] invalidCsvFiles() { - return new Object[][] { + return new Object[][]{ {"emptyFile.csv"}, {"withoutPayload.csv"}, {"withoutConfigurationParameters.csv"}, @@ -544,15 +547,15 @@ public class ChangeManagementTest extends VidBaseTestCase { public void testFinishedSectionIncludeUnlockedItem() { ChangeManagementPage.openChangeManagementPage(); Click.byId(Constants.ChangeManagement.dashboardFinishedTabId); - Assert.assertThat(Get.byClassAndText("vnf-name","Unlocked instance"),is(notNullValue())); + Assert.assertThat(Get.byClassAndText("vnf-name", "Unlocked instance"), is(notNullValue())); } @Test - public void testMainDashboardTableContent () { + public void testMainDashboardTableContent() { ChangeManagementPage.openChangeManagementPage(); GeneralUIUtils.ultimateWait(); List<WebElement> webElements = Get.multipleElementsByTestId(Constants.ChangeManagement.activeTableRowId); - assertThat("List of pending workflows is empty",webElements,is(not(empty()))); + assertThat("List of pending workflows is empty", webElements, is(not(empty()))); //TODO: After scheduler will be ready than we will examine if the content is valid. } @@ -567,11 +570,10 @@ public class ChangeManagementTest extends VidBaseTestCase { GeneralUIUtils.ultimateWait(); - List<WebElement> elements = Get.byClass(Constants.ChangeManagement.pendingIconClass); Assert.assertTrue(elements != null && elements.size() > 0); - ((JavascriptExecutor)getDriver()).executeScript("arguments[0].scrollIntoView();", elements.get(0)); + ((JavascriptExecutor) getDriver()).executeScript("arguments[0].scrollIntoView();", elements.get(0)); elements.get(0).click(); @@ -592,7 +594,7 @@ public class ChangeManagementTest extends VidBaseTestCase { public void testOpenFailedStatusModal() { ChangeManagementPage.openChangeManagementPage(); - if(!Exists.byClass(Constants.ChangeManagement.failedIconClass)) { + if (!Exists.byClass(Constants.ChangeManagement.failedIconClass)) { //TODO: Create a job which will shown with status fail. } @@ -612,7 +614,7 @@ public class ChangeManagementTest extends VidBaseTestCase { public void testOpenInProgressStatusModal() { ChangeManagementPage.openChangeManagementPage(); - if(!Exists.byClass(Constants.ChangeManagement.processIconClass)) { + if (!Exists.byClass(Constants.ChangeManagement.processIconClass)) { //TODO: Create a job which will shown with status in-progress. } @@ -632,7 +634,7 @@ public class ChangeManagementTest extends VidBaseTestCase { public void testOpenAlertStatusModal() { ChangeManagementPage.openChangeManagementPage(); - if(!Exists.byClass(Constants.ChangeManagement.alertIconClass)) { + if (!Exists.byClass(Constants.ChangeManagement.alertIconClass)) { //TODO: Create a job which will shown with status alert. } @@ -652,7 +654,7 @@ public class ChangeManagementTest extends VidBaseTestCase { public void testOpenPendingStatusModal() { ChangeManagementPage.openChangeManagementPage(); - if(!Exists.byClass(Constants.ChangeManagement.pendingIconClass)) { + if (!Exists.byClass(Constants.ChangeManagement.pendingIconClass)) { //TODO: Create a job which will shown with status pending. } @@ -696,13 +698,13 @@ public class ChangeManagementTest extends VidBaseTestCase { GeneralUIUtils.ultimateWait(); List<WebElement> pendingRows = Get.multipleElementsByTestId(Constants.ChangeManagement.pendingTableRowId); List<WebElement> activeRows = Get.multipleElementsByTestId(Constants.ChangeManagement.activeTableRowId); - assertThat("The pending table has no content",pendingRows, is(not(empty()))); - assertThat("The active table has no content",activeRows, is(not(empty()))); + assertThat("The pending table has no content", pendingRows, is(not(empty()))); + assertThat("The active table has no content", activeRows, is(not(empty()))); Click.byTestId(Constants.ChangeManagement.refreshBtnTestId); GeneralUIUtils.ultimateWait(); pendingRows = Get.multipleElementsByTestId(Constants.ChangeManagement.pendingTableRowId); - assertThat("The pending table has no content",pendingRows, is(not(empty()))); - assertThat("The active table has no content",activeRows, is(not(empty()))); + assertThat("The pending table has no content", pendingRows, is(not(empty()))); + assertThat("The active table has no content", activeRows, is(not(empty()))); //return the register requests to the default state registerDefaultTablesData(); } diff --git a/vid-automation/src/main/resources/registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json new file mode 100644 index 000000000..d9a120a49 --- /dev/null +++ b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json @@ -0,0 +1,295 @@ +{ + "results": [ + { + "service-instance": { + "service-instance-id": "serviceInstanceID1-369-as988q", + "service-instance-name": "EUd8Test", + "service-type": "xBoJHJbWTest", + "service-role": "sc7OWTest", + "environment-context": "O7OVp5Test", + "workload-context": "VmnxNeJIgWq7HTest", + "model-invariant-id": "modelInvariantValue2-369 -as988q", + "model-version-id": "modelVersionKey2-369-as988q", + "widget-model-id": "HT7KA2FoRKH3cTest", + "widget-model-version": "CsGp5Test", + "bandwidth-total": "1Yijkk1Test", + "vhn-portal-url": "40PzTest", + "service-instance-location-id": "zcAaHJTAt5Hj8Test", + "resource-version": "1563820653329", + "selflink": "mZP2EVvwwHnlTest", + "orchestration-status": "6QvhzNgLudLBTest", + "relationship-list": { + "relationship": [ + { + "related-to": "generic-vnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/test-gvnf2-369-as988q", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "test-gvnf2-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "test-name2-gvnf-369" + } + ] + }, + { + "related-to": "generic-vnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/test-gvnf1-369-as988q", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "test-gvnf1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "test-name-gvnf-369" + } + ] + } + ] + } + } + }, + { + "model-ver": { + "model-version-id": "modelVersionKey2-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820653007" + } + }, + { + "model": { + "model-invariant-id": "modelInvariantValue2-369-as988q", + "model-type": "widget3", + "resource-version": "1563820652703", + "model-vers": { + "model-ver": [ + { + "model-version-id": "modelVersionKey2-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820653007" + } + ] + } + } + }, + { + "generic-vnf": { + "vnf-id": "test-gvnf2-369-as988q", + "vnf-name": "test-name2-gvnf-369", + "vnf-type": "SW", + "service-id": "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4", + "equipment-role": "UCPE", + "orchestration-status": "created", + "ipv4-oam-address": "12.80.1.18", + "nm-lan-v6-address": "2001:1890:e00e:fffe::33c4", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1563820654611", + "model-invariant-id": "modelInvariantValue-369-as988q", + "model-version-id": "modelVersionKey-369-as988q", + "nf-role": "test360", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/business/customers/customer/globalCustomerId1-369-as988q/service-subscriptions/service-subscription/TEST1-369/service-instances/service-instance/serviceInstanceID1-369-as988q", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "globalCustomerId1-369-as988q" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "TEST1-369" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "serviceInstanceID1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "EUd8Test" + } + ] + } + ] + } + } + }, + { + "model-ver": { + "model-version-id": "modelVersionKey-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820652380" + } + }, + { + "model": { + "model-invariant-id": "modelInvariantValue-369-as988q", + "model-type": "service", + "resource-version": "1563820652072", + "model-vers": { + "model-ver": [ + { + "model-version-id": "modelVersionKey-369-as988q", + "model-name": "vnfc8", + "model-version": "1.1", + "resource-version": "1563820652380" + } + ] + } + } + }, + { + "generic-vnf": { + "vnf-id": "test-gvnf1-369-as988q", + "vnf-name": "test-name-gvnf-369", + "vnf-type": "SW", + "service-id": "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4", + "equipment-role": "UCPE", + "orchestration-status": "created", + "ipv4-oam-address": "12.80.1.18", + "nm-lan-v6-address": "2001:1890:e00e:fffe::33c4", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1563820654296", + "model-invariant-id": "modelInvariantValue-369-as988q", + "model-version-id": "modelVersionKey-369-as988q", + "nf-role": "test360", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v17/business/customers/customer/globalCustomerId1-369-as988q/service-subscriptions/service-subscription/TEST1-369/service-instances/service-instance/serviceInstanceID1-369-as988q", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "globalCustomerId1-369-as988q" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "TEST1-369" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "serviceInstanceID1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "EUd8Test" + } + ] + }, + { + "related-to": "vserver", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloudOwnerKeyValue1-369-as988q/cloudRegionIdKeyValue1-369-as988q/tenants/tenant/tenantID1-369-as988q/vservers/vserver/vserver1-369-test-as988q", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "cloudOwnerKeyValue1-369-as988q" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "cloudRegionIdKeyValue1-369-as988q" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "tenantID1-369-as988q" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "vserver1-369-test-as988q" + } + ], + "related-to-property": [ + { + "property-key": "vserver.vserver-name", + "property-value": "vserver-name11-369-as988q" + } + ] + } + ] + } + } + }, + { + "tenant": { + "tenant-id": "tenantID1-369-as988q", + "tenant-name": "tenant-name1-369-as988q", + "resource-version": "1563820651384", + "vservers": { + "vserver": [ + { + "vserver-id": "vserver1-369-test-as988q", + "vserver-name": "vserver-name11-369-as988q", + "vserver-name2": "vserver-name22-360-as988q", + "prov-status": "ACTIVE", + "vserver-selflink": "TRINITY vserverLink", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1563820654917", + "relationship-list": { + "relationship": [ + { + "related-to": "generic-vnf", + "relationship-label": "tosca.relationships.HostedOn", + "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/test-gvnf1-369-as988q", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "test-gvnf1-369-as988q" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "test-name-gvnf-369" + } + ] + } + ] + } + } + ] + } + } + }, + { + "cloud-region": { + "cloud-owner": "cloudOwnerKeyValue1-369-as988q", + "cloud-region-id": "cloudRegionIdKeyValue1-369-as988q", + "resource-version": "1563820651058", + "orchestration-disabled": false, + "in-maint": false, + "tenants": { + "tenant": [ + { + "tenant-id": "tenantID1-369-as988q", + "tenant-name": "tenant-name1-369-as988q", + "resource-version": "1563820651384" + } + ] + } + } + } + ] +}
\ No newline at end of file diff --git a/vid-automation/src/main/resources/registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_response.json b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_response.json new file mode 100644 index 000000000..258cd0e1a --- /dev/null +++ b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_response.json @@ -0,0 +1,614 @@ +{ + "results": [ + { + "id": "3400916992", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/66b13cb4-b575-449f-aa45-ffbfe005c7b1", + "properties": { + "service-instance-id": "66b13cb4-b575-449f-aa45-ffbfe005c7b1", + "service-instance-name": "CHARLOTTE_preload_1710_0914", + "model-invariant-id": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", + "model-version-id": "1525f534-99a2-408f-b847-ff636997d352", + "resource-version": "1505856078810", + "orchestration-status": "Active" + }, + "related-to": [ + { + "id": "10207440", + "node-type": "service-subscription", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson" + }, + { + "id": "3481829392", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/0c465dd3-4151-4da9-92a2-541bb3174cec" + } + ] + }, + { + "id": "3771572432", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/f195837b-ef28-42c3-8dea-47ad37eaed95", + "properties": { + "service-instance-id": "f195837b-ef28-42c3-8dea-47ad37eaed95", + "service-instance-name": "CHARLOTTE_preload_1710_0914_0920", + "model-invariant-id": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", + "model-version-id": "3915de55-a904-4cc6-8fc3-86f8bc316616", + "resource-version": "1505964829466", + "orchestration-status": "Active" + }, + "related-to": [ + { + "id": "10207440", + "node-type": "service-subscription", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson" + }, + { + "id": "3484520464", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1" + } + ] + }, + { + "id": "3775807704", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/9ad4ac55-a5e0-4b49-95c0-b2d846abf700", + "properties": { + "service-instance-id": "9ad4ac55-a5e0-4b49-95c0-b2d846abf700", + "service-instance-name": "CHARLOTTE_preload_1710_0914_100417", + "model-invariant-id": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", + "model-version-id": "3915de55-a904-4cc6-8fc3-86f8bc316616", + "resource-version": "1507144734087", + "orchestration-status": "Active" + }, + "related-to": [ + { + "id": "10207440", + "node-type": "service-subscription", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson" + }, + { + "id": "3783459064", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/54626a59-ec0d-4fa9-b0c2-08d008688165" + } + ] + }, + { + "id": "4178862184", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/599c7247-b083-447c-b6b1-0cdd5170dfd2", + "properties": { + "service-instance-id": "599c7247-b083-447c-b6b1-0cdd5170dfd2", + "service-instance-name": "CHARLOTTE_preload_1710_0914_1010", + "model-invariant-id": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", + "model-version-id": "3915de55-a904-4cc6-8fc3-86f8bc316616", + "resource-version": "1507664240411", + "orchestration-status": "Active" + }, + "related-to": [ + { + "id": "10207440", + "node-type": "service-subscription", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson" + }, + { + "id": "3892133896", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/d74503d8-abab-49c6-ba48-a6211eee9b7a" + } + ] + }, + { + "id": "3008335920", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/97315a05-e6f3-4c47-ae7e-d850c327aa08", + "properties": { + "service-instance-id": "97315a05-e6f3-4c47-ae7e-d850c327aa08", + "service-instance-name": "CHARLOTTE_preload_1710_0914_0927", + "model-invariant-id": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", + "model-version-id": "3915de55-a904-4cc6-8fc3-86f8bc316616", + "resource-version": "1506527653053", + "orchestration-status": "Active" + }, + "related-to": [ + { + "id": "10207440", + "node-type": "service-subscription", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson" + }, + { + "id": "3418898432", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855" + } + ] + }, + { + "id": "3481829392", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/0c465dd3-4151-4da9-92a2-541bb3174cec", + "properties": { + "vnf-id": "0c465dd3-4151-4da9-92a2-541bb3174cec", + "vnf-name": "Eoghan Fausto", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1505856137206", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "afacccf6-397d-45d6-b5ae-94c39734b168", + "model-customization-id": "b54689f8-45c5-4be2-9e91-f033e028feec", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vWheeler", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3285635208", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/0c465dd3-4151-4da9-92a2-541bb3174cec/vf-modules/vf-module/d49713bf-1bff-4eab-bed1-a8f1bb83aa98" + }, + { + "id": "3441209432", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/0c465dd3-4151-4da9-92a2-541bb3174cec/vf-modules/vf-module/b8397fec-cf13-40b3-be8f-7d0912506419" + }, + { + "id": "3687522312", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/0c465dd3-4151-4da9-92a2-541bb3174cec/vf-modules/vf-module/fd098a52-09be-4c48-a9e9-a565d1b39db3" + }, + { + "id": "3400916992", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/66b13cb4-b575-449f-aa45-ffbfe005c7b1" + }, + { + "id": "3477385312", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/8627b971-1032-420f-a044-6802f0ab6976" + } + ] + }, + { + "id": "3484520464", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1", + "properties": { + "vnf-id": "c2d2d389-fa00-4fb4-a269-e46d495719e1", + "vnf-name": "Odell Romana", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1505964996823", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "76e908e0-5201-44d2-a3e2-9e6128d05820", + "model-customization-id": "c00e8fc8-af39-4da8-8c78-a7efc2fe5994", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3447107680", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/c4711b5c-742e-4d03-8146-bff763f69fbd" + }, + { + "id": "3448307712", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/0ba3fcdd-0536-4ac7-a9ec-8d8622db7fb2" + }, + { + "id": "3692179528", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/6bb843eb-ef84-43b1-83b4-3154a7f9928c" + }, + { + "id": "3771588816", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/a4c008c6-cac0-4e3f-928f-90fa37dc8c4b" + }, + { + "id": "3904077944", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/eecb619c-a173-4ead-bf48-d4d09cbbdd5e" + }, + { + "id": "4027855088", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/1e29424e-2dca-45ac-b1df-59a8f74d0bc1" + }, + { + "id": "4390871192", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/b185220a-7f63-4b29-867d-1452813a4f09" + }, + { + "id": "4450529432", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/c2d2d389-fa00-4fb4-a269-e46d495719e1/vf-modules/vf-module/7a0c4b98-b3cc-490c-bbab-e2d7f169f2d7" + }, + { + "id": "3771572432", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/f195837b-ef28-42c3-8dea-47ad37eaed95" + } + ] + }, + { + "id": "3783459064", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/54626a59-ec0d-4fa9-b0c2-08d008688165", + "properties": { + "vnf-id": "54626a59-ec0d-4fa9-b0c2-08d008688165", + "vnf-name": "Dominika Fionnbharr", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1507144948937", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "76e908e0-5201-44d2-a3e2-9e6128d05820", + "model-customization-id": "c00e8fc8-af39-4da8-8c78-a7efc2fe5994", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3775807704", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/9ad4ac55-a5e0-4b49-95c0-b2d846abf700" + } + ] + }, + { + "id": "3892133896", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/d74503d8-abab-49c6-ba48-a6211eee9b7a", + "properties": { + "vnf-id": "d74503d8-abab-49c6-ba48-a6211eee9b7a", + "vnf-name": "CHARLOTTE_PreloadTest_VNF", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1507664288548", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "76e908e0-5201-44d2-a3e2-9e6128d05820", + "model-customization-id": "c00e8fc8-af39-4da8-8c78-a7efc2fe5994", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "4178862184", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/599c7247-b083-447c-b6b1-0cdd5170dfd2" + } + ] + }, + { + "id": "1507690314", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/385548e2-3f31-4900-9437-317d0346e49a", + "properties": { + "vnf-id": "385548e2-3f31-4900-9437-317d0346e49a", + "vnf-name": "Senga Gabrielle", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "7788675952902", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "b217c612-7fcf-484c-861b-df0a5c4b5bcb", + "model-customization-id": "ce15d245-763c-4079-ac82-fe93007adb69", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3664617648", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855/vf-modules/vf-module/788cde64-c288-4971-8e8c-77973c5009dc" + }, + { + "id": "3008335920", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/97315a05-e6f3-4c47-ae7e-d850c327aa08" + }, + { + "id": "3477385312", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/8627b971-1032-420f-a044-6802f0ab6976" + } + ] + }, + { + "id": "5278880615", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/0465e048-92a4-4a7f-bfe7-de39b32de4bd", + "properties": { + "vnf-id": "0465e048-92a4-4a7f-bfe7-de39b32de4bd", + "vnf-name": "Constantius Raghu", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "7788675952902", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "afacccf6-397d-45d6-b5ae-94c39734b168", + "model-customization-id": "ce15d245-763c-4079-ac82-fe93007adb69", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vWheeler", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3664617648", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855/vf-modules/vf-module/788cde64-c288-4971-8e8c-77973c5009dc" + }, + { + "id": "3008335920", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/97315a05-e6f3-4c47-ae7e-d850c327aa08" + }, + { + "id": "3477385312", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/8627b971-1032-420f-a044-6802f0ab6976" + } + ] + }, + { + "id": "3418898432", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855", + "properties": { + "vnf-id": "8e5e3ba1-3fe6-4d86-966e-f9f03dab4855", + "vnf-name": "zolson3amdns02test2", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1507132024933", + "model-invariant-id": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", + "model-version-id": "76e908e0-5201-44d2-a3e2-9e6128d05820", + "model-customization-id": "c00e8fc8-af39-4da8-8c78-a7efc2fe5994", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3664617648", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855/vf-modules/vf-module/788cde64-c288-4971-8e8c-77973c5009dc" + }, + { + "id": "3008335920", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/97315a05-e6f3-4c47-ae7e-d850c327aa08" + }, + { + "id": "3477385312", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/8627b971-1032-420f-a044-6802f0ab6976" + }, + { + "id": "3647635704", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/b30b17e9-10d0-4475-b558-7d18ae0aade0" + }, + { + "id": "3664621744", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e/vservers/vserver/d3b293ba-85de-440e-904b-9dad160fbdce" + }, + { + "id": "3975352504", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e/vservers/vserver/495a9a72-c9f6-41ed-93eb-065ebc2bfb1f" + }, + { + "id": "4059455552", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e/vservers/vserver/b4b9f419-3ed4-4bd8-bb2e-32b0a98e80b7" + }, + { + "id": "4098130088", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e/vservers/vserver/94c79f43-e76d-461e-b8df-8af2acb08e1e" + }, + { + "id": "4401291416", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e/vservers/vserver/99cad3c6-1301-49c4-ad67-ae3c955de5f1" + }, + { + "id": "4458950808", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e/vservers/vserver/047354dc-0244-4241-b24a-7d7b00413b82" + } + ] + }, + { + "id": "1024648346", + "node-type": "generic-vnf", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/a58bf551-a79c-42d1-83b4-ed9288036245", + "properties": { + "vnf-id": "a58bf551-a79c-42d1-83b4-ed9288036245", + "vnf-name": "Harrison Kris", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "4679861552759", + "model-invariant-id": "00beb8f9-6d39-452f-816d-c709b9cbb87d", + "model-version-id": "0903e1c0-8e03-4936-b5c2-260653b96413", + "model-customization-id": "14e8057d-b22a-405c-84aa-90b82bfd6e46", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3664617648", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855/vf-modules/vf-module/788cde64-c288-4971-8e8c-77973c5009dc" + }, + { + "id": "3008335920", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/97315a05-e6f3-4c47-ae7e-d850c327aa08" + }, + { + "id": "3477385312", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/8627b971-1032-420f-a044-6802f0ab6976" + }, + { + "id": "3647635704", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/b30b17e9-10d0-4475-b558-7d18ae0aade0" + }, + { + "id": "3664621744", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/d3b293ba-85de-440e-904b-9dad160fbdce" + }, + { + "id": "3975352504", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/495a9a72-c9f6-41ed-93eb-065ebc2bfb1f" + }, + { + "id": "4059455552", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/b4b9f419-3ed4-4bd8-bb2e-32b0a98e80b7" + }, + { + "id": "4098130088", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/94c79f43-e76d-461e-b8df-8af2acb08e1e" + }, + { + "id": "4401291416", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/99cad3c6-1301-49c4-ad67-ae3c955de5f1" + }, + { + "id": "4458950808", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/047354dc-0244-4241-b24a-7d7b00413b82" + } + ] + }, + { + "id": "1024648346", + "node-type": "generic-vfmodule", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/a58bf551-a79c-42d1-83b4-ed9288036245", + "properties": { + "vnf-id": "a58bf551-a79c-42d1-83b4-ed9288036245", + "vnf-name": "Harrison Kris", + "vnf-type": "CHARLOTTE preload 1710 0914/CHARLOTTE preload 1710 0914 0", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "4679861552759", + "model-invariant-id": "00beb8f9-6d39-452f-816d-c709b9cbb87d", + "model-version-id": "0903e1c0-8e03-4936-b5c2-260653b96413", + "model-customization-id": "14e8057d-b22a-405c-84aa-90b82bfd6e46", + "nf-type": "DNS", + "nf-function": "Mobile DNS", + "nf-role": "vMobileDNS", + "nf-naming-code": "null" + }, + "related-to": [ + { + "id": "3664617648", + "node-type": "vf-module", + "url": "https://aai.onap.org:8443/aai/v10/network/generic-vnfs/generic-vnf/8e5e3ba1-3fe6-4d86-966e-f9f03dab4855/vf-modules/vf-module/788cde64-c288-4971-8e8c-77973c5009dc" + }, + { + "id": "3008335920", + "node-type": "service-instance", + "url": "https://aai.onap.org:8443/aai/v10/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances/service-instance/97315a05-e6f3-4c47-ae7e-d850c327aa08" + }, + { + "id": "3477385312", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/8627b971-1032-420f-a044-6802f0ab6976" + }, + { + "id": "3647635704", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/b30b17e9-10d0-4475-b558-7d18ae0aade0" + }, + { + "id": "3664621744", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/d3b293ba-85de-440e-904b-9dad160fbdce" + }, + { + "id": "3975352504", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/495a9a72-c9f6-41ed-93eb-065ebc2bfb1f" + }, + { + "id": "4059455552", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/b4b9f419-3ed4-4bd8-bb2e-32b0a98e80b7" + }, + { + "id": "4098130088", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/94c79f43-e76d-461e-b8df-8af2acb08e1e" + }, + { + "id": "4401291416", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/99cad3c6-1301-49c4-ad67-ae3c955de5f1" + }, + { + "id": "4458950808", + "node-type": "vserver", + "url": "https://aai.onap.org:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/olson3/tenants/tenant/eecd15e8e7ee46c3bbc2096f0924f4c4/vservers/vserver/047354dc-0244-4241-b24a-7d7b00413b82" + } + ] + } + ] +}
\ No newline at end of file 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 6b5b08e2b..3d1dfb2ce 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 @@ -1,15 +1,59 @@ package org.onap.vid.api; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.IsNot.not; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.defaultPlacement; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofL3Network; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofServiceInstance; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofVlanTag; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofVnf; +import static org.onap.simulator.presetGenerator.presets.aai.PresetBaseAAICustomQuery.FORMAT.SIMPLE; +import static org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPortalPresetsUtils.getEcompPortalPresets; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; +import static org.testng.AssertJUnit.assertEquals; +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.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS; + import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; +import java.io.IOException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.util.List; +import java.util.UUID; import net.javacrumbs.jsonunit.JsonAssert; import net.javacrumbs.jsonunit.core.Configuration; import net.javacrumbs.jsonunit.core.Option; import org.apache.commons.text.StringEscapeUtils; +import org.apache.http.client.utils.URIBuilder; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.onap.simulator.presetGenerator.presets.aai.*; +import org.onap.simulator.presetGenerator.presets.aai.AAIBaseGetL3NetworksByCloudRegionPreset; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIBadBodyForGetServicesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegion; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetL3NetworksByCloudRegion; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetL3NetworksByCloudRegionSpecificState; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetails; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetailsInvalidRequest; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetailsRequiredMissing; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePortsError; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetRelatedInstanceGroupsByVnfId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetVpnsByType; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIModelVersionsByInvariantId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetBaseAAICustomQuery; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import org.onap.vid.model.aai.AaiResponse; @@ -22,6 +66,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.util.UriComponentsBuilder; +import org.testng.AssertJUnit; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.infra.FeatureTogglingTest; @@ -29,25 +74,6 @@ import vid.automation.test.infra.Features; import vid.automation.test.services.SimulatorApi; import vid.automation.test.utils.TestHelper; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.util.List; -import java.util.UUID; - -import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.*; -import static org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPortalPresetsUtils.getEcompPortalPresets; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNull; -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.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS; - public class AaiApiTest extends BaseApiAaiTest { private static final String AAI_HOMING_DATA_RESPONSE = "viewEdit/aaiHomingDataResponse.json"; @@ -56,6 +82,7 @@ public class AaiApiTest extends BaseApiAaiTest { public static final String[] AAI_GET_SERVICES_ERROR_SIMULATOR_RESPONSES = {"getServicesAaiErrorResp.json", "create_new_instance/aai_get_full_subscribers.json"}; public static final String[] AAI_GET_SERVICES_FINE_SIMULATOR_RESPONSES = {"getServicesAaiFineResp.json", "create_new_instance/aai_get_full_subscribers.json"}; public static final String AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON = "changeManagement/get_vnf_data_by_globalid_and_service_type.json"; + public static final String AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS = "registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_reduced_response.json"; public static final String OPERATIONAL_ENVIRONMENT_TYPE = "VNF"; public static final String OPERATIONAL_ENVIRONMENT_STATUS = "Activate"; public static final String GET_INSTANCE_GROUPS_BY_CLOUDREGION_EXPECTED_RESPONSE = "{\"results\":[{\"instance-group\":{\"id\":\"AAI-12002-test3-vm230w\",\"description\":\"a9DEa0kpY\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"model-id3\",\"model-version-id\":\"a0efd5fc-f7be-4502-936a-a6c6392b958f\",\"instance-group-type\":\"type\",\"resource-version\":\"1520888659539\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"relatedToPropertyList\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}],\"related-to\":\"cloud-region\",\"related-link\":\"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"relationship-data\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"related-to-property\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}]}]}}},{\"instance-group\":{\"id\":\"AAI-12002-test1-vm230w\",\"description\":\"a9DEa0kpY\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"model-id1\",\"model-version-id\":\"a0efd5fc-f7be-4502-936a-a6c6392b958f\",\"instance-group-type\":\"type\",\"resource-version\":\"1520886467989\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"relatedToPropertyList\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}],\"related-to\":\"cloud-region\",\"related-link\":\"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"relationship-data\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"related-to-property\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}]}]}}},{\"instance-group\":{\"id\":\"AAI-12002-test2-vm230w\",\"description\":\"a9DEa0kpY\",\"instance-group-role\":\"JZmha7QSS4tJ\",\"model-invariant-id\":\"model-id2\",\"model-version-id\":\"version2\",\"instance-group-type\":\"type\",\"resource-version\":\"1520888629970\",\"instance-group-name\":\"wKmBXiO1xm8bK\",\"instance-group-function\":\"testfunction2\",\"relationship-list\":{\"relationship\":[{\"relationDataList\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"relatedToPropertyList\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}],\"related-to\":\"cloud-region\",\"related-link\":\"/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w\",\"relationship-label\":\"org.onap.relationships.inventory.Uses\",\"relationship-data\":[{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"AAI-12002-vm230w\"},{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"AAI-region-vm230w\"}],\"related-to-property\":[{\"property-key\":\"cloud-region.owner-defined-type\",\"property-value\":null}]}]}}}]}\n"; @@ -707,17 +734,26 @@ public class AaiApiTest extends BaseApiAaiTest { @Test public void getVnfDataByGlobalIdAndServiceType() { - SimulatorApi.registerExpectation(AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON, APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetBaseAAICustomQuery( + SIMPLE, + "business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/vRichardson/service-instances", + "query/vnf-topology-fromServiceInstance" + ) { + @Override + public Object getResponseBody() { + return getResourceAsString( + "registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_response.json"); + } + }, CLEAR_THEN_SET); String url = uri + "/get_vnf_data_by_globalid_and_service_type/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/vRichardson"; ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); -//reduced_vnf_data_by_globalid_and_service_type.json - assertTrue(false == response.getBody().contains("generic-vfmodule")); + + assertThat(response.getBody(), not(containsString("generic-vfmodule"))); assertResponse(JsonAssert.when(Option.IGNORING_ARRAY_ORDER), getResourceAsString("changeManagement/reduced_vnf_data_by_globalid_and_service_type.json"), response.getBody()); - } @Test @@ -796,7 +832,33 @@ public class AaiApiTest extends BaseApiAaiTest { ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); assertTrue(response.getStatusCode().is2xxSuccessful()); - assertNull(response.getBody()); + AssertJUnit.assertNull(response.getBody()); + } + + @Test + @FeatureTogglingTest(Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH) + public void getVnfsWithCustomQueryNewReducedResponse() throws URISyntaxException { + + String globalCustomerId = "globalCustomerId1-360-as988q"; + String serviceType = "TEST1-360"; + String nfRole = "test360"; + SimulatorApi.registerExpectationFromPreset(new PresetBaseAAICustomQuery( + SIMPLE, + "/business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + + serviceType + "/service-instances", + "query/vnfs-fromServiceInstance-filter?nfRole=" + nfRole + ) { + @Override + public Object getResponseBody() { + return getResourceAsString( + AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS); + } + }, CLEAR_THEN_SET); + URIBuilder urlBuilder = new URIBuilder(uri + "/get_vnf_data_by_globalid_and_service_type/" + globalCustomerId + "/" + serviceType); + urlBuilder.addParameter("nfRole", nfRole); + ResponseEntity<String> response = restTemplate.getForEntity(urlBuilder.build().toString(), String.class); + assertTrue(response.getStatusCode().is2xxSuccessful()); + assertThat(response.getBody(), jsonEquals(getResourceAsString(AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS))); } private void assertResponse(Object expected, String response) { diff --git a/vid-automation/src/test/resources/features.properties b/vid-automation/src/test/resources/features.properties index 36c72374a..25bdff696 100644 --- a/vid-automation/src/test/resources/features.properties +++ b/vid-automation/src/test/resources/features.properties @@ -33,3 +33,5 @@ FLAG_1908_RESUME_MACRO_SERVICE=true FLAG_1908_RELEASE_TENANT_ISOLATION=true FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT=true FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH=false +FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG=true + |