import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.common.InstanceIdentifiers;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.pce.service.PathComputationService;
import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
import org.opendaylight.transportpce.servicehandler.listeners.NetworkListener;
import org.opendaylight.transportpce.servicehandler.listeners.PceListener;
import org.opendaylight.transportpce.servicehandler.listeners.RendererListener;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiPceNotificationHandler;
+import org.opendaylight.transportpce.tapi.listeners.TapiRendererNotificationHandler;
+import org.opendaylight.transportpce.tapi.listeners.TapiServiceNotificationHandler;
import org.opendaylight.transportpce.tapi.topology.TopologyUtils;
import org.opendaylight.transportpce.tapi.utils.TapiConnectivityDataUtils;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
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.rev211210.OrgOpenroadmServiceService;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OrgOpenroadmServiceService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.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;
@Mock
private NotificationPublishService notificationPublishService;
@Mock
- private TapiPceListenerImpl tapipceListenerImpl;
+ private TapiPceNotificationHandler tapipceNotificationHandler;
@Mock
- private TapiRendererListenerImpl tapirendererListenerImpl;
+ private TapiRendererNotificationHandler tapirendererNotificationHandler;
@Mock
- private TapiServiceHandlerListenerImpl tapiserviceHandlerListenerImpl;
+ private TapiServiceNotificationHandler tapiserviceNotificationHandler;
@Mock
private PceListener pceListenerImpl;
@Mock
private RendererListener rendererListenerImpl;
@Mock
private NetworkListener networkModelListenerImpl;
+ @Mock
+ public CatalogDataStoreOperations catalogDataStoreOperations;
+ @Mock
+ private RpcProviderService rpcProviderService;
private static final Logger LOG = LoggerFactory.getLogger(TapiConnectivityImplTest.class);
private static ServiceDataStoreOperations serviceDataStoreOperations;
@Test
void createConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
- OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(pathComputationService,
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(rpcProviderService, pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
- networkModelListenerImpl, serviceDataStoreOperations);
+ networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(new CreateConnectivityServiceInputBuilder().build());
@Test
void createConnServiceShouldBeSuccessfulWhenPerformPCESuccessful()
throws ExecutionException, InterruptedException {
- OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(pathComputationService,
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(rpcProviderService, pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
- networkModelListenerImpl, serviceDataStoreOperations);
+ networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
CreateConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceCreateInput();
when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(input);
result.addListener(new Runnable() {
@Test
void deleteConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
- OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(pathComputationService,
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(rpcProviderService, pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
- networkModelListenerImpl, serviceDataStoreOperations);
+ networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(new DeleteConnectivityServiceInputBuilder().build());
@Test
void deleteConnServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
DeleteConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceDeleteInput1();
- OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(pathComputationService,
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(rpcProviderService, pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
- networkModelListenerImpl, serviceDataStoreOperations);
+ networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(input);
result.addListener(new Runnable() {
void deleteConnServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
- OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(pathComputationService,
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(rpcProviderService, pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
- networkModelListenerImpl, serviceDataStoreOperations);
+ networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ServiceCreateInput createInput = TapiConnectivityDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);