import org.opendaylight.transportpce.tapi.utils.TapiConnectivityDataUtils;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
import org.opendaylight.transportpce.tapi.utils.TapiInitialORMapping;
+import org.opendaylight.transportpce.tapi.utils.TapiLink;
import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceOutput;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public static ConnectivityUtils connectivityUtils;
public static TapiInitialORMapping tapiInitialORMapping;
public static NetworkTransactionService networkTransactionService;
+ public static TapiLink tapilink;
private ListeningExecutorService executorService;
private CountDownLatch endSignal;
private static final int NUM_THREADS = 5;
- private boolean callbackRan;
@Before
public void setUp() throws InterruptedException, ExecutionException {
TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
TapiTopologyDataUtils.PORTMAPPING_FILE);
- callbackRan = false;
MockitoAnnotations.openMocks(this);
networkTransactionService = new NetworkTransactionImpl(
new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
+ tapilink = new TapiLink(networkTransactionService);
serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker());
tapiContext = new TapiContext(networkTransactionService);
- topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker());
- connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext);
+ topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker(),
+ tapilink);
+ connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext,
+ networkTransactionService);
tapiInitialORMapping = new TapiInitialORMapping(topologyUtils, connectivityUtils,
tapiContext, serviceDataStoreOperations);
tapiInitialORMapping.performTopoInitialMapping();
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(new CreateConnectivityServiceInputBuilder().build());
result.addListener(new Runnable() {
@Override
public void run() {
- callbackRan = true;
endSignal.countDown();
}
}, executorService);
endSignal.await();
RpcResult<CreateConnectivityServiceOutput> rpcResult = result.get();
- Assert.assertEquals(
- RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
}
@Test
Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(input);
result.addListener(new Runnable() {
@Override
public void run() {
- callbackRan = true;
endSignal.countDown();
}
}, executorService);
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(new DeleteConnectivityServiceInputBuilder().build());
result.addListener(new Runnable() {
@Override
public void run() {
- callbackRan = true;
endSignal.countDown();
}
}, executorService);
endSignal.await();
RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
- Assert.assertEquals(
- RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
}
@Test
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(input);
result.addListener(new Runnable() {
@Override
public void run() {
- callbackRan = true;
endSignal.countDown();
}
}, executorService);
endSignal.await();
RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
- Assert.assertEquals(
- RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
}
@Test
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ServiceCreateInput createInput = TapiConnectivityDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
result.addListener(new Runnable() {
@Override
public void run() {
- callbackRan = true;
endSignal.countDown();
}
}, executorService);