Switch to MD-SAL APIs
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowpluginTestTopologyNotification.java
1 /*
2  * Copyright (c) 2014, 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowplugin.test;
9
10 import org.opendaylight.mdsal.binding.api.NotificationService;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class OpenflowpluginTestTopologyNotification {
20
21     private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
22
23     private final TopologyEventListener topologyEventListener = new TopologyEventListener();
24     private final NotificationService notificationService;
25
26     public OpenflowpluginTestTopologyNotification(NotificationService notificationService) {
27         this.notificationService = notificationService;
28     }
29
30     public void init() {
31         // For switch events
32         notificationService.registerNotificationListener(topologyEventListener);
33     }
34
35     private static final class TopologyEventListener implements FlowTopologyDiscoveryListener {
36         @Override
37         public void onLinkDiscovered(LinkDiscovered notification) {
38             LOG.debug("-------------------------------------------");
39             LOG.debug("LinkDiscovered notification ........");
40             LOG.debug("-------------------------------------------");
41         }
42
43         @Override
44         public void onLinkOverutilized(LinkOverutilized notification) {
45             LOG.debug("-------------------------------------------");
46             LOG.debug("LinkOverutilized notification ........");
47             LOG.debug("-------------------------------------------");
48         }
49
50         @Override
51         public void onLinkRemoved(LinkRemoved notification) {
52             LOG.debug("-------------------------------------------");
53             LOG.debug("LinkRemoved notification   ........");
54             LOG.debug("-------------------------------------------");
55         }
56
57         @Override
58         public void onLinkUtilizationNormal(LinkUtilizationNormal notification) {
59             LOG.debug("-------------------------------------------");
60             LOG.debug("LinkUtilizationNormal notification ........");
61             LOG.debug("-------------------------------------------");
62         }
63
64     }
65 }