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;
}
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;
}
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());
}
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)));
}
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;
}
Aggregations