Search in sources :

Example 16 with Customer

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Customer in project so by onap.

the class TestDataSetup method setCustomer.

public Customer setCustomer() {
    if (gBBInput.getCustomer() != null)
        return gBBInput.getCustomer();
    Customer customer = new Customer();
    customer.setGlobalCustomerId("testGlobalCustomerId");
    customer.setSubscriberType("testSubscriberType");
    customer.setServiceSubscription(buildServiceSubscription());
    gBBInput.setCustomer(customer);
    return customer;
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)

Example 17 with Customer

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Customer in project so by onap.

the class TestDataSetup method buildCustomer.

public Customer buildCustomer() {
    customerCounter++;
    Customer customer = new Customer();
    customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter);
    customer.setSubscriberType("testSubscriberType" + customerCounter);
    customer.setServiceSubscription(buildServiceSubscription());
    return customer;
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)

Example 18 with Customer

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Customer 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 19 with Customer

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Customer in project so by onap.

the class SDNCServiceInstanceResourcesTest method assignServiceInstanceSuccessTest.

@Test
public void assignServiceInstanceSuccessTest() throws Exception {
    doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
    sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext);
    verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Test(org.junit.Test)

Example 20 with Customer

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Customer in project so by onap.

the class SDNCServiceInstanceResourcesTest method unassignServiceInstanceSuccessTest.

@Test
public void unassignServiceInstanceSuccessTest() throws Exception {
    doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
    sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext);
    verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Test(org.junit.Test)

Aggregations

Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)74 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)52 Test (org.junit.Test)40 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)37 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)25 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)23 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)23 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)22 HashMap (java.util.HashMap)21 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)16 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)15 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)14 Service (org.onap.so.db.catalog.beans.Service)13 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)11 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)10 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)10 File (java.io.File)9 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)9 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)9 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)8