Search in sources :

Example 1 with MsoRequest

use of org.onap.so.entity.MsoRequest in project so by onap.

the class NetworkAdapterObjectMapper method createMsoRequest.

public MsoRequest createMsoRequest(RequestContext requestContext, ServiceInstance serviceInstance) {
    MsoRequest msoRequest = new MsoRequest();
    msoRequest.setRequestId(requestContext.getMsoRequestId());
    msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    return msoRequest;
}
Also used : MsoRequest(org.onap.so.entity.MsoRequest)

Example 2 with MsoRequest

use of org.onap.so.entity.MsoRequest in project so by onap.

the class NetworkAdapterObjectMapperTest method updateNetworkRequestMapperTest.

@Test
public void updateNetworkRequestMapperTest() throws UnsupportedEncodingException {
    org.onap.so.openstack.beans.Subnet subnet = new org.onap.so.openstack.beans.Subnet();
    subnet.setSubnetId("subnetId");
    subnet.setGatewayIp("NULL");
    subnet.setHostRoutes(new ArrayList<org.onap.so.openstack.beans.HostRoute>());
    List<org.onap.so.openstack.beans.Subnet> subnets = new ArrayList<>();
    subnets.add(subnet);
    ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("physicalNetworkName", new ArrayList<Integer>());
    List<String> policyFqdns = Arrays.asList("networkPolicyFqdn");
    org.onap.so.openstack.beans.RouteTarget expectedRouteTarget = new org.onap.so.openstack.beans.RouteTarget();
    expectedRouteTarget.setRouteTarget("globalRouteTarget");
    ContrailNetwork contrailNetwork = new ContrailNetwork();
    contrailNetwork.setPolicyFqdns(policyFqdns);
    contrailNetwork.setRouteTableFqdns(new ArrayList<String>());
    contrailNetwork.setRouteTargets(new ArrayList<org.onap.so.openstack.beans.RouteTarget>());
    contrailNetwork.getRouteTargets().add(expectedRouteTarget);
    contrailNetwork.getRouteTableFqdns().add("routeTableReferenceFqdn");
    MsoRequest msoRequest = new MsoRequest();
    msoRequest.setServiceInstanceId("testServiceInstanceId1");
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setNetworkType("networkType");
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
    modelInfoNetwork.setModelVersion("modelVersion");
    Subnet actualSubnet = new Subnet();
    actualSubnet.setSubnetId("subnetId");
    actualSubnet.setDhcpEnabled(false);
    actualSubnet.setIpVersion("4");
    RouteTarget routeTarget = new RouteTarget();
    routeTarget.setGlobalRouteTarget("globalRouteTarget");
    VpnBinding vpnBinding = new VpnBinding();
    vpnBinding.setVpnId("vpnId");
    vpnBinding.getRouteTargets().add(routeTarget);
    Customer customer = new Customer();
    customer.getVpnBindings().add(vpnBinding);
    ServiceSubscription serviceSubscription = new ServiceSubscription();
    customer.setServiceSubscription(serviceSubscription);
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    NetworkPolicy networkPolicy = new NetworkPolicy();
    networkPolicy.setNetworkPolicyId("networkPolicyId");
    networkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn");
    RouteTableReference routeTableReference = new RouteTableReference();
    routeTableReference.setRouteTableReferenceFqdn("routeTableReferenceFqdn");
    l3Network.setModelInfoNetwork(modelInfoNetwork);
    l3Network.setPhysicalNetworkName("physicalNetworkName");
    l3Network.getSubnets().add(actualSubnet);
    l3Network.getNetworkPolicies().add(networkPolicy);
    l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference);
    l3Network.setIsSharedNetwork(false);
    l3Network.setIsExternalNetwork(false);
    HashMap<String, String> networkParams = new HashMap<String, String>();
    networkParams.put("shared", "false");
    networkParams.put("external", "false");
    networkParams.put("testUserInputKey", "testUserInputValue");
    UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest();
    expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    expectedUpdateNetworkRequest.setTenantId(cloudRegion.getTenantId());
    expectedUpdateNetworkRequest.setNetworkId(l3Network.getNetworkId());
    expectedUpdateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
    expectedUpdateNetworkRequest.setNetworkName(l3Network.getNetworkName());
    expectedUpdateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType());
    expectedUpdateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion());
    expectedUpdateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID());
    expectedUpdateNetworkRequest.setSubnets(subnets);
    expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
    expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork);
    expectedUpdateNetworkRequest.setNetworkParams(networkParams);
    expectedUpdateNetworkRequest.setMsoRequest(msoRequest);
    expectedUpdateNetworkRequest.setSkipAAI(true);
    expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
    expectedUpdateNetworkRequest.setMessageId("messageId");
    expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId");
    doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
    doReturn("http://localhost:28080/mso/WorkflowMesssage").when(SPY_networkAdapterObjectMapper).getEndpoint();
    UpdateNetworkRequest actualUpdateNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
    assertThat(actualUpdateNetworkRequest, sameBeanAs(expectedUpdateNetworkRequest).ignoring("msoRequest.requestId"));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ContrailNetwork(org.onap.so.adapters.nwrest.ContrailNetwork) MsoRequest(org.onap.so.entity.MsoRequest) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) HostRoute(org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute) UpdateNetworkRequest(org.onap.so.adapters.nwrest.UpdateNetworkRequest) ProviderVlanNetwork(org.onap.so.adapters.nwrest.ProviderVlanNetwork) NetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy) RouteTableReference(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference) VpnBinding(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding) RouteTarget(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget) Subnet(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet) Test(org.junit.Test)

