use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class NetworkTopologyOperationRequestMapperTest method before.
@Before
public void before() {
// prepare and set service instance
serviceInstance = new ServiceInstance();
serviceInstanceNoCollection = new ServiceInstance();
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
modelInfoServiceInstance.setModelName("modelName");
modelInfoServiceInstance.setModelUuid("modelUuid");
modelInfoServiceInstance.setModelVersion("modelVersion");
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance);
// prepare Customer object
customer = new Customer();
customer.setGlobalCustomerId("globalCustomerId");
// serviceInstance.setCustomer(customer);
// set Customer on service instance
ServiceSubscription serviceSubscription = new ServiceSubscription();
serviceSubscription.setServiceType("productFamilyId");
customer.setServiceSubscription(serviceSubscription);
// set Customer on service instance
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection);
//
InstanceGroup networkInstanceGroup = new InstanceGroup();
networkInstanceGroup.setId("networkInstanceGroupId");
networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction");
Collection networkCollection = new Collection();
networkCollection.setInstanceGroup(networkInstanceGroup);
serviceInstance.setCollection(networkCollection);
//
requestContext = new RequestContext();
Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
requestContext.setMsoRequestId("MsoRequestId");
network = new L3Network();
network.setNetworkId("TEST_NETWORK_ID");
network.setNetworkName("TEST_NETWORK_NAME");
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid");
modelInfoNetwork.setModelName("modelName");
modelInfoNetwork.setModelVersion("modelVersion");
modelInfoNetwork.setModelUUID("modelUuid");
modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
network.setModelInfoNetwork(modelInfoNetwork);
cloudRegion = new CloudRegion();
}
use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork 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.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class BBInputSetupMapperLayer method mapCatalogNetworkToNetwork.
protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) {
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class);
modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork);
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
return modelInfoNetwork;
}
use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class NetworkAdapterObjectMapperTest method deleteNetworkRequestMapperTest.
@Test
public void deleteNetworkRequestMapperTest() throws Exception {
DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest();
String messageId = "messageId";
expectedDeleteNetworkRequest.setMessageId(messageId);
doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid();
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
l3Network.setModelInfoNetwork(modelInfoNetwork);
modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(requestContext.getMsoRequestId());
msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
expectedDeleteNetworkRequest.setMsoRequest(msoRequest);
expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId());
l3Network.setHeatStackId("heatStackId");
expectedDeleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
expectedDeleteNetworkRequest.setSkipAAI(true);
expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
expectedDeleteNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest));
}
use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.
the class BBInputSetupMapperLayerTest method testMapCatalogNetworkToNetwork.
@Test
public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException {
NetworkResourceCustomization networkResourceCustomization = mapper.readValue(new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class);
ModelInfoNetwork expectedModelInfoNetwork = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class);
ModelInfoNetwork actualModelInfoNetwork = bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization);
assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork));
}
Aggregations