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 = build(GetpathsegmentTopologyOperationInput());
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 = build(GetpathsegmentTopologyOperationInput()
44 .setServiceInformation(new ServiceInformationBuilder().setServiceInstanceId("ServiceInstanceID").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());