Search in sources :

Example 1 with Networks

use of org.onap.so.serviceinstancebeans.Networks in project so by onap.

the class UserParamsValidation method validate.

@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
    Service validate = info.getUserParams();
    if (validate.getModelInfo() == null) {
        throw new ValidationException("modelInfo in userParams", true);
    } else if (validate.getModelInfo().getModelType() == null) {
        throw new ValidationException("modelType in userParams service modelInfo", true);
    } else if (validate.getModelInfo().getModelVersionId() == null) {
        throw new ValidationException("modelVersionId in userParams service modelInfo", true);
    }
    modelInfoValidation(info.getSir().getRequestDetails().getModelInfo(), validate.getModelInfo());
    if (validate.getInstanceName() != null && info.getRequestInfo().getInstanceName() != null) {
        instanceNameValidation(info, validate);
    }
    Actions action = info.getAction();
    Map<String, Set<String>> vnfCustomIdToInstanceNames = new HashMap<>();
    Map<String, Set<String>> vfModuleCustomIdToInstanceNames = new HashMap<>();
    for (Vnfs vnf : validate.getResources().getVnfs()) {
        if (vnf.getModelInfo() == null) {
            throw new ValidationException("modelInfo in userParams vnf resources", true);
        } else if (vnf.getModelInfo().getModelCustomizationId() == null) {
            throw new ValidationException("modelCustomizationId in userParams vnf resources", true);
        } else if (vnf.getModelInfo().getModelVersionId() == null) {
            throw new ValidationException("modelVersionId in userParams vnf resources", true);
        }
        if (vnf.getCloudConfiguration() == null) {
            throw new ValidationException("cloudConfiguration in userParams vnf resources", true);
        }
        if (action == Action.createInstance || action == Action.assignInstance) {
            if (vnf.getPlatform() == null) {
                throw new ValidationException("platform in userParams vnf resources", true);
            }
            if (vnf.getProductFamilyId() == null) {
                throw new ValidationException("productFamilyId in userParams vnf resources", true);
            }
        }
        if (vnf.getPlatform() != null && vnf.getPlatform().getPlatformName() == null) {
            throw new ValidationException("platformName in userParams vnf resources", true);
        }
        String vnfCustomizationId = vnf.getModelInfo().getModelCustomizationId();
        vnfCustomIdToInstanceNames.putIfAbsent(vnfCustomizationId, new HashSet<>());
        String vnfInstanceName = StringUtils.defaultString(vnf.getInstanceName());
        Set<String> vnfVisitedInstanceNames = vnfCustomIdToInstanceNames.get(vnfCustomizationId);
        if (!vnfVisitedInstanceNames.add(vnfInstanceName)) {
            throw new ValidationException("instanceName: same instanceName with same modelCustomizationId in userParams vnf resources", true);
        }
        if (vnf.getVfModules().isEmpty()) {
            throw new ValidationException("vfModules in userParams vnf resources", true);
        }
        for (VfModules vfModule : vnf.getVfModules()) {
            if (vfModule.getModelInfo() == null) {
                throw new ValidationException("modelInfo in userParams vfModules resources", true);
            } else if (vfModule.getModelInfo().getModelCustomizationId() == null) {
                throw new ValidationException("modelCustomizationId in userParams vfModule resources", true);
            } else if (vfModule.getModelInfo().getModelVersionId() == null) {
                throw new ValidationException("modelVersionId in userParams vfModule resources", true);
            }
            String vfModulecustomizationId = vfModule.getModelInfo().getModelCustomizationId();
            vfModuleCustomIdToInstanceNames.putIfAbsent(vfModulecustomizationId, new HashSet<>());
            String vfModuleInstanceName = StringUtils.defaultString(vfModule.getInstanceName());
            Set<String> vfModuleVisitedInstanceNames = vfModuleCustomIdToInstanceNames.get(vfModulecustomizationId);
            if (!vfModuleVisitedInstanceNames.add(vfModuleInstanceName)) {
                throw new ValidationException("instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources", true);
            }
        }
    }
    validateDuplicateInstanceNames(vnfCustomIdToInstanceNames, "vnf");
    validateDuplicateInstanceNames(vfModuleCustomIdToInstanceNames, "vfModule");
    List<Networks> validateNetworks = new ArrayList<>();
    validateNetworks = validate.getResources().getNetworks();
    if (validateNetworks != null) {
        for (Networks networks : validateNetworks) {
            if (networks.getModelInfo() == null) {
                throw new ValidationException("modelInfo in userParams network resources", true);
            } else if (networks.getModelInfo().getModelCustomizationId() == null) {
                throw new ValidationException("modelCustomizationId in userParams network resources", true);
            } else if (networks.getModelInfo().getModelVersionId() == null) {
                throw new ValidationException("modelVersionId in userParams network resources", true);
            }
            if (networks.getCloudConfiguration() == null) {
                throw new ValidationException("cloudConfiguration in userParams network resources", true);
            }
        }
    }
    return info;
}
Also used : VfModules(org.onap.so.serviceinstancebeans.VfModules) Networks(org.onap.so.serviceinstancebeans.Networks) ValidationException(org.onap.so.exceptions.ValidationException) Set(java.util.Set) HashSet(java.util.HashSet) Actions(org.onap.so.apihandlerinfra.Actions) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Service(org.onap.so.serviceinstancebeans.Service) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 2 with Networks

