-/**
+/*
* Copyright (c) 2014, 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
*/
package org.opendaylight.openflowplugin.test;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestTopologyNotification.class);
- private DataBroker dataBroker;
- private ProviderContext pc;
- private final BundleContext ctx;
private final TopologyEventListener topologyEventListener = new TopologyEventListener();
- private static NotificationService notificationService;
- private Registration listenerReg;
+ private final NotificationService notificationService;
- public OpenflowpluginTestTopologyNotification(BundleContext ctx) {
- this.ctx = ctx;
+ public OpenflowpluginTestTopologyNotification(NotificationService notificationService) {
+ this.notificationService = notificationService;
}
- public void onSessionInitiated(ProviderContext session) {
- pc = session;
- notificationService = session.getSALService(NotificationService.class);
+ public void init() {
// For switch events
- listenerReg = notificationService.registerNotificationListener(topologyEventListener);
- dataBroker = session.getSALService(DataBroker.class);
+ notificationService.registerNotificationListener(topologyEventListener);
}
- final class TopologyEventListener implements FlowTopologyDiscoveryListener {
-
- List<LinkDiscovered> linkdiscovered = new ArrayList<>();
- List<LinkOverutilized> linkoverutilized = new ArrayList<>();
- List<LinkRemoved> linkremoved = new ArrayList<>();
- List<LinkUtilizationNormal> linkutilizationnormal = new ArrayList<>();
-
+ private static final class TopologyEventListener implements FlowTopologyDiscoveryListener {
@Override
public void onLinkDiscovered(LinkDiscovered notification) {
LOG.debug("-------------------------------------------");