1 package org.onap.sdnc.northbound;
3 import org.junit.Before;
5 import org.junit.runner.RunWith;
6 import org.mockito.runners.MockitoJUnitRunner;
7 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GetpathsegmentTopologyOperationInput;
8 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GetpathsegmentTopologyOperationOutput;
9 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder;
10 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.onap.model.information.OnapModelInformationBuilder;
11 import org.opendaylight.yangtools.yang.common.RpcResult;
13 import static org.junit.Assert.assertEquals;
14 import static org.onap.sdnc.northbound.util.MDSALUtil.*;
16 @RunWith(MockitoJUnitRunner.class)
17 public class GetpathsegmentTopologyOperationRPCTest extends GenericResourceApiProviderTest {
19 private static final String SVC_OPERATION = "getpathsegment-topology-operation";
22 public void setUp() throws Exception {
24 svcClient.setScvOperation(SVC_OPERATION);
28 public void should_fail_when_invalid_vnf_topology() throws Exception {
30 GetpathsegmentTopologyOperationInput input = GetpathsegmentTopologyOperationInput().build();
32 GetpathsegmentTopologyOperationOutput output =
33 exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
35 assertEquals("404", output.getResponseCode());
36 assertEquals("invalid input, null or empty service-instance-id", output.getResponseMessage());
37 assertEquals("Y", output.getAckFinalIndicator());
41 public void should_fail_when_valid_vnf_topology() throws Exception {
43 GetpathsegmentTopologyOperationInput input = GetpathsegmentTopologyOperationInput()
44 .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInstanceID").build()).build();
46 GetpathsegmentTopologyOperationOutput output =
47 exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
49 assertEquals("404", output.getResponseCode());
50 assertEquals("invalid input, no model-uuid provided", output.getResponseMessage());
51 assertEquals("Y", output.getAckFinalIndicator());
55 public void should_fail_when_valid_serice_excep_vnf_topology() throws Exception {
57 GetpathsegmentTopologyOperationInput input = GetpathsegmentTopologyOperationInput()
58 .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInstanceID")
59 .setOnapModelInformation(new OnapModelInformationBuilder().setModelUuid("moduleUUID").build()).build()).build();
61 GetpathsegmentTopologyOperationOutput output =
62 exec(genericResourceApiProvider::getpathsegmentTopologyOperation, input, RpcResult::getResult);
64 assertEquals("503", output.getResponseCode());
65 assertEquals("No service logic active for generic-resource-api: 'getpathsegment-topology-operation'",
66 output.getResponseMessage());
67 assertEquals("Y", output.getAckFinalIndicator());