use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network 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.bbobjects.L3Network 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.bbobjects.L3Network in project so by onap.
the class BBInputSetupMapperLayer method mapAAIL3Network.
protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) {
L3Network network = modelMapper.map(aaiL3Network, L3Network.class);
mapAllSubnetsIntoL3Network(aaiL3Network, network);
mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
mapAllAggregateRoutesIntoL3Network(aaiL3Network, network);
network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
return network;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class BBInputSetup method mapL3Network.
protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) {
AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri);
Optional<org.onap.aai.domain.yang.L3Network> aaiL3NetworkOp = aaiNetworkWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
org.onap.aai.domain.yang.L3Network aaiL3Network = null;
if (!aaiL3NetworkOp.isPresent()) {
return null;
}
aaiL3Network = aaiL3NetworkOp.get();
L3Network network = this.mapperLayer.mapAAIL3Network(aaiL3Network);
Optional<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships();
if (relationshipsOp.isPresent()) {
Relationships relationships = relationshipsOp.get();
this.mapNetworkPolicies(relationships.getByType(Types.NETWORK_POLICY), network.getNetworkPolicies());
mapRouteTableReferences(relationships.getByType(Types.ROUTE_TABLE_REFERENCE), network.getContrailNetworkRouteTableReferences());
}
return network;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class BBInputSetup method getGBBMacroNoUserParamsCreate.
protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service) throws Exception {
ServiceInstance serviceInstance = gBB.getServiceInstance();
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setExecuteBB(executeBB).setRequestId(executeBB.getRequestId()).setServiceInstance(serviceInstance).setService(service).setBbName(bbName).setLookupKeyMap(lookupKeyMap).setKey(key).build();
if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) {
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
parameter.setResourceId(networkId);
parameter.setModelInfo(new ModelInfo());
if ((!Boolean.TRUE.equals(executeBB.getBuildingBlock().isVirtualLink()))) {
NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
if (networkCust != null) {
parameter.getModelInfo().setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
this.populateL3Network(parameter);
} else {
logger.debug("Could not find a network customization with key: {}", key);
}
} else {
logger.debug("Orchestrating on Collection Network Resource Customization");
CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance);
NetworkResourceCustomization networkResourceCustomization = mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
if (l3Network != null) {
l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
}
}
} else if (bbName.contains("Configuration")) {
parameter.setResourceId(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID));
parameter.setModelInfo(new ModelInfo());
parameter.getModelInfo().setModelCustomizationUuid(key);
parameter.setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys());
parameter.setRequestDetails(executeBB.getRequestDetails());
this.populateConfiguration(parameter);
}
if (executeBB.getWorkflowResourceIds() != null) {
parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
this.populateNetworkCollectionAndInstanceGroupAssign(parameter);
}
RelatedInstance relatedVpnBinding = bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.vpnBinding);
RelatedInstance relatedLocalNetwork = bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.network);
if (relatedVpnBinding != null && relatedLocalNetwork != null) {
org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId());
org.onap.aai.domain.yang.L3Network aaiLocalNetwork = bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
VpnBinding vpnBinding = mapperLayer.mapAAIVpnBinding(aaiVpnBinding);
L3Network localNetwork = mapperLayer.mapAAIL3Network(aaiLocalNetwork);
Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp = bbInputSetupUtils.getAICVpnBindingFromNetwork(aaiLocalNetwork);
if (aaiAICVpnBindingOp.isPresent()) {
localNetwork.getVpnBindings().add(mapperLayer.mapAAIVpnBinding(aaiAICVpnBindingOp.get()));
}
ServiceProxy serviceProxy = getServiceProxy(service);
gBB.getServiceInstance().getServiceProxies().add(serviceProxy);
gBB.getCustomer().getVpnBindings().add(vpnBinding);
lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
gBB.getServiceInstance().getNetworks().add(localNetwork);
lookupKeyMap.put(ResourceKey.NETWORK_ID, localNetwork.getNetworkId());
}
return gBB;
}
Aggregations