2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.sdnc.northbound;
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26 import org.mockito.runners.MockitoJUnitRunner;
27 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder;
28 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutput;
29 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder;
30 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
31 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder;
32 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
33 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder;
34 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder;
35 import org.opendaylight.yangtools.yang.common.RpcResult;
37 import static org.junit.Assert.assertEquals;
38 import static org.junit.Assert.fail;
40 @RunWith(MockitoJUnitRunner.class)
41 public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderTest {
44 public void testNetworkTopologyOperation() {
46 NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder();
48 SdncRequestHeaderBuilder sdncRequestHeaderBuilder = new SdncRequestHeaderBuilder();
49 sdncRequestHeaderBuilder.setSvcRequestId("1111");
50 sdncRequestHeaderBuilder.setSvcAction(SvcAction.Create);
51 inputBuilder.setSdncRequestHeader(sdncRequestHeaderBuilder.build());
53 RequestInformationBuilder requestInformationBuilder = new RequestInformationBuilder();
54 requestInformationBuilder.setRequestId("1111");
55 requestInformationBuilder.setRequestAction(RequestInformation.RequestAction.CreateNetworkInstance);
56 inputBuilder.setRequestInformation(requestInformationBuilder.build());
58 ServiceInformationBuilder serviceInformationBuilder = new ServiceInformationBuilder();
59 serviceInformationBuilder.setServiceInstanceId("1111");
60 inputBuilder.setServiceInformation(serviceInformationBuilder.build());
62 NetworkInformationBuilder networkInformationBuilder = new NetworkInformationBuilder();
63 inputBuilder.setNetworkInformation(networkInformationBuilder.build());
65 java.util.concurrent.Future<RpcResult<NetworkTopologyOperationOutput>> future = genericResourceApiProvider
66 .networkTopologyOperation(inputBuilder.build());
67 RpcResult<NetworkTopologyOperationOutput> rpcResult = null;
69 rpcResult = future.get();
70 } catch (Exception e) {
73 LOG.info("result: {}", rpcResult);
74 assertEquals("1111", rpcResult.getResult().getSvcRequestId());