2 * Copyright (c) 2014, 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.test;
10 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import org.opendaylight.mdsal.binding.api.NotificationService;
13 import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
14 import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener.Component;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
19 import org.opendaylight.yangtools.yang.binding.Notification;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
23 public class OpenflowpluginTestTopologyNotification {
24 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
26 private final NotificationService notificationService;
28 public OpenflowpluginTestTopologyNotification(final NotificationService notificationService) {
29 this.notificationService = notificationService;
34 notificationService.registerCompositeListener(new CompositeListener(Set.of(
35 new Component<>(LinkDiscovered.class, this::onNotification),
36 new Component<>(LinkOverutilized.class, this::onNotification),
37 new Component<>(LinkRemoved.class, this::onNotification),
38 new Component<>(LinkUtilizationNormal.class, this::onNotification))));
41 @SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
42 private void onNotification(Notification<?> notification) {
43 LOG.debug("-------------------------------------------");
44 LOG.debug("{} notification ........", notification.getClass().getSimpleName());
45 LOG.debug("-------------------------------------------");