import org-openroadm-common-state-types {
prefix org-openroadm-common-state-types;
}
+ import org-openroadm-resource {
+ prefix org-openroadm-resource;
+ }
import tapi-common {
prefix tapi-common;
revision-date 2018-12-10;
"Implement new models, RPC for TAPI service notification";
}
+ revision 2023-07-26 {
+ description
+ "Adding service-rpc-result data details to the publish-notification-process-service";
+ }
+
revision 2021-08-13 {
description
"Rename the groupings, containers and RPCs";
description
"Operational State: Actual state of service";
}
+ leaf is-temp-service {
+ type boolean;
+ default "false";
+ description
+ "Used to indicate if the it is a temp-service or not";
+ }
+ container aToZ {
+ when "../is-temp-service = 'true'" {
+ description
+ "a-to-z is only used for temp-service-cerate";
+ }
+ uses org-openroadm-resource:common-och-otsi-attributes;
+ uses org-openroadm-resource:path-computation-outputs;
+ }
+ container zToA {
+ when "../is-temp-service = 'true'" {
+ description
+ "a-to-z is only used for temp-service-cerate";
+ }
+ uses org-openroadm-resource:common-och-otsi-attributes;
+ uses org-openroadm-resource:path-computation-outputs;
+ }
}
-
grouping notification-alarm-service {
leaf message {
type string;
package org.opendaylight.transportpce.dmaap.client.impl;
import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsListenerImpl;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsHandler;
+import org.opendaylight.yangtools.concepts.Registration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
}
private static final Logger LOG = LoggerFactory.getLogger(DmaapClientProvider.class);
- private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
+ private Registration listenerRegistration;
@Activate
public DmaapClientProvider(@Reference NotificationService notificationService, Configuration config) {
public DmaapClientProvider(NotificationService notificationService, String baseUrl,
String username, String password) {
- listenerRegistration = notificationService.registerNotificationListener(
- new NbiNotificationsListenerImpl(baseUrl, username, password));
+ final var listener = new NbiNotificationsHandler(baseUrl, username, password);
+ listenerRegistration = notificationService.registerCompositeListener(listener.getCompositeListener());
LOG.info("DmaapClientProvider Session Initiated");
}
*/
package org.opendaylight.transportpce.dmaap.client.listener;
+import java.util.Set;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import org.glassfish.jersey.client.proxy.WebResourceFactory;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.logging.LoggingFeature;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.transportpce.dmaap.client.resource.EventsApi;
import org.opendaylight.transportpce.dmaap.client.resource.config.JsonConfigurator;
import org.opendaylight.transportpce.dmaap.client.resource.model.CreatedEvent;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationService;
+import org.opendaylight.yangtools.concepts.Registration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NbiNotificationsListenerImpl implements NbiNotificationsListener {
- private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsListenerImpl.class);
+public class NbiNotificationsHandler {
+ private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsHandler.class);
private String topic = "unauthenticated.TPCE";
private EventsApi api;
+ private Registration reg;
- public NbiNotificationsListenerImpl(String baseUrl, String username, String password) {
+ public NbiNotificationsHandler(String baseUrl, String username, String password) {
LOG.info("Dmaap server {} for user {}", baseUrl, username);
Client client = ClientBuilder.newClient();
if (username != null && username.isBlank() && password != null && !password.isBlank()) {
}
- @Override
- public void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(
+ PublishNotificationProcessService.class, this::onPublishNotificationProcessService),
+ new CompositeListener.Component<>(
+ PublishNotificationAlarmService.class, this::onPublishNotificationAlarmService),
+ new CompositeListener.Component<>(
+ PublishTapiNotificationService.class, this::onPublishTapiNotificationService)
+ ));
+ }
+
+ void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
try {
CreatedEvent response = api.sendEvent(topic, notification);
LOG.info("Response received {}", response);
}
- @Override
- public void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) {
+ private void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) {
}
- @Override
- public void onPublishTapiNotificationService(PublishTapiNotificationService notification) {
+ private void onPublishTapiNotificationService(PublishTapiNotificationService notification) {
}
}
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.opendaylight.transportpce.dmaap.client.resource.model.CreatedEvent;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
@Path("/events")
public interface EventsApi {
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.endpoint.TxDirection;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.lgx.Lgx;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.port.Port;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEnd;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEnd;
//This class is a temporary workaround while waiting jackson
//support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
// This class is a temporary workaround while waiting jackson
// support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEnd;
// This class is a temporary workaround while waiting jackson
// support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEnd;
// This class is a temporary workaround while waiting jackson
// support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsListenerImpl;
public class DmaapClientProviderTest {
void testInitRegisterNbiNotificationsToRpcRegistry() {
new DmaapClientProvider(notificationService, "http://localhost", "username", "password");
verify(notificationService, times(1))
- .registerNotificationListener(Mockito.any(NbiNotificationsListenerImpl.class));
+ .registerCompositeListener(Mockito.any(NotificationService.CompositeListener.class));
}
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.endpoint.TxDirectionKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEndBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.LoggerFactory;
-public class NbiNotificationsListenerImplTest extends JerseyTest {
+public class NbiNotificationsHandlerTest extends JerseyTest {
@Override
protected Application configure() {
enable(TestProperties.LOG_TRAFFIC);
@Test
void onPublishNotificationServiceTest() {
- Logger logger = (Logger) LoggerFactory.getLogger(NbiNotificationsListenerImpl.class);
+ Logger logger = (Logger) LoggerFactory.getLogger(NbiNotificationsHandler.class);
ListAppender<ILoggingEvent> listAppender = new ListAppender<>();
listAppender.start();
logger.addAppender(listAppender);
- NbiNotificationsListener listener = new NbiNotificationsListenerImpl("http://localhost:9998", null, null);
+ NbiNotificationsHandler listener = new NbiNotificationsHandler("http://localhost:9998", null, null);
PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
.setCommonId("CommonId")
.setMessage("Service implemented")
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
import org.opendaylight.transportpce.tapi.impl.TapiProvider;
-import org.opendaylight.transportpce.tapi.listeners.TapiNetworkModelListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiNetworkModelNotificationHandler;
import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelService;
import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelServiceImpl;
import org.opendaylight.transportpce.tapi.topology.TapiNetworkUtilsImpl;
new TapiNetworkUtilsImpl(lgServRPS, networkTransaction, tapiLink);
tapiProvider = initTapi(
lightyServices, servicehandler, networkTransaction, serviceDataStoreOperations,
- new TapiNetworkModelListenerImpl(
+ new TapiNetworkModelNotificationHandler(
networkTransaction, lgServBNPS),
tapiLink,
new TapiNetworkModelServiceImpl(
private TapiProvider initTapi(
LightyServices lightyServices, OrgOpenroadmServiceService servicehandler,
NetworkTransactionService networkTransactionService, ServiceDataStoreOperations serviceDataStoreOperations,
- TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl, TapiLink tapiLink,
+ TapiNetworkModelNotificationHandler tapiNetworkModelNotificationHandler, TapiLink tapiLink,
TapiNetworkModelService tapiNetworkModelService) {
return new TapiProvider(
lightyServices.getBindingDataBroker(), lightyServices.getRpcProviderService(),
lightyServices.getNotificationService(), lightyServices.getBindingNotificationPublishService(),
networkTransactionService, servicehandler, serviceDataStoreOperations,
- tapiNetworkModelListenerImpl, tapiNetworkModelService);
+ tapiNetworkModelNotificationHandler, tapiNetworkModelService);
}
private void initRenderer(
.$YangModuleInfoImpl.getInstance(),
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.$YangModuleInfoImpl
.getInstance(),
- org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.$YangModuleInfoImpl
+ org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.$YangModuleInfoImpl
.getInstance());
private static final Set<YangModuleInfo> TPCE_YANG_MODEL = Stream.concat(
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <version>1.5.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceDeserializer;
import org.opendaylight.transportpce.nbinotifications.serialization.TapiNotificationDeserializer;
import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceInput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceInput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsAlarmServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsAlarmServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsProcessServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsProcessServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1;
import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
-import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
+import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsHandler;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yangtools.concepts.Registration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsProvider.class);
private static Map<String, Publisher<NotificationProcessService>> publishersServiceMap = new HashMap<>();
private static Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap = new HashMap<>();
- private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
+ private Registration listenerRegistration;
private Registration rpcRegistration;
@Activate
NbiNotificationsImpl nbiImpl = new NbiNotificationsImpl(converterService, converterAlarmService,
converterTapiService, subscriberServer, networkTransactionService, topicManager);
rpcRegistration = rpcProviderService.registerRpcImplementations(nbiImpl.registerRPCs());
- NbiNotificationsListenerImpl nbiNotificationsListener = new NbiNotificationsListenerImpl(
- topicManager.getProcessTopicMap(), topicManager.getAlarmTopicMap(), topicManager.getTapiTopicMap());
- listenerRegistration = notificationService.registerNotificationListener(nbiNotificationsListener);
- topicManager.setNbiNotificationsListener(nbiNotificationsListener);
+ NbiNotificationsHandler notificationsListener = new NbiNotificationsHandler(
+ topicManager.getProcessTopicMap(), topicManager.getAlarmTopicMap(), topicManager.getTapiTopicMap());
+ listenerRegistration = notificationService.registerCompositeListener(
+ notificationsListener.getCompositeListener());
+ topicManager.setNbiNotificationsListener(notificationsListener);
LOG.info("NbiNotificationsProvider Session Initiated");
}
package org.opendaylight.transportpce.nbinotifications.listener;
import java.util.Map;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
import org.opendaylight.transportpce.nbinotifications.utils.NbiNotificationsUtils;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationService;
+import org.opendaylight.yangtools.concepts.Registration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NbiNotificationsListenerImpl implements NbiNotificationsListener {
- private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsListenerImpl.class);
+public class NbiNotificationsHandler {
+ private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsHandler.class);
private Map<String, Publisher<NotificationProcessService>> publishersServiceMap;
private Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap;
private Map<String, Publisher<NotificationTapiService>> tapiPublisherMap;
+ private Registration reg;
- public NbiNotificationsListenerImpl(Map<String, Publisher<NotificationProcessService>> publishersServiceMap,
+ public NbiNotificationsHandler(Map<String, Publisher<NotificationProcessService>> publishersServiceMap,
Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap,
Map<String, Publisher<NotificationTapiService>> tapiPublisherMap) {
this.publishersServiceMap = publishersServiceMap;
this.tapiPublisherMap = tapiPublisherMap;
}
- @Override
- public void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(
+ PublishNotificationProcessService.class, this::onPublishNotificationProcessService),
+ new CompositeListener.Component<>(
+ PublishNotificationAlarmService.class, this::onPublishNotificationAlarmService),
+ new CompositeListener.Component<>(
+ PublishTapiNotificationService.class, this::onPublishTapiNotificationService)
+ ));
+ }
+
+ void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
LOG.info("Receiving request for publishing notification service");
String publisherName = notification.getPublisherName();
if (!publishersServiceMap.containsKey(publisherName)) {
return;
}
Publisher<NotificationProcessService> publisher = publishersServiceMap.get(publisherName);
- publisher.sendEvent(new NotificationProcessServiceBuilder()
+ NotificationProcessServiceBuilder notificationProcessServiceBuilder = new NotificationProcessServiceBuilder()
.setCommonId(notification.getCommonId())
.setConnectionType(notification.getConnectionType())
.setMessage(notification.getMessage())
.setResponseFailed(notification.getResponseFailed())
.setServiceAEnd(notification.getServiceAEnd())
.setServiceName(notification.getServiceName())
- .setServiceZEnd(notification.getServiceZEnd())
- .build(), notification.getConnectionType().getName());
+ .setServiceZEnd(notification.getServiceZEnd());
+
+ if (notification.getIsTempService()) {
+ // A-to-Z and Z-to-A containers are only needed for temp-service-create notification
+ publisher.sendEvent(notificationProcessServiceBuilder
+ .setAToZ(notification.getAToZ())
+ .setZToA(notification.getZToA())
+ .build(), notification.getConnectionType().getName());
+ } else {
+ publisher.sendEvent(notificationProcessServiceBuilder
+ .build(), notification.getConnectionType().getName());
+ }
}
- @Override
- public void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) {
+ void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) {
LOG.info("Receiving request for publishing notification alarm service");
String publisherName = notification.getPublisherName();
if (!publishersAlarmMap.containsKey(publisherName)) {
.build(), "alarm" + notification.getConnectionType().getName());
}
- @Override
- public void onPublishTapiNotificationService(PublishTapiNotificationService notification) {
+ void onPublishTapiNotificationService(PublishTapiNotificationService notification) {
LOG.info("Receiving request for publishing TAPI notification");
String topic = notification.getTopic();
if (!tapiPublisherMap.containsKey(topic)) {
import java.util.Map;
import org.apache.kafka.common.serialization.Deserializer;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
import java.util.Map;
import org.apache.kafka.common.serialization.Serializer;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
import java.util.Map;
import org.apache.kafka.common.serialization.Deserializer;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
return null;
}
LOG.info("Reading event {}", mappedString);
- return new NotificationsProcessServiceBuilder()
+ NotificationsProcessServiceBuilder notificationsProcessServiceBuilder = new NotificationsProcessServiceBuilder()
.setCommonId(mappedString.getCommonId())
.setConnectionType(mappedString.getConnectionType())
.setMessage(mappedString.getMessage())
.setResponseFailed(mappedString.getResponseFailed())
.setServiceName(mappedString.getServiceName())
.setServiceAEnd(mappedString.getServiceAEnd())
- .setServiceZEnd(mappedString.getServiceZEnd())
- .build();
+ .setServiceZEnd(mappedString.getServiceZEnd());
+ if (mappedString.getIsTempService()) {
+ return notificationsProcessServiceBuilder
+ .setAToZ(mappedString.getAToZ())
+ .setZToA(mappedString.getZToA())
+ .build();
+ }
+ return notificationsProcessServiceBuilder.build();
}
}
import java.util.Map;
import org.apache.kafka.common.serialization.Serializer;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
import java.util.Map;
import org.apache.kafka.common.serialization.Deserializer;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
}
String value = new String(data, StandardCharsets.UTF_8);
// The message published is
- // org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService
+ // org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService
// we have to map it to
// org.opendaylight.yang.gen.v1
// .urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.Notification
LOG.info("Transforming TAPI notification for getNotificationList rpc");
Map<AdditionalInfoKey, AdditionalInfo> addInfoMap = new HashMap<>();
if (mappedString.getAdditionalInfo() != null) {
- for (org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfo
+ for (org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.AdditionalInfo
addInfo:mappedString.getAdditionalInfo().values()) {
AdditionalInfo transAddInfo = new AdditionalInfoBuilder()
.setValue(addInfo.getValue())
Map<ChangedAttributesKey, ChangedAttributes> changedAttMap = new HashMap<>();
if (mappedString.getChangedAttributes() != null) {
for (org.opendaylight.yang.gen.v1
- .nbi.notifications.rev211013.notification.tapi.service.ChangedAttributes changedAtt:mappedString
+ .nbi.notifications.rev230726.notification.tapi.service.ChangedAttributes changedAtt:mappedString
.getChangedAttributes().values()) {
ChangedAttributes transChangedAtt = new ChangedAttributesBuilder(changedAtt).build();
changedAttMap.put(transChangedAtt.key(), transChangedAtt);
Map<TargetObjectNameKey, TargetObjectName> targetObjNameMap = new HashMap<>();
if (mappedString.getTargetObjectName() != null) {
for (org.opendaylight.yang.gen.v1
- .nbi.notifications.rev211013.notification.tapi.service.TargetObjectName
+ .nbi.notifications.rev230726.notification.tapi.service.TargetObjectName
targetObjectName:mappedString.getTargetObjectName().values()) {
TargetObjectName transTargetObjName = new TargetObjectNameBuilder(targetObjectName).build();
targetObjNameMap.put(transTargetObjName.key(), transTargetObjName);
import java.util.Map;
import org.apache.kafka.common.serialization.Serializer;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
import java.util.Properties;
import java.util.function.Function;
import java.util.stream.Collectors;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfo;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfoBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfoKey;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AlarmInfoBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributes;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributesBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributesKey;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectName;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectNameBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectNameKey;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TcaInfoBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.AdditionalInfo;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.AdditionalInfoBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.AdditionalInfoKey;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.AlarmInfoBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.ChangedAttributes;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.ChangedAttributesBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.ChangedAttributesKey;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.TargetObjectName;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.TargetObjectNameBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.TargetObjectNameKey;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.tapi.service.TcaInfoBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
import org.slf4j.Logger;
import java.util.HashMap;
import java.util.Map;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
+import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsHandler;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
import org.opendaylight.transportpce.nbinotifications.serialization.TapiNotificationSerializer;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private Map<String, Publisher<NotificationTapiService>> tapiPublisherMap = new HashMap<>();
private String publisherServer;
private JsonStringConverter<NotificationTapiService> tapiConverter;
- private NbiNotificationsListenerImpl nbiNotificationsListener;
+ private NbiNotificationsHandler nbiNotificationsListener;
private Map<String, Publisher<NotificationAlarmService>> alarmPublisherMap = new HashMap<>();
private Map<String, Publisher<NotificationProcessService>> processPublisherMap = new HashMap<>();
private JsonStringConverter<NotificationProcessService> processConverter;
return instance;
}
- public void setNbiNotificationsListener(NbiNotificationsListenerImpl nbiNotificationsListener) {
+ public void setNbiNotificationsListener(NbiNotificationsHandler nbiNotificationsListener) {
this.nbiNotificationsListener = nbiNotificationsListener;
}
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.nbinotifications.utils.NotificationServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.Notification;
public class SubscriberTest extends AbstractTest {
import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ConnectionType;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsAlarmServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsProcessServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationListInputBuilder;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
-import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
import org.opendaylight.transportpce.test.AbstractTest;
public class NbiNotificationsProviderTest extends AbstractTest {
networkTransactionService);
verify(rpcProviderRegistry, times(1)).registerRpcImplementations(any());
verify(notificationService, times(1))
- .registerNotificationListener(any(NbiNotificationsListenerImpl.class));
+ .registerCompositeListener(any(NotificationService.CompositeListener.class));
}
}
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationServiceBuilder;
-public class NbiNotificationsListenerImplTest extends AbstractTest {
+public class NbiNotificationsHandlerTest extends AbstractTest {
@Mock
private Publisher<NotificationProcessService> publisherService;
@Mock
@Test
void onPublishNotificationServiceTest() {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
.setPublisherName("test")
.setCommonId("commonId")
.setConnectionType(ConnectionType.Service)
+ .setIsTempService(false)
.setMessage("Service deleted")
.setOperationalState(State.OutOfService)
.setServiceName("service name")
@Test
void onPublishNotificationServiceWrongPublisherTest() {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
.setPublisherName("wrongPublisher")
@Test
void onPublishNotificationAlarmServiceTest() {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
.setPublisherName("test")
@Test
void onPublishNotificationAlarmServiceWrongPublisherTest() {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
.setPublisherName("wrongPublisher")
@Test
void onPublishTapiNotificationServiceTest() throws ExecutionException, InterruptedException {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishTapiNotificationService notification
@Test
void onPublishTapiNotificationServiceTestWrongPublisherTest() {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishTapiNotificationService notification
= new PublishTapiNotificationServiceBuilder(NotificationServiceDataUtils.buildReceivedTapiAlarmEvent())
@Test
void getTapiPublisherFromTopicTest() {
- NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ NbiNotificationsHandler listener = new NbiNotificationsHandler(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
assertNull(listener.getTapiPublisherFromTopic("toto"));
assertEquals(publisherTapiService, listener.getTapiPublisherFromTopic("test"));
import org.opendaylight.transportpce.nbinotifications.utils.NotificationServiceDataUtils;
import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.create.notification.subscription.service.input.SubscriptionFilter;
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmService;
public class NotificationAlarmServiceDeserializerTest extends AbstractTest {
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
+import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
+import org.skyscreamer.jsonassert.JSONAssert;
public class NotificationAlarmServiceSerializerTest extends AbstractTest {
@Test
- void serializeTest() throws IOException {
+ void serializeTest() throws IOException, JSONException {
JsonStringConverter<NotificationAlarmService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/event_alarm_service.json"));
String expectedJson = Files.readString(Paths.get("src/test/resources/expected_event_alarm_service.json"));
// Minify the json string
expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
- assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), "The event should be equals");
+ JSONAssert.assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), true);
}
}
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessService;
public class NotificationServiceDeserializerTest extends AbstractTest {
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
+import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
+import org.skyscreamer.jsonassert.JSONAssert;
public class NotificationServiceSerializerTest extends AbstractTest {
@Test
- void serializeTest() throws IOException {
+ void serializeTest() throws IOException, JSONException {
JsonStringConverter<NotificationProcessService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/event.json"));
String expectedJson = Files.readString(Paths.get("src/test/resources/expected_event.json"));
// Minify the json string
expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
- assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), "The event should be equals");
+ JSONAssert.assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), true);
}
}
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.Notification;
public class NotificationTapiServiceDeserializerTest extends AbstractTest {
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
+import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
+import org.skyscreamer.jsonassert.JSONAssert;
public class NotificationTapiServiceSerializerTest extends AbstractTest {
@Test
- void serializeTest() throws IOException {
+ void serializeTest() throws IOException, JSONException {
JsonStringConverter<NotificationTapiService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/tapi_event.json"));
String expectedJson = Files.readString(Paths.get("src/test/resources/expected_tapi_event.json"));
// Minify the json string
expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
- assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), "The event should be equals");
+ JSONAssert.assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), true);
}
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.port.PortBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ContextBuilder;
},
"service-name": "service1",
"message": "message",
- "response-failed": ""
+ "response-failed": "",
+ "is-temp-service": true,
+ "aToZ": {
+ "frequency": 196.125,
+ "width": 87.5,
+ "optical-operational-mode": "test",
+ "rx-estimated-osnr": 23.5,
+ "rx-estimated-gsnr": 23.5,
+ "max-output-power": 0.5,
+ "min-output-power": 0.5
+ },
+ "zToA": {
+ "frequency": 196.125,
+ "width": 87.5,
+ "optical-operational-mode": "test",
+ "rx-estimated-osnr": 23.5,
+ "rx-estimated-gsnr": 23.5,
+ "max-output-power": 0.5,
+ "min-output-power": 0.5
+ }
}
}
"operational-state": "inService",
"common-id": "commond-id",
"response-failed": "",
- "service-name": "service1"
+ "is-temp-service": true,
+ "service-name": "service1",
+ "aToZ": {
+ "frequency": "196.125",
+ "width": "87.5",
+ "optical-operational-mode": "test",
+ "rx-estimated-osnr": "23.5",
+ "rx-estimated-gsnr": "23.5",
+ "max-output-power": "0.5",
+ "min-output-power": "0.5"
+ },
+ "zToA": {
+ "frequency": "196.125",
+ "width": "87.5",
+ "optical-operational-mode": "test",
+ "rx-estimated-osnr": "23.5",
+ "rx-estimated-gsnr": "23.5",
+ "max-output-power": "0.5",
+ "min-output-power": "0.5"
+ }
}
}
\ No newline at end of file
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.pce.resource.resource.resource.TerminationPoint;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.Rpc;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEndBuilder;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
.setServiceZEnd(new ServiceZEndBuilder(tempServiceList.getServiceZEnd()).build())
.setCommonId(tempServiceList.getCommonId())
.setConnectionType(tempServiceList.getConnectionType())
+ .setIsTempService(true)
.setPublisherName(PUBLISHER);
} else {
Services service = serviceDataStoreOperations.getService(input.getServiceName()).orElseThrow();
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setCommonId(service.getCommonId())
+ .setIsTempService(false)
.setConnectionType(service.getConnectionType())
.setPublisherName(PUBLISHER);
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.rpc.result.PathComputationResultBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.rpc.result.path.computation.result.AToZBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.rpc.result.path.computation.result.ZToABuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service.ServiceZEndBuilder;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setCommonId(service.getCommonId())
+ .setIsTempService(false)
.setConnectionType(service.getConnectionType())
.setResponseFailed("Renderer service delete failed !")
.setMessage("ServiceDelete request failed ...")
updateOtnTopology(notification, false);
PublishNotificationProcessServiceBuilder nbiNotificationBuilder =
new PublishNotificationProcessServiceBuilder()
- .setServiceName(input.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
- .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType())
.setPublisherName(PUBLISHER);
String serviceTemp = "";
if (tempService) {
+ nbiNotificationBuilder.setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType());
+ nbiNotificationBuilder.setIsTempService(true);
+ if (input.getServiceName() != null) {
+ nbiNotificationBuilder.setServiceName(input.getServiceName());
+ }
OperationResult operationResult = this.serviceDataStoreOperations.modifyTempService(
serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
serviceTemp = "Temp ";
if (operationResult.isSuccess()) {
+ ServiceRpcResult serviceRpcResult =
+ sendServiceRpcResultNotification(notification, ServiceNotificationTypes.ServiceCreateResult);
sendNbiNotification(nbiNotificationBuilder
.setResponseFailed("")
- .setMessage("Temp Service implemented !")
+ .setMessage("Temp Service implemented")
+ .setAToZ(
+ new org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service
+ .AToZBuilder()
+ .setFrequency(serviceRpcResult.getPathComputationResult().getAToZ().getFrequency())
+ .setWidth(serviceRpcResult.getPathComputationResult().getAToZ().getWidth())
+ .setOpticalOperationalMode(serviceRpcResult.getPathComputationResult()
+ .getAToZ().getOpticalOperationalMode())
+ // TODO: add GNSR, OSNR, min/max output powers
+ .build())
+ .setZToA(
+ new org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.notification.process.service
+ .ZToABuilder()
+ .setFrequency(serviceRpcResult.getPathComputationResult().getZToA().getFrequency())
+ .setWidth(serviceRpcResult.getPathComputationResult().getZToA().getWidth())
+ .setOpticalOperationalMode(serviceRpcResult.getPathComputationResult()
+ .getZToA().getOpticalOperationalMode())
+ // TODO: add GNSR, OSNR, min/max output powers
+ .build())
.setOperationalState(State.InService)
.build());
LOG.debug("For the Temp service, sending notification on service-result-rpc");
- sendServiceRpcResultNotification(notification, ServiceNotificationTypes.ServiceCreateResult);
return;
}
} else {
- OperationResult operationResult = this.serviceDataStoreOperations.modifyService(
- serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
// Here the service is implemented and the tempService has to be deleted if present
+ nbiNotificationBuilder.setServiceName(input.getServiceName()).setConnectionType(input.getConnectionType());
+ // Make sure temp-service is false
+ nbiNotificationBuilder.setIsTempService(false);
String commonId = input.getCommonId();
if (commonId != null) {
+ nbiNotificationBuilder.setCommonId(commonId);
if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
LOG.info("Temp-service exists with the common-Id {}", commonId);
// Delete the common-id from this temp-service-list here
LOG.info("Result for temp-service-list with {} is {}", commonId, tempServiceListDelete);
}
}
-
+ OperationResult operationResult = this.serviceDataStoreOperations.modifyService(
+ serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
if (operationResult.isSuccess()) {
sendNbiNotification(nbiNotificationBuilder
.setResponseFailed("")
.setNotificationType(type)
.build();
LOG.debug("Service update in datastore OK, sending notification {}", serviceHandlerNotification);
- notificationPublishService.putNotification(
- serviceHandlerNotification);
+ notificationPublishService.putNotification(serviceHandlerNotification);
} catch (InterruptedException e) {
LOG.warn("Something went wrong while sending notification for service {}",
serviceRpcResultSp.getServiceName(), e);
}
}
- private void sendServiceRpcResultNotification(RendererRpcResultSp notification, ServiceNotificationTypes type) {
+ private ServiceRpcResult sendServiceRpcResultNotification(
+ RendererRpcResultSp notification, ServiceNotificationTypes type) {
try {
ServiceRpcResult serviceRpcResult = new ServiceRpcResultBuilder()
.setServiceName(notification.getServiceName())
.getAToZDirection()
.getWidth())
// TODO: here the optical operational mode should be set
+ // A default value is set here
+ .setOpticalOperationalMode("OR-W-400G-oFEC-63.1Gbd")
// TODO: also set the GNSR, OSNR, power values
- .setOpticalOperationalMode("test")
.build())
.setZToA(new ZToABuilder()
.setFrequency(notification
.getZToADirection()
.getWidth())
// TODO: here the optical operational mode should be set
+ // A default value is set here
+ .setOpticalOperationalMode("OR-W-400G-oFEC-63.1Gbd")
// TODO: also set the GNSR, OSNR, power values
- .setOpticalOperationalMode("test")
.build())
.build())
.build();
LOG.info("Sending the notification for service-rpc-result {}", serviceRpcResult);
- notificationPublishService.putNotification(
- serviceRpcResult);
+ notificationPublishService.putNotification(serviceRpcResult);
+ return serviceRpcResult;
} catch (InterruptedException e) {
LOG.warn("Something went wrong while sending notification for service {}",
serviceRpcResultSp.getServiceName(), e);
Thread.currentThread().interrupt();
}
+ return null;
}
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setCommonId(service.getCommonId())
.setConnectionType(service.getConnectionType())
+ .setIsTempService(false)
.setResponseFailed("Renderer implementation failed !")
.setMessage("ServiceCreate request failed ...")
.setOperationalState(service.getOperationalState())
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.delete.input.ServiceDeleteReqInfo;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.delete.input.ServiceDeleteReqInfoBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmServiceBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.ServicesBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishNotificationAlarmServiceBuilder;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
import java.util.concurrent.ExecutionException;
import org.opendaylight.transportpce.common.OperationResult;
import org.opendaylight.transportpce.common.ResponseCodes;
-import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiPceNotificationHandler;
+import org.opendaylight.transportpce.tapi.listeners.TapiRendererNotificationHandler;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
import org.opendaylight.transportpce.tapi.validation.CreateConnectivityServiceValidation;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.RpcActions;
private OrgOpenroadmServiceService serviceHandler;
private final TapiContext tapiContext;
private final ConnectivityUtils connectivityUtils;
- private TapiPceListenerImpl pceListenerImpl;
- private TapiRendererListenerImpl rendererListenerImpl;
+ private TapiPceNotificationHandler pceListenerImpl;
+ private TapiRendererNotificationHandler rendererListenerImpl;
public TapiConnectivityImpl(OrgOpenroadmServiceService serviceHandler, TapiContext tapiContext,
- ConnectivityUtils connectivityUtils, TapiPceListenerImpl pceListenerImpl,
- TapiRendererListenerImpl rendererListenerImpl) {
+ ConnectivityUtils connectivityUtils, TapiPceNotificationHandler pceListenerImpl,
+ TapiRendererNotificationHandler rendererListenerImpl) {
LOG.info("inside TapiImpl constructor");
this.serviceHandler = serviceHandler;
this.tapiContext = tapiContext;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
import org.opendaylight.transportpce.tapi.connectivity.ConnectivityUtils;
import org.opendaylight.transportpce.tapi.connectivity.TapiConnectivityImpl;
-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.TapiNetworkModelNotificationHandler;
+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.TapiNetconfTopologyListener;
import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelService;
import org.opendaylight.transportpce.tapi.topology.TapiOrLinkListener;
import org.opendaylight.transportpce.tapi.utils.TapiLink;
import org.opendaylight.transportpce.tapi.utils.TapiLinkImpl;
import org.opendaylight.transportpce.tapi.utils.TapiListener;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.TransportpcePceListener;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.Network;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.network.Nodes;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.tapinetworkutils.rev210408.TransportpceTapinetworkutilsService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OrgOpenroadmServiceService;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.ServiceInterfacePoints;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.osgi.service.component.annotations.Activate;
private final NetworkTransactionService networkTransactionService;
private final OrgOpenroadmServiceService serviceHandler;
private final ServiceDataStoreOperations serviceDataStoreOperations;
+ private ObjectRegistration<TransportpceTapinetworkutilsService> tapiNetworkutilsServiceRpcRegistration;
private List<Registration> listeners;
- private ListenerRegistration<TransportpcePceListener> pcelistenerRegistration;
- private ListenerRegistration<TransportpceRendererListener> rendererlistenerRegistration;
- private ListenerRegistration<TransportpceServicehandlerListener> servicehandlerlistenerRegistration;
- private ListenerRegistration<TapiNotificationListener> tapinetworkmodellistenerRegistration;
private List<Registration> rpcRegistrations = new ArrayList<>();
+ private Registration pcelistenerRegistration;
+ private Registration rendererlistenerRegistration;
+ private Registration servicehandlerlistenerRegistration;
+ private Registration tapinetworkmodellistenerRegistration;
@Activate
public TapiProvider(@Reference DataBroker dataBroker,
@Reference NetworkTransactionService networkTransactionService,
@Reference OrgOpenroadmServiceService serviceHandler,
@Reference ServiceDataStoreOperations serviceDataStoreOperations,
- @Reference TapiNotificationListener tapiNetworkModelListenerImpl,
+ @Reference TapiNetworkModelNotificationHandler tapiNetworkModelNotificationHandler,
@Reference TapiNetworkModelService tapiNetworkModelServiceImpl) {
this.dataBroker = dataBroker;
this.networkTransactionService = networkTransactionService;
tapiContext, this.serviceDataStoreOperations);
tapiInitialORMapping.performTopoInitialMapping();
tapiInitialORMapping.performServInitialMapping();
- TapiPceListenerImpl pceListenerImpl = new TapiPceListenerImpl(dataBroker);
- TapiRendererListenerImpl rendererListenerImpl = new TapiRendererListenerImpl(dataBroker,
+ TapiPceNotificationHandler pceListenerImpl = new TapiPceNotificationHandler(dataBroker);
+ TapiRendererNotificationHandler rendererListenerImpl = new TapiRendererNotificationHandler(dataBroker,
notificationPublishService);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(this.serviceHandler, tapiContext,
InstanceIdentifier.create(ServiceInterfacePoints.class)),
tapiListener));
// Notification Listener
- pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
- rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
- TapiServiceHandlerListenerImpl serviceHandlerListenerImpl = new TapiServiceHandlerListenerImpl(dataBroker);
+ pcelistenerRegistration = notificationService.registerCompositeListener(pceListenerImpl.getCompositeListener());
+ rendererlistenerRegistration = notificationService
+ .registerCompositeListener(rendererListenerImpl.getCompositeListener());
+ TapiServiceNotificationHandler serviceHandlerListenerImpl = new TapiServiceNotificationHandler(dataBroker);
servicehandlerlistenerRegistration = notificationService
- .registerNotificationListener(serviceHandlerListenerImpl);
+ .registerCompositeListener(serviceHandlerListenerImpl.getCompositeListener());
tapinetworkmodellistenerRegistration = notificationService
- .registerNotificationListener(tapiNetworkModelListenerImpl);
+ .registerCompositeListener(tapiNetworkModelNotificationHandler.getCompositeListener());
}
/**
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.tapi.TapiStringConstants;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationServiceBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.DateAndTime;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Notification;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationListener;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Component
-public class TapiNetworkModelListenerImpl implements TapiNotificationListener {
+@Component(service = TapiNetworkModelNotificationHandler.class)
+public class TapiNetworkModelNotificationHandler {
- private static final Logger LOG = LoggerFactory.getLogger(TapiNetworkModelListenerImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TapiNetworkModelNotificationHandler.class);
private final NetworkTransactionService networkTransactionService;
private final NotificationPublishService notificationPublishService;
private final List<ConnectivityService> connectivityServiceChanges = new ArrayList<>();
private final List<LayerProtocolName> orderedServiceLayerList;
@Activate
- public TapiNetworkModelListenerImpl(@Reference NetworkTransactionService networkTransactionService,
+ public TapiNetworkModelNotificationHandler(@Reference NetworkTransactionService networkTransactionService,
@Reference NotificationPublishService notificationPublishService) {
this.networkTransactionService = networkTransactionService;
this.notificationPublishService = notificationPublishService;
LOG.debug("TapiNetworkModelListenerImpl instantiated");
}
- @Override
- public void onNotification(Notification notification) {
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(Notification.class, this::onNotification)));
+ }
+
+ private void onNotification(Notification notification) {
LOG.info("Received network model notification {}", notification);
if (notification.getNotificationType() == NotificationType.ATTRIBUTEVALUECHANGE
&& notification.getTargetObjectType() == ObjectType.NODEEDGEPOINT) {
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.tapi.TapiStringConstants;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.TransportpcePceListener;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.Network;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TapiPceListenerImpl implements TransportpcePceListener {
+public class TapiPceNotificationHandler {
- private static final Logger LOG = LoggerFactory.getLogger(TapiPceListenerImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TapiPceNotificationHandler.class);
private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
.getBytes(Charset.forName("UTF-8"))).toString());
private Connection topConnXpdrXpdrPhtn;
private Connection topConnXpdrXpdrOdu;
- public TapiPceListenerImpl(DataBroker dataBroker) {
+ public TapiPceNotificationHandler(DataBroker dataBroker) {
this.connectionFullMap = new HashMap<>();
this.dataBroker = dataBroker;
this.networkTransactionService = new NetworkTransactionImpl(this.dataBroker);
this.topConnXpdrXpdrOdu = null;
}
- @Override
- public void onServicePathRpcResult(ServicePathRpcResult notification) {
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(ServicePathRpcResult.class, this::onServicePathRpcResult)));
+ }
+
+ private void onServicePathRpcResult(ServicePathRpcResult notification) {
if (compareServicePathRpcResult(notification)) {
LOG.warn("ServicePathRpcResult already wired !");
return;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSp;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.PublishTapiNotificationServiceBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.DateAndTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TapiRendererListenerImpl implements TransportpceRendererListener {
+public class TapiRendererNotificationHandler {
- private static final Logger LOG = LoggerFactory.getLogger(TapiRendererListenerImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TapiRendererNotificationHandler.class);
private final DataBroker dataBroker;
private Uuid serviceUuid;
private RendererRpcResultSp serviceRpcResultSp;
private final NetworkTransactionService networkTransactionService;
private final NotificationPublishService notificationPublishService;
- public TapiRendererListenerImpl(DataBroker dataBroker, NotificationPublishService notificationPublishService) {
+ public TapiRendererNotificationHandler(DataBroker dataBroker,
+ NotificationPublishService notificationPublishService) {
this.dataBroker = dataBroker;
this.networkTransactionService = new NetworkTransactionImpl(this.dataBroker);
this.notificationPublishService = notificationPublishService;
}
- @Override
- public void onRendererRpcResultSp(RendererRpcResultSp notification) {
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(RendererRpcResultSp.class, this::onRendererRpcResultSp)));
+ }
+
+ private void onRendererRpcResultSp(RendererRpcResultSp notification) {
if (compareServiceRpcResultSp(notification)) {
LOG.warn("ServiceRpcResultSp already wired !");
return;
*/
package org.opendaylight.transportpce.tapi.listeners;
+import java.util.Set;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TapiServiceHandlerListenerImpl implements TransportpceServicehandlerListener {
+public class TapiServiceNotificationHandler {
- private static final Logger LOG = LoggerFactory.getLogger(TapiServiceHandlerListenerImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TapiServiceNotificationHandler.class);
private final DataBroker dataBroker;
- public TapiServiceHandlerListenerImpl(DataBroker dataBroker) {
+ public TapiServiceNotificationHandler(DataBroker dataBroker) {
this.dataBroker = dataBroker;
+ }
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(ServiceRpcResultSh.class, this::onServiceRpcResultSh)));
}
- @Override
- public void onServiceRpcResultSh(ServiceRpcResultSh notification) {
+ private void onServiceRpcResultSh(ServiceRpcResultSh notification) {
LOG.info("Avoid dataBroker error {}", dataBroker.getClass().getCanonicalName());
}
}
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;
@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
networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(new CreateConnectivityServiceInputBuilder().build());
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() {
networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(new DeleteConnectivityServiceInputBuilder().build());
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() {
networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl);
+ tapipceNotificationHandler, tapirendererNotificationHandler);
ServiceCreateInput createInput = TapiConnectivityDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
import org.opendaylight.transportpce.tapi.impl.TapiProvider;
+import org.opendaylight.transportpce.tapi.listeners.TapiNetworkModelNotificationHandler;
import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OrgOpenroadmServiceService;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationListener;
@ExtendWith(MockitoExtension.class)
public class TapiProviderTest {
@Mock
private ServiceDataStoreOperations serviceDataStoreOperations;
@Mock
- private TapiNotificationListener tapiNetworkModelListenerImpl;
+ private TapiNetworkModelNotificationHandler tapiNetworkModelNotificationHandler;
@Mock
private TapiNetworkModelService tapiNetworkModelServiceImpl;
doReturn(emptyFluentFuture()).when(networkTransactionService).commit();
new TapiProvider(dataBroker, rpcProviderRegistry, notificationService, notificationPublishService,
networkTransactionService, serviceHandler, serviceDataStoreOperations,
- tapiNetworkModelListenerImpl, tapiNetworkModelServiceImpl);
+ tapiNetworkModelNotificationHandler, tapiNetworkModelServiceImpl);
verify(rpcProviderRegistry, times(2)).registerRpcImplementations(any());
verify(dataBroker, times(4)).registerDataTreeChangeListener(any(), any());
}
-}
\ No newline at end of file
+}
. $USE_ODL_ALT_KARAF_ENV
. ./reflectwarn.sh
cd ../$USE_ODL_ALT_KARAF_INSTALL_DIR
-mvn clean install -B -q -s ../tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true
+mvn clean install -B -q -s ../tests/odl_settings.xml -Pq
./target/assembly/ressources/post_install_for_tests.sh