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 java.util.ArrayList;
11 import java.util.List;
13 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.opendaylight.controller.sal.binding.api.NotificationService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
21 import org.opendaylight.yangtools.concepts.Registration;
22 import org.osgi.framework.BundleContext;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
26 public class OpenflowpluginTestTopologyNotification {
28 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
30 private DataBroker dataBroker;
31 private ProviderContext pc;
32 private final BundleContext ctx;
33 private final TopologyEventListener topologyEventListener = new TopologyEventListener();
34 private static NotificationService notificationService;
35 private Registration listenerReg;
37 public OpenflowpluginTestTopologyNotification(BundleContext ctx) {
41 public void onSessionInitiated(ProviderContext session) {
43 notificationService = session.getSALService(NotificationService.class);
45 listenerReg = notificationService.registerNotificationListener(topologyEventListener);
46 dataBroker = session.getSALService(DataBroker.class);
49 final class TopologyEventListener implements FlowTopologyDiscoveryListener {
51 List<LinkDiscovered> linkdiscovered = new ArrayList<>();
52 List<LinkOverutilized> linkoverutilized = new ArrayList<>();
53 List<LinkRemoved> linkremoved = new ArrayList<>();
54 List<LinkUtilizationNormal> linkutilizationnormal = new ArrayList<>();
57 public void onLinkDiscovered(LinkDiscovered notification) {
58 LOG.debug("-------------------------------------------");
59 LOG.debug("LinkDiscovered notification ........");
60 LOG.debug("-------------------------------------------");
64 public void onLinkOverutilized(LinkOverutilized notification) {
65 LOG.debug("-------------------------------------------");
66 LOG.debug("LinkOverutilized notification ........");
67 LOG.debug("-------------------------------------------");
71 public void onLinkRemoved(LinkRemoved notification) {
72 LOG.debug("-------------------------------------------");
73 LOG.debug("LinkRemoved notification ........");
74 LOG.debug("-------------------------------------------");
78 public void onLinkUtilizationNormal(LinkUtilizationNormal notification) {
79 LOG.debug("-------------------------------------------");
80 LOG.debug("LinkUtilizationNormal notification ........");
81 LOG.debug("-------------------------------------------");