Search in sources :

Example 1 with GenericResourceApiServiceinformationServiceInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation in project so by onap.

the class ServiceTopologyOperationMapper method reqMapper.

public GenericResourceApiServiceOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
    String sdncReqId = UUID.randomUUID().toString();
    String msoRequestId = UUID.randomUUID().toString();
    if (requestContext != null && requestContext.getMsoRequestId() != null) {
        msoRequestId = requestContext.getMsoRequestId();
    }
    GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
    GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
    GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
    GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
    GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
    servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
    servOpInput.setSdncRequestHeader(sdncRequestHeader);
    servOpInput.setRequestInformation(reqInfo);
    servOpInput.setServiceInformation(servInfo);
    servOpInput.setServiceRequestInput(servReqInfo);
    if (requestContext != null && requestContext.getUserParams() != null) {
        for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
            GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
            serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
            GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
            GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
            paramItem.setName(entry.getKey());
            paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
            serviceInputParameters.addParamItem(paramItem);
            serviceRequestInput.serviceInputParameters(serviceInputParameters);
            servOpInput.setServiceRequestInput(serviceRequestInput);
        }
    }
    return servOpInput;
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) GenericResourceApiServicerequestinputServiceRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiServicerequestinputServiceRequestInput) GenericResourceApiRequestinformationRequestInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) GenericResourceApiParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParam) GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam) Map(java.util.Map)

Example 2 with GenericResourceApiServiceinformationServiceInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation in project so by onap.

the class GeneralTopologyObjectMapperTest method testBuildServiceInformation.

@Test
public void testBuildServiceInformation() {
    // prepare and set service instance
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
    modelInfoServiceInstance.setModelName("serviceModelName");
    modelInfoServiceInstance.setModelUuid("serviceModelUuid");
    modelInfoServiceInstance.setModelVersion("serviceModelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    // prepare Customer object
    Customer customer = new Customer();
    customer.setGlobalCustomerId("globalCustomerId");
    ServiceSubscription serviceSubscription = new ServiceSubscription();
    serviceSubscription.setServiceType("productFamilyId");
    customer.setServiceSubscription(serviceSubscription);
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    // 
    RequestContext requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    GenericResourceApiServiceinformationServiceInformation serviceInfo = genObjMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
    assertEquals("serviceModelInvariantUuid", serviceInfo.getOnapModelInformation().getModelInvariantUuid());
    assertEquals("serviceModelName", serviceInfo.getOnapModelInformation().getModelName());
    assertEquals("serviceModelUuid", serviceInfo.getOnapModelInformation().getModelUuid());
    assertEquals("serviceModelVersion", serviceInfo.getOnapModelInformation().getModelVersion());
    assertNull(serviceInfo.getOnapModelInformation().getModelCustomizationUuid());
    assertEquals("serviceInstanceId", serviceInfo.getServiceInstanceId());
    assertEquals("serviceInstanceId", serviceInfo.getServiceId());
    assertEquals("globalCustomerId", serviceInfo.getGlobalCustomerId());
    assertEquals("productFamilyId", serviceInfo.getSubscriptionServiceType());
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 3 with GenericResourceApiServiceinformationServiceInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation in project so by onap.

the class GeneralTopologyObjectMapper method buildServiceInformation.

/*
     * Build GenericResourceApiServiceinformationServiceInformation
     */
public GenericResourceApiServiceinformationServiceInformation buildServiceInformation(ServiceInstance serviceInstance, RequestContext requestContext, Customer customer, boolean includeModelInformation) {
    GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation();
    serviceInformation.serviceId(serviceInstance.getServiceInstanceId());
    if (requestContext != null) {
        serviceInformation.setSubscriptionServiceType(requestContext.getProductFamilyId());
    }
    if (includeModelInformation) {
        GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
        onapModelInformation.setModelInvariantUuid(serviceInstance.getModelInfoServiceInstance().getModelInvariantUuid());
        onapModelInformation.setModelVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
        onapModelInformation.setModelName(serviceInstance.getModelInfoServiceInstance().getModelName());
        onapModelInformation.setModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
        serviceInformation.setOnapModelInformation(onapModelInformation);
    }
    serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    if (customer != null) {
        serviceInformation.setGlobalCustomerId(customer.getGlobalCustomerId());
        if (customer.getServiceSubscription() != null) {
            serviceInformation.setSubscriptionServiceType(customer.getServiceSubscription().getServiceType());
        }
    }
    return serviceInformation;
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation)

Example 4 with GenericResourceApiServiceinformationServiceInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation in project so by onap.

the class VnfTopologyOperationRequestMapper method reqMapper.

/**
 * This method is used for creating the vnf request.
 *
 * By these parameter it will get he detailas and prepare the request.
 *
 * @param svcOperation
 * @param svcAction
 * @param requestAction
 * @param vnf
 * @param serviceInstance
 * @param customer
 * @param cloudRegion
 * @param requestContext
 * @param homing
 * @return request
 */
public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing, URI callbackUrl) {
    String sdncReqId = UUID.randomUUID().toString();
    String msoRequestId = UUID.randomUUID().toString();
    if (requestContext != null && requestContext.getMsoRequestId() != null) {
        msoRequestId = requestContext.getMsoRequestId();
    }
    GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
    GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUrl.toString());
    GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
    GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
    GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, true);
    GenericResourceApiVnfrequestinputVnfRequestInput vnfRequestInput = new GenericResourceApiVnfrequestinputVnfRequestInput();
    vnfRequestInput.setTenant(cloudRegion.getTenantId());
    vnfRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
    vnfRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
    if (StringUtils.isNotBlank(vnf.getVnfName())) {
        vnfRequestInput.setVnfName(vnf.getVnfName());
    }
    req.setRequestInformation(requestInformation);
    req.setSdncRequestHeader(sdncRequestHeader);
    req.setServiceInformation(serviceInformation);
    req.setVnfInformation(vnfInformation);
    GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam();
    if (requestContext != null && requestContext.getUserParams() != null) {
        for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
            GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
            paramItem.setName(entry.getKey());
            paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
            vnfInputParameters.addParamItem(paramItem);
            vnfRequestInput.setVnfInputParameters(vnfInputParameters);
        }
    }
    if (vnf.getCloudParams() != null) {
        for (Map.Entry<String, String> entry : vnf.getCloudParams().entrySet()) {
            GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
            paramItem.setName(entry.getKey());
            paramItem.setValue(entry.getValue());
            vnfInputParameters.addParamItem(paramItem);
        }
    }
    if (homing) {
        License license = vnf.getLicense();
        if (license != null) {
            if (license.getEntitlementPoolUuids() != null && !license.getEntitlementPoolUuids().isEmpty()) {
                String entitlementPoolUuid = license.getEntitlementPoolUuids().get(0);
                GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
                paramItem.setName("entitlement_assignment_group_uuid");
                paramItem.setValue(entitlementPoolUuid);
                vnfInputParameters.addParamItem(paramItem);
            }
            if (license.getLicenseKeyGroupUuids() != null && !license.getLicenseKeyGroupUuids().isEmpty()) {
                String licenseKeyGroupUuid = license.getLicenseKeyGroupUuids().get(0);
                GenericResourceApiParamParam paramItem2 = new GenericResourceApiParamParam();
                paramItem2.setName("license_assignment_group_uuid");
                paramItem2.setValue(licenseKeyGroupUuid);
                vnfInputParameters.addParamItem(paramItem2);
            }
        }
    }
    List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
    List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = new ArrayList<>();
    for (InstanceGroup instanceGroup : instanceGroups) {
        if (ModelInfoInstanceGroup.TYPE_L3_NETWORK.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
            GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds();
            instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId());
            networkInstanceGroupIdList.add(instanceGroupId);
        }
    }
    vnfRequestInput.setVnfNetworkInstanceGroupIds(networkInstanceGroupIdList);
    vnfRequestInput.setVnfInputParameters(vnfInputParameters);
    req.setVnfRequestInput(vnfRequestInput);
    return req;
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds) GenericResourceApiVnfinformationVnfInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation) GenericResourceApiVnfrequestinputVnfRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfRequestInput) License(org.onap.so.bpmn.servicedecomposition.generalobjects.License) ArrayList(java.util.ArrayList) GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam) GenericResourceApiVnfOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) GenericResourceApiRequestinformationRequestInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation) GenericResourceApiParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParam) Map(java.util.Map)

