2 * Copyright (c) 2014 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 * Contributor: gaurav.bhagwani@ericsson.com
10 package org.opendaylight.openflowplugin.test;
12 import java.util.ArrayList;
13 import java.util.List;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
16 import org.opendaylight.controller.sal.binding.api.NotificationService;
17 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
23 import org.opendaylight.yangtools.concepts.Registration;
24 import org.osgi.framework.BundleContext;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 public class OpenflowpluginTestTopologyNotification {
30 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestCommandProvider.class);
32 private DataBrokerService dataBrokerService;
33 private ProviderContext pc;
34 private final BundleContext ctx;
35 private final TopologyEventListener topologyEventListener = new TopologyEventListener();
36 private static NotificationService notificationService;
37 private Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> listenerReg;
39 public OpenflowpluginTestTopologyNotification(BundleContext ctx) {
43 public void onSessionInitiated(ProviderContext session) {
45 notificationService = session.getSALService(NotificationService.class);
47 listenerReg = notificationService.registerNotificationListener(topologyEventListener);
48 dataBrokerService = session.getSALService(DataBrokerService.class);
51 final class TopologyEventListener implements FlowTopologyDiscoveryListener {
53 List<LinkDiscovered> linkdiscovered = new ArrayList<>();
54 List<LinkOverutilized> linkoverutilized = new ArrayList<>();
55 List<LinkRemoved> linkremoved = new ArrayList<>();
56 List<LinkUtilizationNormal> linkutilizationnormal = new ArrayList<>();
59 public void onLinkDiscovered(LinkDiscovered notification) {
60 LOG.debug("-------------------------------------------");
61 LOG.debug("LinkDiscovered notification ........");
62 LOG.debug("-------------------------------------------");
66 public void onLinkOverutilized(LinkOverutilized notification) {
67 LOG.debug("-------------------------------------------");
68 LOG.debug("LinkOverutilized notification ........");
69 LOG.debug("-------------------------------------------");
73 public void onLinkRemoved(LinkRemoved notification) {
74 LOG.debug("-------------------------------------------");
75 LOG.debug("LinkRemoved notification ........");
76 LOG.debug("-------------------------------------------");
80 public void onLinkUtilizationNormal(LinkUtilizationNormal notification) {
81 LOG.debug("-------------------------------------------");
82 LOG.debug("LinkUtilizationNormal notification ........");
83 LOG.debug("-------------------------------------------");