Merge "OPNFLWPLUG-983 Group and flow removal stats are not reported in order"
[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.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
11 import org.opendaylight.controller.sal.binding.api.NotificationService;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
17 import org.osgi.framework.BundleContext;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 public class OpenflowpluginTestTopologyNotification {
22
23     private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
24
25     private final TopologyEventListener topologyEventListener = new TopologyEventListener();
26     private NotificationService notificationService;
27
28     public OpenflowpluginTestTopologyNotification(BundleContext ctx) {
29     }
30
31     public void onSessionInitiated(ProviderContext session) {
32         notificationService = session.getSALService(NotificationService.class);
33         // For switch events
34         notificationService.registerNotificationListener(topologyEventListener);
35     }
36
37     private static final class TopologyEventListener implements FlowTopologyDiscoveryListener {
38         @Override
39         public void onLinkDiscovered(LinkDiscovered notification) {
40             LOG.debug("-------------------------------------------");
41             LOG.debug("LinkDiscovered notification ........");
42             LOG.debug("-------------------------------------------");
43         }
44
45         @Override
46         public void onLinkOverutilized(LinkOverutilized notification) {
47             LOG.debug("-------------------------------------------");
48             LOG.debug("LinkOverutilized notification ........");
49             LOG.debug("-------------------------------------------");
50         }
51
52         @Override
53         public void onLinkRemoved(LinkRemoved notification) {
54             LOG.debug("-------------------------------------------");
55             LOG.debug("LinkRemoved notification   ........");
56             LOG.debug("-------------------------------------------");
57         }
58
59         @Override
60         public void onLinkUtilizationNormal(LinkUtilizationNormal notification) {
61             LOG.debug("-------------------------------------------");
62             LOG.debug("LinkUtilizationNormal notification ........");
63             LOG.debug("-------------------------------------------");
64         }
65
66     }
67 }