Example 3 with MsoRequest

use of org.onap.so.entity.MsoRequest in project so by onap.

the class NetworkAdapterObjectMapperTest method deleteNetworkRequestNoHeatIdMapperTest.

@Test
public void deleteNetworkRequestNoHeatIdMapperTest() 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.setNetworkName("heatStackId");
    expectedDeleteNetworkRequest.setNetworkStackId("heatStackId");
    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));
}
Also used : DeleteNetworkRequest(org.onap.so.adapters.nwrest.DeleteNetworkRequest) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) MsoRequest(org.onap.so.entity.MsoRequest) Test(org.junit.Test)

Example 4 with MsoRequest

use of org.onap.so.entity.MsoRequest in project so by onap.

the class VnfAdapterObjectMapperTest method test_createVolumeGroupRequestMapper_for_alaCarte_flow.

@Test
public void test_createVolumeGroupRequestMapper_for_alaCarte_flow() throws Exception {
    RequestContext requestContext = new RequestContext();
    requestContext.setMsoRequestId("msoRequestId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("vnfId");
    genericVnf.setVnfName("vnfName");
    genericVnf.setVnfType("vnfType");
    serviceInstance.getVnfs().add(genericVnf);
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelName("modelName");
    modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID");
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId("volumeGroupId");
    volumeGroup.setVolumeGroupName("volumeGroupName");
    volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    volumeGroup.setModelInfoVfModule(modelInfoVfModule);
    serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup);
    CloudRegion cloudRegion = new CloudRegion();
    cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
    cloudRegion.setTenantId("tenantId");
    OrchestrationContext orchestrationContext = new OrchestrationContext();
    orchestrationContext.setIsRollbackEnabled(true);
    CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest();
    expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
    expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
    expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName());
    expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType());
    expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
    expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
    expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
    Map<String, Object> volumeGroupParams = new HashMap<>();
    volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
    volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
    volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
    volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
    expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams);
    expectedCreateVolumeGroupRequest.setSkipAAI(true);
    expectedCreateVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
    expectedCreateVolumeGroupRequest.setFailIfExists(false);
    MsoRequest msoRequest = new MsoRequest();
    msoRequest.setRequestId(requestContext.getMsoRequestId());
    msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest);
    expectedCreateVolumeGroupRequest.setMessageId("messageId");
    expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId");
    doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class));
    doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid();
    CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
    assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) CreateVolumeGroupRequest(org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) MsoRequest(org.onap.so.entity.MsoRequest) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 5 with MsoRequest

use of org.onap.so.entity.MsoRequest in project so by onap.

the class VnfAdapterObjectMapperTest method test_deleteVolumeGroupRequestMapper.

private void test_deleteVolumeGroupRequestMapper(String heatStackId) throws Exception {
    DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
    CloudRegion cloudRegion = new CloudRegion();
    cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
    expectedDeleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    cloudRegion.setTenantId("tenantId");
    expectedDeleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
    VolumeGroup volumeGroup = new VolumeGroup();
    volumeGroup.setVolumeGroupId("volumeGroupId");
    expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
    if (heatStackId != null) {
        volumeGroup.setHeatStackId("heatStackId");
        expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
    } else {
        volumeGroup.setVolumeGroupName("volumeGroupName");
        expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
    }
    expectedDeleteVolumeGroupRequest.setSkipAAI(true);
    MsoRequest msoRequest = new MsoRequest();
    RequestContext requestContext = new RequestContext();
    requestContext.setMsoRequestId("msoRequestId");
    msoRequest.setRequestId(requestContext.getMsoRequestId());
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    expectedDeleteVolumeGroupRequest.setMsoRequest(msoRequest);
    String messageId = "messageId";
    String endpoint = "endpoint";
    doReturn(messageId).when(vnfAdapterObjectMapper).getRandomUuid();
    doReturn(endpoint).when(vnfAdapterObjectMapper).getProperty(isA(String.class));
    expectedDeleteVolumeGroupRequest.setMessageId(messageId);
    expectedDeleteVolumeGroupRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId);
    DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
    assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) DeleteVolumeGroupRequest(org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest) MsoRequest(org.onap.so.entity.MsoRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)

Aggregations

MsoRequest (org.onap.so.entity.MsoRequest)51 Test (org.junit.Test)44 HashMap (java.util.HashMap)25 Map (java.util.Map)11 Holder (javax.xml.ws.Holder)11 VnfRollback (org.onap.so.openstack.beans.VnfRollback)9 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)6 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)6 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)5 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)5 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)4 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)4 ArrayList (java.util.ArrayList)3 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)3 HostRoute (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute)3 Subnet (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet)3 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)3 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)3 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)3 CreateNetworkRequest (org.onap.so.adapters.nwrest.CreateNetworkRequest)2