use of org.onap.so.serviceinstancebeans.Networks in project so by onap.

the class BBInputSetup method getGBBMacroUserParams.

protected GeneralBuildingBlock getGBBMacroUserParams(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String vnfType, String bbName, String key, GeneralBuildingBlock gBB, RequestParameters requestParams, Service service, String input) throws Exception {
    ServiceInstance serviceInstance = gBB.getServiceInstance();
    org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(input, org.onap.so.serviceinstancebeans.Service.class);
    Resources resources = serviceMacro.getResources();
    Vnfs vnfs = null;
    VfModules vfModules = null;
    Networks networks = null;
    CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration();
    CloudRegion cloudRegion = setCloudConfiguration(gBB, cloudConfiguration);
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build();
    if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
        String vnfInstanceName = lookupKeyMap.get(ResourceKey.VNF_INSTANCE_NAME);
        if (StringUtils.isNotBlank(vnfInstanceName)) {
            vnfs = findVnfsByInstanceName(vnfInstanceName, resources);
        } else {
            vnfs = findVnfsByKey(key, resources);
        }
        // Vnf level cloud configuration takes precedence over service level cloud configuration.
        if (vnfs.getCloudConfiguration() != null) {
            setCloudConfiguration(gBB, vnfs.getCloudConfiguration());
        }
        String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
        // This stores the vnf id in request db to be retrieved later when
        // working on a vf module or volume group
        InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId());
        if (request != null) {
            this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId);
        }
        parameter.setModelInfo(vnfs.getModelInfo());
        parameter.setInstanceName(vnfs.getInstanceName());
        parameter.setPlatform(vnfs.getPlatform());
        parameter.setLineOfBusiness(vnfs.getLineOfBusiness());
        parameter.setResourceId(vnfId);
        parameter.setVnfType(vnfType);
        parameter.setInstanceParams(vnfs.getInstanceParams());
        parameter.setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId());
        String applicationId = "";
        if (vnfs.getApplicationId() != null) {
            applicationId = vnfs.getApplicationId();
        }
        parameter.setApplicationId(applicationId);
        this.populateGenericVnf(parameter);
    } else if (bbName.contains(PNF) || (bbName.contains(CONTROLLER) && (PNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
        String pnfId = lookupKeyMap.get(ResourceKey.PNF);
        resources.getPnfs().stream().filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst().ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance));
    } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER) && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
        String vfModuleInstanceName = lookupKeyMap.get(ResourceKey.VF_MODULE_INSTANCE_NAME);
        if (StringUtils.isNotBlank(vfModuleInstanceName)) {
            vfModules = getVfModulesByInstanceName(vfModuleInstanceName, resources);
        } else {
            vfModules = getVfModulesByKey(key, resources);
        }
        String vfModulesName = vfModules.getInstanceName();
        String vfModulesModelCustId = vfModules.getModelInfo().getModelCustomizationId();
        // Get the Vnf associated with vfModule
        Optional<org.onap.so.serviceinstancebeans.Vnfs> parentVnf = resources.getVnfs().stream().filter(aVnf -> aVnf.getCloudConfiguration() != null).filter(aVnf -> aVnf.getVfModules().stream().anyMatch(aVfModules -> aVfModules.getInstanceName().equals(vfModulesName) && aVfModules.getModelInfo().getModelCustomizationId().equals(vfModulesModelCustId))).findAny();
        // Get the cloud configuration from this Vnf
        if (parentVnf.isPresent()) {
            cloudRegion = setCloudConfiguration(gBB, parentVnf.get().getCloudConfiguration());
        }
        lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
        parameter.setModelInfo(vfModules.getModelInfo());
        if (bbName.contains(VOLUME_GROUP)) {
            parameter.setResourceId(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
            parameter.setInstanceName(vfModules.getVolumeGroupInstanceName());
            parameter.setVnfType(vnfType);
            parameter.setInstanceParams(vfModules.getInstanceParams());
            ServiceModel serviceModel = new ServiceModel();
            serviceModel.setCurrentService(service);
            parameter.setServiceModel(serviceModel);
            this.populateVolumeGroup(parameter);
        } else {
            parameter.setResourceId(lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
            CloudConfiguration cloudConfig = new CloudConfiguration();
            cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId());
            cloudConfig.setCloudOwner(cloudRegion.getCloudOwner());
            ServiceModel serviceModel = new ServiceModel();
            serviceModel.setCurrentService(service);
            parameter.setServiceModel(serviceModel);
            parameter.setCloudConfiguration(cloudConfig);
            parameter.setInstanceName(vfModules.getInstanceName());
            parameter.setInstanceParams(vfModules.getInstanceParams());
            this.populateVfModule(parameter);
            gBB.getRequestContext().setIsHelm(parameter.getIsHelm());
        }
    } else if (bbName.contains(NETWORK)) {
        networks = findNetworksByKey(key, resources);
        String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
        if (networks != null) {
            // If service level cloud configuration is not provided then get it from networks.
            if (cloudConfiguration == null) {
                Optional<org.onap.so.serviceinstancebeans.Networks> netWithCloudConfig = resources.getNetworks().stream().filter(aNetwork -> aNetwork.getCloudConfiguration() != null).findAny();
                if (netWithCloudConfig.isPresent()) {
                    setCloudConfiguration(gBB, netWithCloudConfig.get().getCloudConfiguration());
                } else {
                    logger.debug("Could not find any cloud configuration for this request.");
                }
            }
            parameter.setInstanceName(networks.getInstanceName());
            parameter.setModelInfo(networks.getModelInfo());
            parameter.setInstanceParams(networks.getInstanceParams());
            parameter.setResourceId(networkId);
            this.populateL3Network(parameter);
        }
    } else if (bbName.contains("Configuration")) {
        String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
        ModelInfo configurationModelInfo = new ModelInfo();
        configurationModelInfo.setModelCustomizationUuid(key);
        ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service);
        if (configurationCust != null) {
            parameter.setModelInfo(configurationModelInfo);
            parameter.setResourceId(configurationId);
            parameter.setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys());
            parameter.setRequestDetails(executeBB.getRequestDetails());
            this.populateConfiguration(parameter);
        } else {
            logger.debug("Could not find a configuration customization with key: {}", key);
        }
    }
    return gBB;
}
Also used : WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) AAIUriFactory(org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory) VpnBinding(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding) Vnfs(org.onap.so.serviceinstancebeans.Vnfs) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) StringUtils(org.apache.commons.lang3.StringUtils) ServiceProxyResourceCustomization(org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) JavaDelegate(org.camunda.bpm.engine.delegate.JavaDelegate) Pnf(org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf) Service(org.onap.so.db.catalog.beans.Service) Map(java.util.Map) Tenant(org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant) OrchestrationStatus(org.onap.so.db.catalog.beans.OrchestrationStatus) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) NetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ServiceProxy(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) UUID(java.util.UUID) Pair(org.javatuples.Pair) ServiceModelNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException) Objects(java.util.Objects) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) List(java.util.List) RelatedInstanceList(org.onap.so.serviceinstancebeans.RelatedInstanceList) CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ModelType(org.onap.so.serviceinstancebeans.ModelType) Optional(java.util.Optional) Relationships(org.onap.aaiclient.client.aai.entities.Relationships) Vnfc(org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) Types(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) NoServiceInstanceFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException) HashMap(java.util.HashMap) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ResourceNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ResourceNotFoundException) ArrayList(java.util.ArrayList) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) VfModules(org.onap.so.serviceinstancebeans.VfModules) RouteTableReference(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) OwningEntity(org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) Logger(org.slf4j.Logger) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) Project(org.onap.so.bpmn.servicedecomposition.bbobjects.Project) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) VnfcInstanceGroupCustomization(org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) AAICommonObjectMapperProvider(org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider) Networks(org.onap.so.serviceinstancebeans.Networks) Component(org.springframework.stereotype.Component) Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) RequestParameters(org.onap.so.serviceinstancebeans.RequestParameters) Resources(org.onap.so.serviceinstancebeans.Resources) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) VfModules(org.onap.so.serviceinstancebeans.VfModules) Networks(org.onap.so.serviceinstancebeans.Networks) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Optional(java.util.Optional) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) Vnfs(org.onap.so.serviceinstancebeans.Vnfs) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) Resources(org.onap.so.serviceinstancebeans.Resources) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization)

Example 3 with Networks

use of org.onap.so.serviceinstancebeans.Networks in project so by onap.

the class RequestHandlerUtils method configureUserParams.

protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
    logger.debug("Configuring UserParams for Macro Request");
    Map<String, Object> userParams = new HashMap<>();
    for (Map<String, Object> params : reqParams.getUserParams()) {
        if (params.containsKey("service")) {
            Service service = serviceMapper(params);
            addUserParams(userParams, service.getInstanceParams());
            for (Networks network : service.getResources().getNetworks()) {
                addUserParams(userParams, network.getInstanceParams());
            }
            for (Vnfs vnf : service.getResources().getVnfs()) {
                addUserParams(userParams, vnf.getInstanceParams());
                for (VfModules vfModule : vnf.getVfModules()) {
                    addUserParams(userParams, vfModule.getInstanceParams());
                }
            }
        }
    }
    return mapFlatMapToNameValue(userParams);
}
Also used : Networks(org.onap.so.serviceinstancebeans.Networks) VfModules(org.onap.so.serviceinstancebeans.VfModules) HashMap(java.util.HashMap) Service(org.onap.so.serviceinstancebeans.Service) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 4 with Networks

use of org.onap.so.serviceinstancebeans.Networks in project so by onap.

the class RequestHandlerUtils method configureCloudConfig.

protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
    for (Map<String, Object> params : reqParams.getUserParams()) {
        if (params.containsKey("service")) {
            Service service = serviceMapper(params);
            Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
            if (targetConfiguration.isPresent()) {
                return targetConfiguration.get();
            } else {
                for (Networks network : service.getResources().getNetworks()) {
                    targetConfiguration = addCloudConfig(network.getCloudConfiguration());
                    if (targetConfiguration.isPresent()) {
                        return targetConfiguration.get();
                    }
                }
                for (Vnfs vnf : service.getResources().getVnfs()) {
                    targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
                    if (targetConfiguration.isPresent()) {
                        return targetConfiguration.get();
                    }
                    for (VfModules vfModule : vnf.getVfModules()) {
                        targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
                        if (targetConfiguration.isPresent()) {
                            return targetConfiguration.get();
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : Networks(org.onap.so.serviceinstancebeans.Networks) VfModules(org.onap.so.serviceinstancebeans.VfModules) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Service(org.onap.so.serviceinstancebeans.Service) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 5 with Networks

use of org.onap.so.serviceinstancebeans.Networks in project so by onap.

the class UserParamsServiceTraversal method setResourceListForNetworks.

private void setResourceListForNetworks(DelegateExecution execution, String serviceModelVersionId, String requestAction, List<Resource> resourceList, Resource serviceResource, Service validate) {
    for (Networks network : validate.getResources().getNetworks()) {
        Resource networkResource = new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false, serviceResource);
        networkResource.setProcessingPriority(network.getProcessingPriority());
        ModelInfo modelInfo = network.getModelInfo();
        if (modelInfo != null) {
            networkResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
            networkResource.setModelVersionId(modelInfo.getModelVersionId());
        }
        resourceList.add(networkResource);
    }
    if (requestAction.equals(CREATE_INSTANCE)) {
        String networkColCustId = queryCatalogDbForNetworkCollection(execution, serviceModelVersionId);
        if (networkColCustId != null) {
            resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false, serviceResource));
        }
    }
}
Also used : Networks(org.onap.so.serviceinstancebeans.Networks) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)

Aggregations

Networks (org.onap.so.serviceinstancebeans.Networks)5 VfModules (org.onap.so.serviceinstancebeans.VfModules)4 Vnfs (org.onap.so.serviceinstancebeans.Vnfs)4 HashMap (java.util.HashMap)3 Service (org.onap.so.serviceinstancebeans.Service)3 ArrayList (java.util.ArrayList)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Set (java.util.Set)1 UUID (java.util.UUID)1 StringUtils (org.apache.commons.lang3.StringUtils)1 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)1 JavaDelegate (org.camunda.bpm.engine.delegate.JavaDelegate)1 Pair (org.javatuples.Pair)1 AAICommonObjectMapperProvider (org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider)1