This refactoring renames the models in YANG nbi-notifications file.
It also corrects a few typos, notifications and simplifies conditions.
Signed-off-by: Thierry Jiao <thierry.jiao@orange.com>
Change-Id: Ia23d44b2a158b4828b68c4a9ab2df0dcb121f034
"YANG definitions for using REST API in NBI notifications module. Copyright
(c) 2020 ORANGE and others. All rights reserved.";
+ revision 2021-08-13 {
+ description
+ "Rename the groupings, containers and RPCs";
+ }
+
revision 2021-06-28 {
description
"Implement new models, RPC for service alarms";
"Initial revision of NBI notifications";
}
- grouping notification-service {
+ grouping notification-process-service {
leaf message {
type string;
mandatory true;
}
}
- container notification-service {
+ container notification-process-service {
description
"Model used to send a notification from a service request";
- uses notification-service;
+ uses notification-process-service;
}
container notification-alarm-service {
uses notification-alarm-service;
}
- rpc get-notifications-service {
+ rpc get-notifications-process-service {
description "Get the notifications service sent by ServiceHandler through filtering connection type";
input {
leaf connection-type {
}
}
output {
- list notification-service {
- uses notification-service;
+ list notifications-process-service {
+ uses notification-process-service;
}
}
}
}
}
output {
- list notification-alarm-service {
+ list notifications-alarm-service {
uses notification-alarm-service;
}
}
}
- notification publish-notification-service {
- description "Publish the notifications service for topic";
- leaf topic {
+ notification publish-notification-process-service {
+ description "Publish the notifications service through a publisher";
+ leaf publisher-name {
type string;
mandatory true;
description
- "Topic where to send the notification service";
+ "Name of the publisher";
}
- uses notification-service;
+ uses notification-process-service;
}
notification publish-notification-alarm-service {
- description "Publish the notifications service alarm for topic";
- leaf topic {
+ description "Publish the notifications service alarm through a publisher";
+ leaf publisher-name {
type string;
mandatory true;
description
- "Topic where to send the notification service alarm";
+ "Name of the publisher";
}
uses notification-alarm-service;
}
import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsListenerImpl;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.rev210628.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
- public void onPublishNotificationService(PublishNotificationService notification) {
+ public void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
try {
CreatedEvent response = api.sendEvent(topic, notification);
LOG.info("Response received {}", response);
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.rev210628.PublishNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
@Path("/events")
public interface EventsApi {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/{topic}")
- CreatedEvent sendEvent(@PathParam("topic") String topic, PublishNotificationService event);
+ CreatedEvent sendEvent(@PathParam("topic") String topic, PublishNotificationProcessService event);
}
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.registerModule(new JavaTimeModule());
- mapper.registerModule(new PublishNotificationServiceModule());
+ mapper.registerModule(new PublishNotificationProcessServiceModule());
}
@Override
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.Lgx;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.Port;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEnd;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.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
-public class PublishNotificationServiceModule extends SimpleModule {
+public class PublishNotificationProcessServiceModule extends SimpleModule {
private static final long serialVersionUID = 1L;
- public PublishNotificationServiceModule() {
+ public PublishNotificationProcessServiceModule() {
super(PackageVersion.VERSION);
- addSerializer(PublishNotificationService.class, new PublishNotificationServiceSerializer());
+ addSerializer(PublishNotificationProcessService.class, new PublishNotificationProcessServiceSerializer());
addSerializer(Lgx.class, new LgxSerializer());
addSerializer(Port.class, new PortSerializer());
addSerializer(RxDirection.class, new RxDirectionSerializer());
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.rev210628.PublishNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
// This class is a temporary workaround while waiting jackson
// support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
-public class PublishNotificationServiceSerializer extends StdSerializer<PublishNotificationService> {
+public class PublishNotificationProcessServiceSerializer extends StdSerializer<PublishNotificationProcessService> {
private static final long serialVersionUID = 1L;
- public PublishNotificationServiceSerializer() {
- super(PublishNotificationService.class);
+ public PublishNotificationProcessServiceSerializer() {
+ super(PublishNotificationProcessService.class);
}
@Override
- public void serialize(PublishNotificationService value, JsonGenerator gen, SerializerProvider provider)
+ public void serialize(PublishNotificationProcessService value, JsonGenerator gen, SerializerProvider provider)
throws IOException {
if (value != null) {
gen.writeStartObject();
gen.writeStringField("message", value.getMessage());
gen.writeStringField("response-failed", value.getResponseFailed());
gen.writeStringField("service-name", value.getServiceName());
- gen.writeStringField("topic", value.getTopic());
+ gen.writeStringField("publisher-name", value.getPublisherName());
if (value.getOperationalState() != null) {
gen.writeStringField("operational-state", value.getOperationalState().getName());
}
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.rev210628.notification.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.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.rev210628.notification.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.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.glassfish.jersey.test.TestProperties;
import org.junit.Test;
import org.opendaylight.transportpce.dmaap.client.resource.EventsApiStub;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.LoggerFactory;
listAppender.start();
logger.addAppender(listAppender);
NbiNotificationsListener listener = new NbiNotificationsListenerImpl("http://localhost:9998", null, null);
- PublishNotificationService notification = new PublishNotificationServiceBuilder().setCommonId("CommonId")
+ PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+ .setCommonId("CommonId")
.setMessage("Service implemented")
.setOperationalState(State.InService)
- .setTopic("topic")
+ .setPublisherName("publisher")
.setConnectionType(ConnectionType.Service)
.setServiceAEnd(new ServiceAEndBuilder()
.setClli("clli")
- .setNodeId(new org.opendaylight.yang.gen.v1.http
- .org.openroadm.common.node.types.rev181130.NodeIdType("nodeidtype"))
+ .setNodeId(new NodeIdType("nodeidtype"))
.setServiceFormat(ServiceFormat.Ethernet)
.setServiceRate(Uint32.valueOf(100))
.setRxDirection(new RxDirectionBuilder().build())
.build())
.setServiceZEnd(new ServiceZEndBuilder()
.setClli("clli")
- .setNodeId(new org.opendaylight.yang.gen.v1.http
- .org.openroadm.common.node.types.rev181130.NodeIdType("nodeidtype"))
+ .setNodeId(new NodeIdType("nodeidtype"))
.setServiceFormat(ServiceFormat.Ethernet)
.setServiceRate(Uint32.valueOf(100))
.setRxDirection(new RxDirectionBuilder().build())
.setTxDirection(new TxDirectionBuilder().build())
.build())
.build();
- listener.onPublishNotificationService(notification);
- // as onPublishNotificationService is a void method, we check log message to be sur everything went well
+ listener.onPublishNotificationProcessService(notification);
+ // as onPublishNotificationService is a void method, we check log message to be sure everything went well
List<ILoggingEvent> logsList = listAppender.list;
assertEquals("Response received CreatedEvent [serverTimeMs=1, count=1]", logsList.get(1).getFormattedMessage());
/**
* List of publisher topics.
*/
- private final List<String> publisherTopicList = Arrays.asList("PceListener", "ServiceHandlerOperations",
+ private final List<String> publisherServiceList = Arrays.asList("PceListener", "ServiceHandlerOperations",
"ServiceHandler", "RendererListener");
- private final List<String> publisherTopicAlarmList = Arrays.asList("ServiceListener");
+ private final List<String> publisherAlarmList = Arrays.asList("ServiceListener");
public TransportPCEImpl(LightyServices lightyServices, boolean activateNbiNotification) {
LOG.info("Initializing transaction providers ...");
lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
ServicehandlerImpl servicehandler = new ServicehandlerImpl(lightyServices.getBindingDataBroker(),
pathComputationService, rendererServiceOperations, lightyServices.getBindingNotificationPublishService(),
- pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations, "N/A");
+ pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations);
servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(),
lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
serviceDataStoreOperations, pceListenerImpl, serviceListener, rendererListenerImpl,
if (activateNbiNotification) {
LOG.info("Creating nbi-notifications beans ...");
nbiNotificationsProvider = new NbiNotificationsProvider(
- publisherTopicList, publisherTopicAlarmList, null, null, lightyServices.getRpcProviderService(),
+ publisherServiceList, publisherAlarmList, null, null, lightyServices.getRpcProviderService(),
lightyServices.getNotificationService(), lightyServices.getAdapterContext().currentSerializer());
}
}
.getInstance(),
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.$YangModuleInfoImpl
.getInstance(),
- org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.$YangModuleInfoImpl
+ org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.$YangModuleInfoImpl
.getInstance());
private static final Set<YangModuleInfo> TPCE_YANG_MODEL = Stream.concat(
import org.opendaylight.transportpce.nbinotifications.consumer.Subscriber;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceDeserializer;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceDeserializer;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceInput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceInput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
public class NbiNotificationsImpl implements NbiNotificationsService {
private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsImpl.class);
- private final JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService> converterService;
- private final JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService> converterAlarmService;
+ private final JsonStringConverter<NotificationProcessService> converterService;
+ private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
private final String server;
- public NbiNotificationsImpl(JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService> converterService,
- JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService> converterAlarmService, String server) {
+ public NbiNotificationsImpl(JsonStringConverter<NotificationProcessService> converterService,
+ JsonStringConverter<NotificationAlarmService> converterAlarmService, String server) {
this.converterService = converterService;
this.converterAlarmService = converterAlarmService;
this.server = server;
}
@Override
- public ListenableFuture<RpcResult<GetNotificationsServiceOutput>> getNotificationsService(
- GetNotificationsServiceInput input) {
+ public ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> getNotificationsProcessService(
+ GetNotificationsProcessServiceInput input) {
LOG.info("RPC getNotificationsService received");
if (input == null || input.getIdConsumer() == null || input.getGroupId() == null) {
LOG.warn("Missing mandatory params for input {}", input);
- return RpcResultBuilder.success(new GetNotificationsServiceOutputBuilder().build()).buildFuture();
+ return RpcResultBuilder.success(new GetNotificationsProcessServiceOutputBuilder().build()).buildFuture();
}
- Subscriber<org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService,
- NotificationService> subscriber = new Subscriber<>(input.getIdConsumer(), input.getGroupId(), server,
- converterService, NotificationServiceDeserializer.class);
- List<NotificationService> notificationServiceList = subscriber
- .subscribe(input.getConnectionType().getName(), NotificationService.QNAME);
- GetNotificationsServiceOutputBuilder output = new GetNotificationsServiceOutputBuilder()
- .setNotificationService(notificationServiceList);
- return RpcResultBuilder.success(output.build()).buildFuture();
+ Subscriber<NotificationProcessService, NotificationsProcessService> subscriber = new Subscriber<>(
+ input.getIdConsumer(), input.getGroupId(), server, converterService,
+ NotificationServiceDeserializer.class);
+ List<NotificationsProcessService> notificationServiceList = subscriber
+ .subscribe(input.getConnectionType().getName(), NotificationsProcessService.QNAME);
+ return RpcResultBuilder.success(new GetNotificationsProcessServiceOutputBuilder()
+ .setNotificationsProcessService(notificationServiceList).build()).buildFuture();
}
@Override
LOG.warn("Missing mandatory params for input {}", input);
return RpcResultBuilder.success(new GetNotificationsAlarmServiceOutputBuilder().build()).buildFuture();
}
- Subscriber<org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService,
- NotificationAlarmService> subscriber = new Subscriber<>(input.getIdConsumer(), input.getGroupId(),
- server, converterAlarmService, NotificationAlarmServiceDeserializer.class);
- List<NotificationAlarmService> notificationAlarmServiceList = subscriber
- .subscribe("alarm" + input.getConnectionType().getName(), NotificationAlarmService.QNAME);
- GetNotificationsAlarmServiceOutputBuilder output = new GetNotificationsAlarmServiceOutputBuilder()
- .setNotificationAlarmService(notificationAlarmServiceList);
- return RpcResultBuilder.success(output.build()).buildFuture();
+ Subscriber<NotificationAlarmService, NotificationsAlarmService> subscriber = new Subscriber<>(
+ input.getIdConsumer(), input.getGroupId(), server, converterAlarmService,
+ NotificationAlarmServiceDeserializer.class);
+ List<NotificationsAlarmService> notificationAlarmServiceList = subscriber
+ .subscribe("alarm" + input.getConnectionType().getName(), NotificationsAlarmService.QNAME);
+ return RpcResultBuilder.success(new GetNotificationsAlarmServiceOutputBuilder()
+ .setNotificationsAlarmService(notificationAlarmServiceList).build()).buildFuture();
}
}
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.slf4j.Logger;
public class NbiNotificationsProvider {
private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsProvider.class);
- private static Map<String, Publisher<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService>> publishersServiceMap = new HashMap<>();
+ private static Map<String, Publisher<NotificationProcessService>> publishersServiceMap = new HashMap<>();
private static Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap = new HashMap<>();
-
private final RpcProviderService rpcService;
- private ObjectRegistration<NbiNotificationsService> rpcRegistration;
- private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
- private NotificationService notificationService;
- private final JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService> converterService;
+ private final NotificationService notificationService;
+ private final JsonStringConverter<NotificationProcessService> converterService;
private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
private final String subscriberServer;
+ private ObjectRegistration<NbiNotificationsService> rpcRegistration;
+ private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
- public NbiNotificationsProvider(List<String> topicsService, List<String> topicsAlarm,
+ public NbiNotificationsProvider(List<String> publishersService, List<String> publishersAlarm,
String subscriberServer, String publisherServer,
RpcProviderService rpcProviderService, NotificationService notificationService,
BindingDOMCodecServices bindingDOMCodecServices) {
this.rpcService = rpcProviderService;
this.notificationService = notificationService;
converterService = new JsonStringConverter<>(bindingDOMCodecServices);
- for (String topic: topicsService) {
- LOG.info("Creating publisher for topic {}", topic);
- publishersServiceMap.put(topic, new Publisher<>(topic, publisherServer, converterService,
- NotificationServiceSerializer.class));
+ for (String publisherService: publishersService) {
+ LOG.info("Creating publisher for the following class {}", publisherService);
+ publishersServiceMap.put(publisherService, new Publisher<>(publisherService, publisherServer,
+ converterService, NotificationServiceSerializer.class));
}
converterAlarmService = new JsonStringConverter<>(bindingDOMCodecServices);
- for (String topic: topicsAlarm) {
- LOG.info("Creating publisher for topic {}", topic);
- publishersAlarmMap.put(topic, new Publisher<>(topic, publisherServer, converterAlarmService,
- NotificationAlarmServiceSerializer.class));
+ for (String publisherAlarm: publishersAlarm) {
+ LOG.info("Creating publisher for the following class {}", publisherAlarm);
+ publishersAlarmMap.put(publisherAlarm, new Publisher<>(publisherAlarm, publisherServer,
+ converterAlarmService, NotificationAlarmServiceSerializer.class));
}
this.subscriberServer = subscriberServer;
}
* Method called when the blueprint container is destroyed.
*/
public void close() {
- for (Publisher<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService> publisher : publishersServiceMap.values()) {
+ for (Publisher<NotificationProcessService> publisher : publishersServiceMap.values()) {
publisher.close();
}
for (Publisher<NotificationAlarmService> publisherAlarm : publishersAlarmMap.values()) {
import java.util.Map;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NbiNotificationsListenerImpl implements NbiNotificationsListener {
private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsListenerImpl.class);
- private final Map<String, Publisher<NotificationService>> publishersServiceMap;
+ private final Map<String, Publisher<NotificationProcessService>> publishersServiceMap;
private final Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap;
- public NbiNotificationsListenerImpl(Map<String, Publisher<NotificationService>> publishersServiceMap,
+ public NbiNotificationsListenerImpl(Map<String, Publisher<NotificationProcessService>> publishersServiceMap,
Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap) {
this.publishersServiceMap = publishersServiceMap;
this.publishersAlarmMap = publishersAlarmMap;
}
@Override
- public void onPublishNotificationService(PublishNotificationService notification) {
+ public void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
LOG.info("Receiving request for publishing notification service");
- String topic = notification.getTopic();
- if (!publishersServiceMap.containsKey(topic)) {
- LOG.error("Unknown topic {}", topic);
+ String publisherName = notification.getPublisherName();
+ if (!publishersServiceMap.containsKey(publisherName)) {
+ LOG.error("Unknown publisher {}", publisherName);
return;
}
- Publisher<NotificationService> publisher = publishersServiceMap.get(topic);
- publisher.sendEvent(new NotificationServiceBuilder().setCommonId(notification.getCommonId())
- .setConnectionType(notification.getConnectionType()).setMessage(notification.getMessage())
+ Publisher<NotificationProcessService> publisher = publishersServiceMap.get(publisherName);
+ publisher.sendEvent(new NotificationProcessServiceBuilder()
+ .setCommonId(notification.getCommonId())
+ .setConnectionType(notification.getConnectionType())
+ .setMessage(notification.getMessage())
.setOperationalState(notification.getOperationalState())
.setResponseFailed(notification.getResponseFailed())
.setServiceAEnd(notification.getServiceAEnd())
.setServiceName(notification.getServiceName())
- .setServiceZEnd(notification.getServiceZEnd()).build(), notification.getConnectionType().getName());
+ .setServiceZEnd(notification.getServiceZEnd())
+ .build(), notification.getConnectionType().getName());
}
@Override
public void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) {
LOG.info("Receiving request for publishing notification alarm service");
- String topic = notification.getTopic();
- if (!publishersAlarmMap.containsKey(topic)) {
- LOG.error("Unknown topic {}", topic);
+ String publisherName = notification.getPublisherName();
+ if (!publishersAlarmMap.containsKey(publisherName)) {
+ LOG.error("Unknown topic {}", publisherName);
return;
}
- Publisher<NotificationAlarmService> publisherAlarm = publishersAlarmMap.get(topic);
- publisherAlarm.sendEvent(new NotificationAlarmServiceBuilder().setConnectionType(notification
- .getConnectionType())
+ Publisher<NotificationAlarmService> publisherAlarm = publishersAlarmMap.get(publisherName);
+ publisherAlarm.sendEvent(new NotificationAlarmServiceBuilder()
+ .setConnectionType(notification.getConnectionType())
.setMessage(notification.getMessage())
.setOperationalState(notification.getOperationalState())
.setServiceName(notification.getServiceName())
- .build(), "alarm" + notification.getConnectionType().getName());
+ .build(), "alarm" + notification.getConnectionType().getName());
}
}
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.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.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 org.slf4j.LoggerFactory;
-public class NotificationAlarmServiceDeserializer implements Deserializer<NotificationAlarmService> {
+public class NotificationAlarmServiceDeserializer implements Deserializer<NotificationsAlarmService> {
private static final Logger LOG = LoggerFactory.getLogger(NotificationAlarmServiceDeserializer.class);
- private JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService> converter;
+ private JsonStringConverter<NotificationAlarmService> converter;
@SuppressWarnings("unchecked")
@Override
LOG.info("Deserializer configuration {}", configs);
if (configs.containsKey(ConfigConstants.CONVERTER)
&& configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
- converter = (JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService>) configs
- .get(ConfigConstants.CONVERTER);
+ converter = (JsonStringConverter<NotificationAlarmService>) configs.get(ConfigConstants.CONVERTER);
}
}
@Override
- public NotificationAlarmService deserialize(String topic, byte[] data) {
+ public NotificationsAlarmService deserialize(String topic, byte[] data) {
if (converter == null) {
throw new IllegalArgumentException(
"Converter should be configured through configure method of deserializer");
}
String value = new String(data, StandardCharsets.UTF_8);
// The message published is
- // org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService
+ // org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService
// we have to map it to
// org.opendaylight.yang.gen
- // .v1.nbi.notifications.rev201130.get.notifications.service.output.NotificationService
- org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService mappedString = converter
- .createDataObjectFromJsonString(YangInstanceIdentifier.of(
- org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService.QNAME),
- value,
- JSONCodecFactorySupplier.RFC7951);
- if (mappedString != null) {
- LOG.info("Reading event {}", mappedString);
- return new NotificationAlarmServiceBuilder().setConnectionType(mappedString.getConnectionType())
- .setMessage(mappedString.getMessage())
- .setOperationalState(mappedString.getOperationalState())
- .setServiceName(mappedString.getServiceName())
- .build();
+ // .v1.nbi.notifications.rev210813.get.notifications.service.output.NotificationsAlarmService
+ NotificationAlarmService mappedString = converter.createDataObjectFromJsonString(
+ YangInstanceIdentifier.of(NotificationAlarmService.QNAME), value, JSONCodecFactorySupplier.RFC7951);
+ if (mappedString == null) {
+ return null;
}
- return null;
+ LOG.info("Reading event {}", mappedString);
+ return new NotificationsAlarmServiceBuilder()
+ .setConnectionType(mappedString.getConnectionType())
+ .setMessage(mappedString.getMessage())
+ .setOperationalState(mappedString.getOperationalState())
+ .setServiceName(mappedString.getServiceName())
+ .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.rev210628.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
@Override
public byte[] serialize(String topic, NotificationAlarmService data) {
if (converter == null) {
- throw new IllegalArgumentException(
- "Converter should be" + "configured through configure method of serializer");
+ throw new IllegalArgumentException("Converter should be configured through configure method of serializer");
}
if (data == null) {
return new byte[0];
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.rev210628.get.notifications.service.output.NotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.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;
import org.slf4j.LoggerFactory;
-public class NotificationServiceDeserializer implements Deserializer<NotificationService> {
+public class NotificationServiceDeserializer implements Deserializer<NotificationsProcessService> {
private static final Logger LOG = LoggerFactory.getLogger(NotificationServiceDeserializer.class);
- private JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService> converter;
+ private JsonStringConverter<NotificationProcessService> converter;
@SuppressWarnings("unchecked")
@Override
LOG.info("Deserializer configuration {}", configs);
if (configs.containsKey(ConfigConstants.CONVERTER)
&& configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
- converter = (JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService>) configs
- .get(ConfigConstants.CONVERTER);
+ converter = (JsonStringConverter<NotificationProcessService>) configs.get(ConfigConstants.CONVERTER);
}
}
@Override
- public NotificationService deserialize(String topic, byte[] data) {
+ public NotificationsProcessService deserialize(String topic, byte[] data) {
if (converter == null) {
throw new IllegalArgumentException(
"Converter should be configured through configure method of deserializer");
}
String value = new String(data, StandardCharsets.UTF_8);
// The message published is
- // org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService
+ // org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService
// we have to map it to
// org.opendaylight.yang.gen
- // .v1.nbi.notifications.rev201130.get.notifications.service.output.NotificationService
- org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService mappedString = converter
- .createDataObjectFromJsonString(YangInstanceIdentifier.of(
- org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService.QNAME),
- value,
- JSONCodecFactorySupplier.RFC7951);
- if (mappedString != null) {
- LOG.info("Reading event {}", mappedString);
- return new NotificationServiceBuilder().setCommonId(mappedString.getCommonId())
- .setConnectionType(mappedString.getConnectionType()).setMessage(mappedString.getMessage())
- .setOperationalState(mappedString.getOperationalState())
- .setResponseFailed(mappedString.getResponseFailed()).setServiceName(mappedString.getServiceName())
- .setServiceAEnd(mappedString.getServiceAEnd()).setServiceZEnd(mappedString.getServiceZEnd())
- .build();
+ // .v1.nbi.notifications.rev210813.get.notifications.service.output.NotificationService
+ NotificationProcessService mappedString = converter.createDataObjectFromJsonString(
+ YangInstanceIdentifier.of(NotificationProcessService.QNAME), value, JSONCodecFactorySupplier.RFC7951);
+ if (mappedString == null) {
+ return null;
}
- return null;
+ LOG.info("Reading event {}", mappedString);
+ return new NotificationsProcessServiceBuilder()
+ .setCommonId(mappedString.getCommonId())
+ .setConnectionType(mappedString.getConnectionType())
+ .setMessage(mappedString.getMessage())
+ .setOperationalState(mappedString.getOperationalState())
+ .setResponseFailed(mappedString.getResponseFailed())
+ .setServiceName(mappedString.getServiceName())
+ .setServiceAEnd(mappedString.getServiceAEnd())
+ .setServiceZEnd(mappedString.getServiceZEnd())
+ .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.rev210628.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NotificationServiceSerializer implements Serializer<NotificationService> {
+public class NotificationServiceSerializer implements Serializer<NotificationProcessService> {
private static final Logger LOG = LoggerFactory.getLogger(NotificationServiceSerializer.class);
- private JsonStringConverter<NotificationService> converter;
+ private JsonStringConverter<NotificationProcessService> converter;
@SuppressWarnings("unchecked")
@Override
LOG.info("Deserializer configuration {}", configs);
if (configs.containsKey(ConfigConstants.CONVERTER)
&& configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
- converter = (JsonStringConverter<NotificationService>) configs.get(ConfigConstants.CONVERTER);
+ converter = (JsonStringConverter<NotificationProcessService>) configs.get(ConfigConstants.CONVERTER);
}
}
@Override
- public byte[] serialize(String topic, NotificationService data) {
+ public byte[] serialize(String topic, NotificationProcessService data) {
if (converter == null) {
- throw new IllegalArgumentException(
- "Converter should be" + "configured through configure method of serializer");
+ throw new IllegalArgumentException("Converter should be configured through configure method of serializer");
}
if (data == null) {
return new byte[0];
}
try {
- InstanceIdentifier<NotificationService> iid = InstanceIdentifier.builder(NotificationService.class).build();
+ InstanceIdentifier<NotificationProcessService> iid = InstanceIdentifier
+ .builder(NotificationProcessService.class).build();
String serialized = converter.createJsonStringFromDataObject(iid, data, JSONCodecFactorySupplier.RFC7951);
LOG.info("Serialized event {}", serialized);
return serialized.getBytes(StandardCharsets.UTF_8);
public static Properties loadProperties(String propertyFileName) {
Properties props = new Properties();
- InputStream inputStream = NbiNotificationsUtils.class.getClassLoader()
- .getResourceAsStream(propertyFileName);
+ InputStream inputStream = NbiNotificationsUtils.class.getClassLoader().getResourceAsStream(propertyFileName);
try {
if (inputStream != null) {
props.load(inputStream);
import org.junit.Test;
import org.opendaylight.transportpce.nbinotifications.utils.NotificationServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
public class SubscriberTest extends AbstractTest {
private static final String TOPIC = "topic";
private static final int PARTITION = 0;
- private MockConsumer<String, NotificationService> mockConsumer;
- private MockConsumer<String, NotificationAlarmService> mockConsumerAlarm;
- private Subscriber<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService, NotificationService> subscriberService;
- private Subscriber<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService, NotificationAlarmService> subscriberAlarmService;
+ private MockConsumer<String, NotificationsProcessService> mockConsumer;
+ private MockConsumer<String, NotificationsAlarmService> mockConsumerAlarm;
+ private Subscriber<NotificationProcessService, NotificationsProcessService> subscriberService;
+ private Subscriber<NotificationAlarmService, NotificationsAlarmService> subscriberAlarmService;
@Before
public void setUp() {
@Test
public void subscribeServiceShouldBeSuccessful() {
// from https://www.baeldung.com/kafka-mockconsumer
- ConsumerRecord<String, NotificationService> record = new ConsumerRecord<>(
+ ConsumerRecord<String, NotificationsProcessService> record = new ConsumerRecord<>(
TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedEvent());
mockConsumer.schedulePollTask(() -> {
mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC, PARTITION)));
TopicPartition tp = new TopicPartition(TOPIC, PARTITION);
startOffsets.put(tp, 0L);
mockConsumer.updateBeginningOffsets(startOffsets);
- List<NotificationService> result = subscriberService.subscribe(TOPIC, NotificationService.QNAME);
+ List<NotificationsProcessService> result = subscriberService.subscribe(TOPIC,
+ NotificationsProcessService.QNAME);
assertEquals("There should be 1 record", 1, result.size());
assertTrue("Consumer should be closed", mockConsumer.closed());
}
@Test
public void subscribeAlarmShouldBeSuccessful() {
// from https://www.baeldung.com/kafka-mockconsumer
- ConsumerRecord<String, NotificationAlarmService> record = new ConsumerRecord<>(
+ ConsumerRecord<String, NotificationsAlarmService> record = new ConsumerRecord<>(
TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedAlarmEvent());
mockConsumerAlarm.schedulePollTask(() -> {
mockConsumerAlarm.rebalance(Collections.singletonList(new TopicPartition(TOPIC, PARTITION)));
TopicPartition tp = new TopicPartition(TOPIC, PARTITION);
startOffsets.put(tp, 0L);
mockConsumerAlarm.updateBeginningOffsets(startOffsets);
- List<NotificationAlarmService> result = subscriberAlarmService.subscribe(TOPIC, NotificationAlarmService.QNAME);
+ List<NotificationsAlarmService> result = subscriberAlarmService.subscribe(TOPIC,
+ NotificationsAlarmService.QNAME);
assertEquals("There should be 1 record", 1, result.size());
assertTrue("Consumer should be closed", mockConsumerAlarm.closed());
}
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
import org.opendaylight.yangtools.yang.common.RpcResult;
public class NbiNotificationsImplTest extends AbstractTest {
@Before
public void setUp() {
- JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationService> converter = new JsonStringConverter<>(
+ JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
getDataStoreContextUtil().getBindingDOMCodecServices());
- JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService> converterAlarm = new JsonStringConverter<>(
+ JsonStringConverter<NotificationAlarmService> converterAlarm = new JsonStringConverter<>(
getDataStoreContextUtil().getBindingDOMCodecServices());
nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm,"localhost:8080");
}
@Test
public void getNotificationsServiceEmptyDataTest() throws InterruptedException, ExecutionException {
- ListenableFuture<RpcResult<GetNotificationsServiceOutput>> result =
- nbiNotificationsImpl.getNotificationsService(new GetNotificationsServiceInputBuilder().build());
- assertNull("Should be null", result.get().getResult().getNotificationService());
+ ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
+ nbiNotificationsImpl.getNotificationsProcessService(
+ new GetNotificationsProcessServiceInputBuilder().build());
+ assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
}
@Test
public void getNotificationsServiceTest() throws InterruptedException, ExecutionException {
- GetNotificationsServiceInputBuilder builder = new GetNotificationsServiceInputBuilder()
+ GetNotificationsProcessServiceInputBuilder builder = new GetNotificationsProcessServiceInputBuilder()
.setGroupId("groupId")
.setIdConsumer("consumerId")
.setConnectionType(ConnectionType.Service);
- ListenableFuture<RpcResult<GetNotificationsServiceOutput>> result =
- nbiNotificationsImpl.getNotificationsService(builder.build());
- assertNull("Should be null", result.get().getResult().getNotificationService());
+ ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
+ nbiNotificationsImpl.getNotificationsProcessService(builder.build());
+ assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
}
@Test
.setConnectionType(ConnectionType.Service);
ListenableFuture<RpcResult<GetNotificationsAlarmServiceOutput>> result =
nbiNotificationsImpl.getNotificationsAlarmService(builder.build());
- assertNull("Should be null", result.get().getResult().getNotificationAlarmService());
+ assertNull("Should be null", result.get().getResult().getNotificationsAlarmService());
}
}
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
public class NbiNotificationsListenerImplTest extends AbstractTest {
@Mock
- private Publisher<NotificationService> publisherService;
+ private Publisher<NotificationProcessService> publisherService;
@Mock
private Publisher<NotificationAlarmService> publisherAlarm;
public void onPublishNotificationServiceTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm));
- PublishNotificationService notification = new PublishNotificationServiceBuilder().setTopic("test")
- .setCommonId("commonId").setConnectionType(ConnectionType.Service).setMessage("Service deleted")
- .setOperationalState(State.OutOfService).setServiceName("service name").build();
- listener.onPublishNotificationService(notification);
+ PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+ .setPublisherName("test")
+ .setCommonId("commonId")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("Service deleted")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
+ listener.onPublishNotificationProcessService(notification);
verify(publisherService, times(1)).sendEvent(any(), anyString());
}
@Test
- public void onPublishNotificationServiceWrongTopicTest() {
+ public void onPublishNotificationServiceWrongPublisherTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm));
- PublishNotificationService notification = new PublishNotificationServiceBuilder().setTopic("wrongtopic")
- .setCommonId("commonId").setConnectionType(ConnectionType.Service).setMessage("Service deleted")
- .setOperationalState(State.OutOfService).setServiceName("service name").build();
- listener.onPublishNotificationService(notification);
+ PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+ .setPublisherName("wrongPublisher")
+ .setCommonId("commonId")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("Service deleted")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
+ listener.onPublishNotificationProcessService(notification);
verify(publisherService, times(0)).sendEvent(any(), anyString());
}
public void onPublishNotificationAlarmServiceTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm));
- PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder().setTopic("test")
- .setConnectionType(ConnectionType.Service).setMessage("The service is now inService")
- .setOperationalState(State.OutOfService).setServiceName("service name").build();
+ PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
+ .setPublisherName("test")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("The service is now inService")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
listener.onPublishNotificationAlarmService(notification);
verify(publisherAlarm, times(1)).sendEvent(any(), anyString());
}
@Test
- public void onPublishNotificationAlarmServiceWrongTopicTest() {
+ public void onPublishNotificationAlarmServiceWrongPublisherTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm));
PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
- .setTopic("wrongtopic").setConnectionType(ConnectionType.Service)
- .setMessage("The service is now inService").setOperationalState(State.OutOfService)
- .setServiceName("service name").build();
+ .setPublisherName("wrongPublisher")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("The service is now inService")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
listener.onPublishNotificationAlarmService(notification);
verify(publisherAlarm, times(0)).sendEvent(any(), anyString());
}
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
public class PublisherTest extends AbstractTest {
- private JsonStringConverter<NotificationService> converterService;
+ private JsonStringConverter<NotificationProcessService> converterService;
private JsonStringConverter<NotificationAlarmService> converterAlarm;
- private Publisher<NotificationService> publisherService;
+ private Publisher<NotificationProcessService> publisherService;
private Publisher<NotificationAlarmService> publisherAlarm;
- private MockProducer<String, NotificationService> mockProducer;
+ private MockProducer<String, NotificationProcessService> mockProducer;
private MockProducer<String, NotificationAlarmService> mockAlarmProducer;
@Before
@Test
public void sendEventServiceShouldBeSuccessful() throws IOException {
String json = Files.readString(Paths.get("src/test/resources/event.json"));
- NotificationService notificationService = converterService
- .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationService.QNAME),
+ NotificationProcessService notificationProcessService = converterService
+ .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationProcessService.QNAME),
json, JSONCodecFactorySupplier.RFC7951);
- publisherService.sendEvent(notificationService, notificationService.getConnectionType().name());
+ publisherService.sendEvent(notificationProcessService, notificationProcessService.getConnectionType().name());
assertEquals("We should have one message", 1, mockProducer.history().size());
assertEquals("Key should be test", "test", mockProducer.history().get(0).key());
}
import org.junit.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
public class NotificationAlarmServiceDeserializerTest extends AbstractTest {
@Test
public void deserializeTest() throws IOException {
- JsonStringConverter<org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.NotificationAlarmService> converter =
+ JsonStringConverter<NotificationAlarmService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
NotificationAlarmServiceDeserializer deserializer = new NotificationAlarmServiceDeserializer();
Map<String, Object> configs = Map.of(ConfigConstants.CONVERTER, converter);
deserializer.configure(configs, false);
- NotificationAlarmService readEvent = deserializer.deserialize("Test",
+ NotificationsAlarmService readEvent = deserializer.deserialize("Test",
Files.readAllBytes(Paths.get("src/test/resources/event_alarm_service.json")));
deserializer.close();
assertEquals("Service name should be service1", "service1", readEvent.getServiceName());
import org.junit.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.junit.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
public class NotificationServiceDeserializerTest extends AbstractTest {
@Test
public void deserializeTest() throws IOException {
- JsonStringConverter<org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService> converter =
- new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
+ JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
+ getDataStoreContextUtil().getBindingDOMCodecServices());
NotificationServiceDeserializer deserializer = new NotificationServiceDeserializer();
Map<String, Object> configs = Map.of(ConfigConstants.CONVERTER, converter);
deserializer.configure(configs, false);
- NotificationService readEvent = deserializer.deserialize("Test",
+ NotificationsProcessService readEvent = deserializer.deserialize("Test",
Files.readAllBytes(Paths.get("src/test/resources/event.json")));
deserializer.close();
assertEquals("Service name should be service1", "service1", readEvent.getServiceName());
import org.junit.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
@Test
public void serializeTest() throws IOException {
- JsonStringConverter<NotificationService> converter =
+ JsonStringConverter<NotificationProcessService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/event.json"));
- NotificationService notificationService = converter
- .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationService.QNAME),
+ NotificationProcessService notificationService = converter
+ .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationProcessService.QNAME),
json, JSONCodecFactorySupplier.RFC7951);
NotificationServiceSerializer serializer = new NotificationServiceSerializer();
Map<String, Object> configs = Map.of(ConfigConstants.CONVERTER, converter);
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.LgxBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public final class NotificationServiceDataUtils {
private NotificationServiceDataUtils() {
}
- public static NotificationService buildSendEventInput() {
- NotificationServiceBuilder notificationServiceBuilder = new NotificationServiceBuilder()
+ public static NotificationProcessService buildSendEventInput() {
+ return new NotificationProcessServiceBuilder()
.setMessage("message")
.setServiceName("service1")
.setOperationalState(State.InService)
.setCommonId("commond-id")
.setConnectionType(ConnectionType.Service)
.setServiceZEnd(getServiceZEndBuild().build())
- .setServiceAEnd(getServiceAEndBuild().build());
-
- return notificationServiceBuilder.build();
+ .setServiceAEnd(getServiceAEndBuild().build())
+ .build();
}
- public static org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.get.notifications.service.output.NotificationService buildReceivedEvent() {
- org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.get.notifications.service.output.NotificationServiceBuilder
- notificationServiceBuilder = new org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.get.notifications.service.output.NotificationServiceBuilder()
+ public static NotificationsProcessService buildReceivedEvent() {
+ return new NotificationsProcessServiceBuilder()
.setMessage("message")
.setServiceName("service1")
.setOperationalState(State.InService)
.setCommonId("commond-id")
.setConnectionType(ConnectionType.Service)
.setServiceZEnd(getServiceZEndBuild().build())
- .setServiceAEnd(getServiceAEndBuild().build());
-
- return notificationServiceBuilder.build();
+ .setServiceAEnd(getServiceAEndBuild().build())
+ .build();
}
- public static org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService
- buildReceivedAlarmEvent() {
- org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmServiceBuilder
- notificationAlarmServiceBuilder = new org.opendaylight.yang.gen.v1
- .nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmServiceBuilder()
+ public static NotificationsAlarmService buildReceivedAlarmEvent() {
+ return new NotificationsAlarmServiceBuilder()
.setMessage("message")
.setServiceName("service1")
.setOperationalState(State.InService)
- .setConnectionType(ConnectionType.Service);
- return notificationAlarmServiceBuilder.build();
+ .setConnectionType(ConnectionType.Service)
+ .build();
}
public static ServiceAEndBuilder getServiceAEndBuild() {
return new ServiceAEndBuilder()
- .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
+ .setClli("clli")
+ .setServiceFormat(ServiceFormat.OC)
+ .setServiceRate(Uint32.valueOf(1))
.setNodeId(new NodeIdType("XPONDER-1-2"))
.setTxDirection(getTxDirection())
.setRxDirection(getRxDirection());
public static ServiceZEndBuilder getServiceZEndBuild() {
return new ServiceZEndBuilder()
- .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
+ .setClli("clli")
+ .setServiceFormat(ServiceFormat.OC)
+ .setServiceRate(Uint32.valueOf(1))
.setNodeId(new NodeIdType("XPONDER-1-2"))
.setTxDirection(getTxDirection())
.setRxDirection(getRxDirection());
}
private static TxDirection getTxDirection() {
- return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
- .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
- .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
- .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
- .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
- .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
+ return new TxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("device name")
+ .setPortName("port name")
+ .setPortRack("port rack")
+ .setPortShelf("port shelf")
+ .setPortSlot("port slot")
+ .setPortSubSlot("port subslot")
+ .setPortType("port type")
+ .build())
+ .setLgx(new LgxBuilder()
+ .setLgxDeviceName("lgx device name")
+ .setLgxPortName("lgx port name")
+ .setLgxPortRack("lgx port rack")
+ .setLgxPortShelf("lgx port shelf")
+ .build())
.build();
}
private static RxDirection getRxDirection() {
- return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
- .endpoint.RxDirectionBuilder()
- .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
- .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
- .setPortSubSlot("port subslot").setPortType("port type").build())
- .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
- .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
- .setLgxPortShelf("lgx port shelf").build())
+ return new RxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("device name")
+ .setPortName("port name")
+ .setPortRack("port rack")
+ .setPortShelf("port shelf")
+ .setPortSlot("port slot")
+ .setPortSubSlot("port subslot")
+ .setPortType("port type")
+ .build())
+ .setLgx(new LgxBuilder()
+ .setLgxDeviceName("lgx device name")
+ .setLgxPortName("lgx port name")
+ .setLgxPortRack("lgx port rack")
+ .setLgxPortShelf("lgx port shelf")
+ .build())
.build();
}
}
{
- "notification-service": {
+ "notification-process-service": {
"service-z-end": {
"service-format": "OC",
"node-id": "XPONDER-1-2",
{
- "notification-service": {
- "service-z-end": {
- "clli": "clli",
- "service-rate": 1,
- "node-id": "XPONDER-1-2",
- "rx-direction": {
- "lgx": {
- "lgx-port-name": "lgx port name",
- "lgx-port-shelf": "lgx port shelf",
- "lgx-port-rack": "lgx port rack",
- "lgx-device-name": "lgx device name"
+ "notification-process-service":{
+ "common-id":"commond-id",
+ "message":"message",
+ "operational-state":"inService",
+ "service-z-end":{
+ "node-id":"XPONDER-1-2",
+ "service-rate":1,
+ "clli":"clli",
+ "service-format":"OC",
+ "tx-direction":{
+ "port":{
+ "port-name":"port name",
+ "port-slot":"port slot",
+ "port-sub-slot":"port subslot",
+ "port-device-name":"device name",
+ "port-shelf":"port shelf",
+ "port-type":"port type",
+ "port-rack":"port rack"
},
- "port": {
- "port-shelf": "port shelf",
- "port-rack": "port rack",
- "port-device-name": "device name",
- "port-name": "port name",
- "port-slot": "port slot",
- "port-type": "port type",
- "port-sub-slot": "port subslot"
+ "lgx":{
+ "lgx-port-shelf":"lgx port shelf",
+ "lgx-port-rack":"lgx port rack",
+ "lgx-port-name":"lgx port name",
+ "lgx-device-name":"lgx device name"
}
},
- "service-format": "OC",
- "tx-direction": {
- "lgx": {
- "lgx-port-name": "lgx port name",
- "lgx-port-shelf": "lgx port shelf",
- "lgx-port-rack": "lgx port rack",
- "lgx-device-name": "lgx device name"
+ "rx-direction":{
+ "port":{
+ "port-name":"port name",
+ "port-slot":"port slot",
+ "port-sub-slot":"port subslot",
+ "port-device-name":"device name",
+ "port-shelf":"port shelf",
+ "port-type":"port type",
+ "port-rack":"port rack"
},
- "port": {
- "port-shelf": "port shelf",
- "port-rack": "port rack",
- "port-device-name": "device name",
- "port-name": "port name",
- "port-slot": "port slot",
- "port-type": "port type",
- "port-sub-slot": "port subslot"
+ "lgx":{
+ "lgx-port-shelf":"lgx port shelf",
+ "lgx-port-rack":"lgx port rack",
+ "lgx-port-name":"lgx port name",
+ "lgx-device-name":"lgx device name"
}
}
},
- "connection-type": "service",
- "operational-state": "inService",
- "common-id": "commond-id",
- "service-a-end": {
- "clli": "clli",
- "service-rate": 1,
- "node-id": "XPONDER-1-2",
- "rx-direction": {
- "lgx": {
- "lgx-port-name": "lgx port name",
- "lgx-port-shelf": "lgx port shelf",
- "lgx-port-rack": "lgx port rack",
- "lgx-device-name": "lgx device name"
+ "service-name":"service1",
+ "connection-type":"service",
+ "service-a-end":{
+ "node-id":"XPONDER-1-2",
+ "service-rate":1,
+ "clli":"clli",
+ "service-format":"OC",
+ "tx-direction":{
+ "port":{
+ "port-name":"port name",
+ "port-slot":"port slot",
+ "port-sub-slot":"port subslot",
+ "port-device-name":"device name",
+ "port-shelf":"port shelf",
+ "port-type":"port type",
+ "port-rack":"port rack"
},
- "port": {
- "port-shelf": "port shelf",
- "port-rack": "port rack",
- "port-device-name": "device name",
- "port-name": "port name",
- "port-slot": "port slot",
- "port-type": "port type",
- "port-sub-slot": "port subslot"
+ "lgx":{
+ "lgx-port-shelf":"lgx port shelf",
+ "lgx-port-rack":"lgx port rack",
+ "lgx-port-name":"lgx port name",
+ "lgx-device-name":"lgx device name"
}
},
- "service-format": "OC",
- "tx-direction": {
- "lgx": {
- "lgx-port-name": "lgx port name",
- "lgx-port-shelf": "lgx port shelf",
- "lgx-port-rack": "lgx port rack",
- "lgx-device-name": "lgx device name"
+ "rx-direction":{
+ "port":{
+ "port-name":"port name",
+ "port-slot":"port slot",
+ "port-sub-slot":"port subslot",
+ "port-device-name":"device name",
+ "port-shelf":"port shelf",
+ "port-type":"port type",
+ "port-rack":"port rack"
},
- "port": {
- "port-shelf": "port shelf",
- "port-rack": "port rack",
- "port-device-name": "device name",
- "port-name": "port name",
- "port-slot": "port slot",
- "port-type": "port type",
- "port-sub-slot": "port subslot"
+ "lgx":{
+ "lgx-port-shelf":"lgx port shelf",
+ "lgx-port-rack":"lgx port rack",
+ "lgx-port-name":"lgx port name",
+ "lgx-device-name":"lgx device name"
}
}
},
- "service-name": "service1",
- "response-failed": "",
- "message": "message"
+ "response-failed":""
}
}
\ No newline at end of file
{
"notification-alarm-service": {
+ "message": "The service is now inService",
"operational-state": "inService",
"service-name": "service1",
- "connection-type": "service",
- "message": "The service is now inService"
+ "connection-type": "service"
}
}
\ No newline at end of file
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfo.TailRetention;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.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.yang.common.RpcResult;
import org.slf4j.Logger;
*/
public class ServicehandlerImpl implements OrgOpenroadmServiceService {
private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
+ private static final String PUBLISHER = "ServiceHandler";
private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}";
private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}";
private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}";
private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}";
- private static final String SERVICE_FEASABILITY_CHECK_MSG = "serviceFeasabilityCheck: {}";
+ private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
private RendererListenerImpl rendererListenerImpl;
private NetworkModelListenerImpl networkModelListenerImpl;
private NotificationPublishService notificationPublishService;
- private final String topic;
//TODO: remove private request fields as they are in global scope
public ServicehandlerImpl(DataBroker databroker, PathComputationService pathComputationService,
RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
- NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations,
- String topic) {
+ NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations) {
this.db = databroker;
this.serviceDataStoreOperations = serviceDataStoreOperations;
this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
this.rendererListenerImpl = rendererListenerImpl;
this.networkModelListenerImpl = networkModelListenerImpl;
this.notificationPublishService = notificationPublishService;
- this.topic = topic;
}
PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
if (output == null) {
LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
- sendNbiNotification(new PublishNotificationServiceBuilder()
+ sendNbiNotification(new PublishNotificationProcessServiceBuilder()
.setServiceName(input.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
- .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType())
+ .setCommonId(input.getCommonId())
+ .setConnectionType(input.getConnectionType())
.setResponseFailed(LogMessages.ABORT_PCE_FAILED)
.setMessage("ServiceCreate request failed ...")
.setOperationalState(State.Degraded)
+ .setPublisherName(PUBLISHER)
.build());
return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
//Check presence of service to be deleted
Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
Services service;
- if (!serviceOpt.isPresent()) {
+ if (serviceOpt.isEmpty()) {
LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
return ModelMappingUtils.createDeleteServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
if (output == null) {
LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
- sendNbiNotification(new PublishNotificationServiceBuilder()
+ sendNbiNotification(new PublishNotificationProcessServiceBuilder()
.setServiceName(service.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
- .setCommonId(service.getCommonId()).setConnectionType(service.getConnectionType())
+ .setCommonId(service.getCommonId())
+ .setConnectionType(service.getConnectionType())
.setMessage("ServiceDelete request failed ...")
.setOperationalState(State.InService)
.setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
+ .setPublisherName(PUBLISHER)
.build());
return ModelMappingUtils.createDeleteServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
RpcActions.ServiceFeasibilityCheck);
if (! validationResult.isSuccess()) {
- LOG.warn(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
+ LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
return ModelMappingUtils.createCreateServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
- LOG.debug(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.PCE_CALLING);
+ LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
if (output == null) {
- LOG.warn(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
+ LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
}
String serviceName = input.getServiceName();
LOG.info("RPC serviceReconfigure received for {}", serviceName);
Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
- if (!servicesObject.isPresent()) {
+ if (servicesObject.isEmpty()) {
LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
return ModelMappingUtils.createCreateServiceReply(
input,
if (softConstraints == null) {
LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
- serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
} else {
LOG.info("converting hard constraints to soft constraints ...");
serviceInput.setSoftConstraints(
DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
- serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
}
+ serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
}
this.pceListenerImpl.setInput(serviceInput);
this.pceListenerImpl.setServiceReconfigure(true);
String serviceName = input.getServiceName();
LOG.info("RPC serviceReroute received for {}", serviceName);
Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
- if (!servicesObject.isPresent()) {
+ if (servicesObject.isEmpty()) {
LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
return ModelMappingUtils.createRerouteServiceReply(
input, ResponseCodes.FINAL_ACK_NO,
/*
* Upon receipt of service-deleteService RPC, service header and sdnc-request
- * header compliancy are verified.
+ * header compliance are verified.
*/
LOG.debug("checking Service Compliance ...");
ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list.Services>
service =
this.serviceDataStoreOperations.getTempService(commonId);
- if (!service.isPresent()) {
+ if (service.isEmpty()) {
LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
return ModelMappingUtils.createDeleteServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
* Send notification to NBI notification in order to publish message.
* @param service PublishNotificationService
*/
- private void sendNbiNotification(PublishNotificationService service) {
+ private void sendNbiNotification(PublishNotificationProcessService service) {
try {
notificationPublishService.putNotification(service);
} catch (InterruptedException e) {
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.RpcStatusEx;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParameters;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParametersBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PceListenerImpl implements TransportpcePceListener {
private static final Logger LOG = LoggerFactory.getLogger(PceListenerImpl.class);
- private static final String TOPIC = "PceListener";
+ private static final String PUBLISHER = "PceListener";
private ServicePathRpcResult servicePathRpcResult;
private RendererServiceOperations rendererServiceOperations;
* @return true is status is Successful, false otherwise.
*/
private boolean checkStatus(ServicePathRpcResult notification) {
- PublishNotificationService nbiNotification = getPublishNotificationService(notification);
- PublishNotificationServiceBuilder publishNotificationServiceBuilder = new PublishNotificationServiceBuilder(
- nbiNotification);
+ PublishNotificationProcessService nbiNotification = getPublishNotificationProcessService(notification);
+ PublishNotificationProcessServiceBuilder publishNotificationProcessServiceBuilder =
+ new PublishNotificationProcessServiceBuilder(nbiNotification);
switch (servicePathRpcResult.getStatus()) {
case Failed:
LOG.error("PCE path computation failed !");
- nbiNotification = publishNotificationServiceBuilder.setMessage("ServiceCreate request failed ...")
+ nbiNotification = publishNotificationProcessServiceBuilder
+ .setMessage("ServiceCreate request failed ...")
.setResponseFailed("PCE path computation failed !")
.setOperationalState(State.Degraded).build();
sendNbiNotification(nbiNotification);
default:
LOG.error("PCE path computation returned an unknown RpcStatusEx code {}",
servicePathRpcResult.getStatus());
- nbiNotification = publishNotificationServiceBuilder.setMessage("ServiceCreate request failed ...")
+ nbiNotification = publishNotificationProcessServiceBuilder
+ .setMessage("ServiceCreate request failed ...")
.setResponseFailed("PCE path computation returned an unknown RpcStatusEx code!")
.setOperationalState(State.Degraded).build();
sendNbiNotification(nbiNotification);
}
}
- private PublishNotificationService getPublishNotificationService(ServicePathRpcResult notification) {
- PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder();
+ private PublishNotificationProcessService getPublishNotificationProcessService(ServicePathRpcResult notification) {
+ PublishNotificationProcessServiceBuilder nbiNotificationBuilder =
+ new PublishNotificationProcessServiceBuilder();
if (input != null) {
nbiNotificationBuilder.setServiceName(input.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
- .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType());
+ .setCommonId(input.getCommonId())
+ .setConnectionType(input.getConnectionType());
} else {
nbiNotificationBuilder.setServiceName(notification.getServiceName());
}
- nbiNotificationBuilder.setTopic(TOPIC);
+ nbiNotificationBuilder.setPublisherName(PUBLISHER);
return nbiNotificationBuilder.build();
}
return;
}
Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
- PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder()
+ PublishNotificationProcessServiceBuilder nbiNotificationBuilder = new PublishNotificationProcessServiceBuilder()
.setServiceName(service.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setCommonId(service.getCommonId())
.setConnectionType(service.getConnectionType())
- .setTopic(TOPIC);
+ .setPublisherName(PUBLISHER);
if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) {
LOG.info("PCE cancel resource failed !");
sendNbiNotification(nbiNotificationBuilder
* Send notification to NBI notification in order to publish message.
* @param service PublishNotificationService
*/
- private void sendNbiNotification(PublishNotificationService service) {
+ private void sendNbiNotification(PublishNotificationProcessService service) {
try {
notificationPublishService.putNotification(service);
} catch (InterruptedException e) {
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.OtnLinkType;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public class RendererListenerImpl implements TransportpceRendererListener {
- private static final String TOPIC = "RendererListener";
+ private static final String PUBLISHER = "RendererListener";
private static final Logger LOG = LoggerFactory.getLogger(RendererListenerImpl.class);
private RendererRpcResultSp serviceRpcResultSp;
private ServiceDataStoreOperations serviceDataStoreOperations;
case Failed:
LOG.error("Renderer service delete failed !");
Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
- sendNbiNotification(new PublishNotificationServiceBuilder()
+ sendNbiNotification(new PublishNotificationProcessServiceBuilder()
.setServiceName(service.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setResponseFailed("Renderer service delete failed !")
.setMessage("ServiceDelete request failed ...")
.setOperationalState(service.getOperationalState())
- .setTopic(TOPIC)
+ .setPublisherName(PUBLISHER)
.build());
return;
case Pending:
updateOtnTopology(notification, false);
- PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder()
+ 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())
- .setTopic(TOPIC);
+ .setPublisherName(PUBLISHER);
OperationResult operationResult;
String serviceTemp = "";
if (tempService) {
private void onFailedServiceImplementation(String serviceName) {
LOG.error("Renderer implementation failed !");
Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
- sendNbiNotification(new PublishNotificationServiceBuilder()
+ sendNbiNotification(new PublishNotificationProcessServiceBuilder()
.setServiceName(service.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setResponseFailed("Renderer implementation failed !")
.setMessage("ServiceCreate request failed ...")
.setOperationalState(service.getOperationalState())
- .setTopic(TOPIC)
+ .setPublisherName(PUBLISHER)
.build());
OperationResult deleteServicePathOperationResult =
this.serviceDataStoreOperations.deleteServicePath(serviceName);
* Send notification to NBI notification in order to publish message.
* @param service PublishNotificationService
*/
- private void sendNbiNotification(PublishNotificationService service) {
+ private void sendNbiNotification(PublishNotificationProcessService service) {
try {
notificationPublishService.putNotification(service);
} catch (InterruptedException e) {
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServiceListener implements DataTreeChangeListener<Services> {
private static final Logger LOG = LoggerFactory.getLogger(ServiceListener.class);
- private static final String TOPIC = "ServiceListener";
+ private static final String PUBLISHER = "ServiceListener";
private final DataBroker dataBroker;
private NotificationPublishService notificationPublishService;
.setConnectionType(input.getConnectionType())
.setMessage("The service is now outOfService")
.setOperationalState(State.OutOfService)
- .setTopic(TOPIC)
+ .setPublisherName(PUBLISHER)
.build());
}
else if (rootService.getDataBefore().getOperationalState() == State.OutOfService
.setConnectionType(input.getConnectionType())
.setMessage("The service is now inService")
.setOperationalState(State.InService)
- .setTopic(TOPIC)
+ .setPublisherName(PUBLISHER)
.build());
}
break;
<argument ref="rendererListener" />
<argument ref="networkModelListener" />
<argument ref="serviceDatastoreOperation" />
- <argument value="ServiceHandler" />
</bean>
<bean id="provider"
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceCreateOutput>> result =
servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
result.addListener(new Runnable() {
@Override
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
.setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
result.addListener(new Runnable() {
@Override
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
servicehandlerImpl.serviceFeasibilityCheck(input);
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
.setCommonId("").build());
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
result.addListener(new Runnable() {
@Override
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
serviceDataStoreOperations.createTempService(createInput);
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
result.addListener(new Runnable() {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations, "ServiceHandler");
+ serviceDataStoreOperations);
ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(input);
result.addListener(new Runnable() {
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.LgxBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
@RunWith(MockitoJUnitRunner.StrictStubs.class)
}
private Services buildService(State state, AdminStates adminStates) {
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEnd
- serviceAEnd = getServiceAEndBuild()
- .build();
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
- .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1
- .http.org.openroadm.common.service.types.rev190531.service.ServiceZEndBuilder()
- .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
- .setNodeId(new NodeIdType("XPONDER-3-2"))
- .setTxDirection(getTxDirection())
- .setRxDirection(getRxDirection())
- .build();
-
+ ServiceAEnd serviceAEnd = getServiceAEndBuild().build();
+ ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
+ .setClli("clli")
+ .setServiceFormat(ServiceFormat.OC)
+ .setServiceRate(Uint32.valueOf(1))
+ .setNodeId(new NodeIdType("XPONDER-3-2"))
+ .setTxDirection(getTxDirection())
+ .setRxDirection(getRxDirection())
+ .build();
ServicesBuilder builtInput = new ServicesBuilder()
.setCommonId("commonId")
.setConnectionType(ConnectionType.Service)
return builtInput.build();
}
- private org.opendaylight.yang.gen.v1
- .http.org.openroadm.common.service.types.rev190531.service.ServiceAEndBuilder getServiceAEndBuild() {
- return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
- .ServiceAEndBuilder()
- .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
+ private ServiceAEndBuilder getServiceAEndBuild() {
+ return new ServiceAEndBuilder()
+ .setClli("clli")
+ .setServiceFormat(ServiceFormat.OC)
+ .setServiceRate(Uint32.valueOf(1))
.setNodeId(new NodeIdType("XPONDER-1-2"))
.setTxDirection(getTxDirection())
.setRxDirection(getRxDirection());
}
private TxDirection getTxDirection() {
- return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
- .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
- .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
- .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
- .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
- .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
+ return new TxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("device name")
+ .setPortName("port name")
+ .setPortRack("port rack")
+ .setPortShelf("port shelf")
+ .setPortSlot("port slot")
+ .setPortSubSlot("port subslot")
+ .setPortType("port type")
+ .build())
+ .setLgx(new LgxBuilder()
+ .setLgxDeviceName("lgx device name")
+ .setLgxPortName("lgx port name")
+ .setLgxPortRack("lgx port rack")
+ .setLgxPortShelf("lgx port shelf")
+ .build())
.build();
}
private RxDirection getRxDirection() {
- return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
- .endpoint.RxDirectionBuilder()
- .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
- .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
- .setPortSubSlot("port subslot").setPortType("port type").build())
- .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
- .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
- .setLgxPortShelf("lgx port shelf").build())
+ return new RxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("device name")
+ .setPortName("port name")
+ .setPortRack("port rack")
+ .setPortShelf("port shelf")
+ .setPortSlot("port slot")
+ .setPortSubSlot("port subslot")
+ .setPortType("port type")
+ .build())
+ .setLgx(new LgxBuilder()
+ .setLgxDeviceName("lgx device name")
+ .setLgxPortName("lgx port name")
+ .setLgxPortRack("lgx port rack")
+ .setLgxPortShelf("lgx port shelf")
+ .build())
.build();
}
.setConnectionType(ConnectionType.Service)
.setMessage(message)
.setOperationalState(services.getOperationalState())
- .setTopic("ServiceListener")
+ .setPublisherName("ServiceListener")
.build();
}
}
URL_CONFIG_ORDM_NET = "{}/config/ietf-network:networks/network/openroadm-network/"
URL_PORTMAPPING = "{}/config/transportpce-portmapping:network/nodes/"
URL_OPER_SERV_LIST = "{}/operational/org-openroadm-service:service-list/"
-URL_GET_NBINOTIFICATIONS_SERV = "{}/operations/nbi-notifications:get-notifications-service/"
+URL_GET_NBINOTIFICATIONS_PROCESS_SERV = "{}/operations/nbi-notifications:get-notifications-process-service/"
URL_GET_NBINOTIFICATIONS_ALARM_SERV = "{}/operations/nbi-notifications:get-notifications-alarm-service/"
URL_SERV_CREATE = "{}/operations/org-openroadm-service:service-create"
URL_SERV_DELETE = "{}/operations/org-openroadm-service:service-delete"
return get_request(url)
-def get_notifications_service_request(attr):
- return post_request(URL_GET_NBINOTIFICATIONS_SERV, attr)
+def get_notifications_process_service_request(attr):
+ return post_request(URL_GET_NBINOTIFICATIONS_PROCESS_SERV, attr)
def get_notifications_alarm_service_request(attr):
"group-id": "transportpceTest"
}
}
- response = test_utils.get_notifications_service_request(data)
+ response = test_utils.get_notifications_process_service_request(data)
self.assertEqual(response.status_code, requests.codes.no_content)
time.sleep(2)
"group-id": "transportpceTest"
}
}
- response = test_utils.get_notifications_service_request(data)
+ response = test_utils.get_notifications_process_service_request(data)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertEqual(res['output']['notification-service'][-1]['service-name'], 'service1')
- self.assertEqual(res['output']['notification-service'][-1]['connection-type'], 'service')
- self.assertEqual(res['output']['notification-service'][-1]['message'], 'ServiceCreate request failed ...')
- self.assertEqual(res['output']['notification-service'][-1]['response-failed'],
+ self.assertEqual(res['output']['notifications-process-service'][-1]['service-name'], 'service1')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['connection-type'], 'service')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['message'],
+ 'ServiceCreate request failed ...')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['response-failed'],
'PCE path computation failed !')
time.sleep(2)
"group-id": "transportpceTest"
}
}
- response = test_utils.get_notifications_service_request(data)
+ response = test_utils.get_notifications_process_service_request(data)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertEqual(res['output']['notification-service'][-1]['service-name'], 'service1')
- self.assertEqual(res['output']['notification-service'][-1]['connection-type'], 'service')
- self.assertEqual(res['output']['notification-service'][-1]['message'], 'Service implemented !')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['service-name'], 'service1')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['connection-type'], 'service')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['message'], 'Service implemented !')
time.sleep(2)
def test_17_get_notifications_alarm_service1(self):
response = test_utils.get_notifications_alarm_service_request(data)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertEqual(res['output']['notification-alarm-service'][-1]['service-name'], 'service1')
- self.assertEqual(res['output']['notification-alarm-service'][-1]['connection-type'], 'service')
- self.assertEqual(res['output']['notification-alarm-service'][-1]['operational-state'], 'inService')
- self.assertEqual(res['output']['notification-alarm-service'][-1]['message'], 'The service is now inService')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['service-name'], 'service1')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['connection-type'], 'service')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['operational-state'], 'inService')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['message'], 'The service is now inService')
time.sleep(2)
def test_18_change_status_port_roadma_srg(self):
response = test_utils.get_notifications_alarm_service_request(data)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertEqual(res['output']['notification-alarm-service'][-1]['service-name'], 'service1')
- self.assertEqual(res['output']['notification-alarm-service'][-1]['connection-type'], 'service')
- self.assertEqual(res['output']['notification-alarm-service'][-1]['operational-state'], 'outOfService')
- self.assertEqual(res['output']['notification-alarm-service'][-1]['message'], 'The service is now outOfService')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['service-name'], 'service1')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['connection-type'], 'service')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['operational-state'], 'outOfService')
+ self.assertEqual(res['output']['notifications-alarm-service'][-1]['message'], 'The service is now outOfService')
time.sleep(2)
def test_20_restore_status_port_roadma_srg(self):
"group-id": "transportpceTest"
}
}
- response = test_utils.get_notifications_service_request(data)
+ response = test_utils.get_notifications_process_service_request(data)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
- self.assertEqual(res['output']['notification-service'][-1]['service-name'], 'service1')
- self.assertEqual(res['output']['notification-service'][-1]['connection-type'], 'service')
- self.assertEqual(res['output']['notification-service'][-1]['message'], 'Service deleted !')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['service-name'], 'service1')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['connection-type'], 'service')
+ self.assertEqual(res['output']['notifications-process-service'][-1]['message'], 'Service deleted !')
time.sleep(2)
def test_24_disconnect_XPDRA(self):