Search in sources :

Example 1 with GenericResourceApiOnapmodelinformationOnapModelInformation

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

the class GeneralTopologyObjectMapper method buildConfigurationInformation.

/**
 * Build ConfigurationInformation
 *
 * @param configuration
 * @param includeModelInformation
 * @return
 */
public GenericResourceApiConfigurationinformationConfigurationInformation buildConfigurationInformation(Configuration configuration, boolean includeModelInformation) {
    GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = new GenericResourceApiConfigurationinformationConfigurationInformation();
    configurationInformation.setConfigurationId(configuration.getConfigurationId());
    configurationInformation.setConfigurationName(configuration.getConfigurationName());
    configurationInformation.setConfigurationType(configuration.getConfigurationType());
    if (includeModelInformation) {
        GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
        onapModelInformation.setModelInvariantUuid(configuration.getModelInfoConfiguration().getModelInvariantId());
        onapModelInformation.setModelUuid(configuration.getModelInfoConfiguration().getModelVersionId());
        onapModelInformation.setModelCustomizationUuid(configuration.getModelInfoConfiguration().getModelCustomizationId());
        configurationInformation.setOnapModelInformation(onapModelInformation);
    }
    return configurationInformation;
}
Also used : GenericResourceApiConfigurationinformationConfigurationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation) GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation)

Example 2 with GenericResourceApiOnapmodelinformationOnapModelInformation

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

the class GeneralTopologyObjectMapper method buildNetworkInformation.

/*
     * Build GenericResourceApiNetworkinformationNetworkInformation
     */
public GenericResourceApiNetworkinformationNetworkInformation buildNetworkInformation(L3Network network) {
    GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation();
    GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
    if (network.getModelInfoNetwork() != null) {
        onapModelInformation.setModelInvariantUuid(network.getModelInfoNetwork().getModelInvariantUUID());
        onapModelInformation.setModelName(network.getModelInfoNetwork().getModelName());
        onapModelInformation.setModelVersion(network.getModelInfoNetwork().getModelVersion());
        onapModelInformation.setModelUuid(network.getModelInfoNetwork().getModelUUID());
        onapModelInformation.setModelCustomizationUuid(network.getModelInfoNetwork().getModelCustomizationUUID());
        networkInformation.setOnapModelInformation(onapModelInformation);
    }
    networkInformation.setFromPreload(null);
    networkInformation.setNetworkId(network.getNetworkId());
    networkInformation.setNetworkType(network.getNetworkType());
    networkInformation.setNetworkTechnology(network.getNetworkTechnology());
    return networkInformation;
}
Also used : GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation) GenericResourceApiNetworkinformationNetworkInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation)

Example 3 with GenericResourceApiOnapmodelinformationOnapModelInformation

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

the class ServiceTopologyOperationMapperTest method reqMapperTest.

@Test
public void reqMapperTest() throws Exception {
    // prepare and set service instance
    ServiceInstance serviceInstance = new ServiceInstance();
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
    modelInfoServiceInstance.setModelName("modelName");
    modelInfoServiceInstance.setModelUuid("modelUuid");
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    // prepare Customer object
    Customer customer = new Customer();
    customer.setGlobalCustomerId("globalCustomerId");
    customer.setServiceSubscription(new ServiceSubscription());
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    // prepare RequestContext
    RequestContext requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    requestContext.setMsoRequestId("MsoRequestId");
    GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext);
    GenericResourceApiServiceOperationInformation serviceOpInformationNullReqContext = mapper.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, null);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json")));
    ObjectMapper omapper = new ObjectMapper();
    GenericResourceApiOnapmodelinformationOnapModelInformation reqMapper1 = omapper.readValue(jsonToCompare, GenericResourceApiOnapmodelinformationOnapModelInformation.class);
    assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation()));
    assertEquals("MsoRequestId", serviceOpInformation.getRequestInformation().getRequestId());
    assertNotNull(serviceOpInformationNullReqContext.getRequestInformation().getRequestId());
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GeneralTopologyObjectMapper(org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 4 with GenericResourceApiOnapmodelinformationOnapModelInformation

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

the class GeneralTopologyObjectMapperTest method buildNetworkInformationTest.

@Test
public void buildNetworkInformationTest() {
    L3Network network = new L3Network();
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelInvariantUUID("my-uuid");
    modelInfoNetwork.setModelName("my-model-name");
    modelInfoNetwork.setModelVersion("my-model-version");
    modelInfoNetwork.setModelUUID("my-model-uuid");
    modelInfoNetwork.setModelCustomizationUUID("my-customization-uuid");
    network.setModelInfoNetwork(modelInfoNetwork);
    network.setNetworkId("my-network-id");
    network.setNetworkType("my-network-type");
    network.setNetworkTechnology("my-network-technology");
    GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation();
    GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
    networkInformation.setNetworkId("my-network-id");
    networkInformation.setNetworkType("my-network-type");
    networkInformation.networkTechnology("my-network-technology");
    networkInformation.setFromPreload(null);
    onapModelInformation.setModelInvariantUuid("my-uuid");
    onapModelInformation.setModelName("my-model-name");
    onapModelInformation.setModelVersion("my-model-version");
    onapModelInformation.setModelUuid("my-model-uuid");
    onapModelInformation.setModelCustomizationUuid("my-customization-uuid");
    networkInformation.setOnapModelInformation(onapModelInformation);
    assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network)));
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) GenericResourceApiNetworkinformationNetworkInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation) Test(org.junit.Test)

Example 5 with GenericResourceApiOnapmodelinformationOnapModelInformation

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

the class GeneralTopologyObjectMapper method buildVfModuleInformation.

/*
     * Build GenericResourceApiVfModuleinformationVfModuleInformation
     */
public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, RequestContext requestContext, boolean includeModelInformation) throws MapperException {
    GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation();
    if (includeModelInformation) {
        if (vfModule.getModelInfoVfModule() == null) {
            throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
        } else {
            GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
            onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID());
            onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName());
            onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion());
            onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID());
            onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
            vfModuleInformation.setOnapModelInformation(onapModelInformation);
        }
    }
    if (vfModule.getModelInfoVfModule() != null) {
        vfModuleInformation.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
    }
    vfModuleInformation.setVfModuleId(vfModule.getVfModuleId());
    if (requestContext != null && requestContext.getRequestParameters() != null) {
        vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
    } else {
        vfModuleInformation.setFromPreload(true);
    }
    return vfModuleInformation;
}
Also used : GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation) MapperException(org.onap.so.client.exception.MapperException) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation)

Aggregations

GenericResourceApiOnapmodelinformationOnapModelInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation)7 Test (org.junit.Test)2 GenericResourceApiNetworkinformationNetworkInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 HashMap (java.util.HashMap)1 GenericResourceApiConfigurationinformationConfigurationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation)1 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)1 GenericResourceApiServiceinformationServiceInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation)1 GenericResourceApiVfmoduleinformationVfModuleInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation)1 GenericResourceApiVnfinformationVnfInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation)1 GeneralTopologyObjectMapper (org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper)1 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)1 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)1 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)1 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)1 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)1 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)1 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)1 MapperException (org.onap.so.client.exception.MapperException)1