Example 5 with GenericResourceApiServiceinformationServiceInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation in project so by onap.

the class GCTopologyOperationRequestMapper method assignOrActivateVnrReqMapper.

public GenericResourceApiGcTopologyOperationInformation assignOrActivateVnrReqMapper(SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, ServiceInstance serviceInstance, RequestContext requestContext, Customer customer, Configuration vnrConfiguration, GenericVnf voiceVnf, String sdncReqId, URI callbackUri) {
    String msoRequestId = UUID.randomUUID().toString();
    if (requestContext != null && requestContext.getMsoRequestId() != null) {
        msoRequestId = requestContext.getMsoRequestId();
    }
    GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
    GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUri.toString());
    GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
    GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
    GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration, true);
    GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf, null);
    req.setRequestInformation(requestInformation);
    req.setSdncRequestHeader(sdncRequestHeader);
    req.setServiceInformation(serviceInformation);
    req.setConfigurationInformation(configurationInformation);
    req.setGcRequestInput(gcRequestInput);
    return req;
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) GenericResourceApiConfigurationinformationConfigurationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation) GenericResourceApiGcrequestinputGcRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput) GenericResourceApiRequestinformationRequestInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation) GenericResourceApiGcTopologyOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation)

Aggregations

GenericResourceApiServiceinformationServiceInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation)8 GenericResourceApiRequestinformationRequestInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation)6 GenericResourceApiSdncrequestheaderSdncRequestHeader (org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader)6 Map (java.util.Map)3 GenericResourceApiParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParam)3 GenericResourceApiParamParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam)3 GenericResourceApiConfigurationinformationConfigurationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation)2 GenericResourceApiGcTopologyOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation)2 GenericResourceApiVnfinformationVnfInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 GenericResourceApiGcrequestinputGcRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput)1 GenericResourceApiNetworkOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation)1 GenericResourceApiNetworkinformationNetworkInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation)1 GenericResourceApiNetworkrequestinputNetworkRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput)1 GenericResourceApiOnapmodelinformationOnapModelInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation)1 GenericResourceApiRequestActionEnumeration (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration)1 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)1 GenericResourceApiServicerequestinputServiceRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiServicerequestinputServiceRequestInput)1