-/**
+/*
* 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
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.inventory.rev130819.NodeConnectorRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener;
-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(OpenflowpluginTestNodeConnectorNotification.class);
- private DataBroker dataBroker;
- private ProviderContext pc;
- private final BundleContext ctx;
private final PortEventListener portEventListener = new PortEventListener();
- private static NotificationService notificationService;
- private Registration listenerReg;
+ private final NotificationService notificationService;
- public OpenflowpluginTestNodeConnectorNotification(BundleContext ctx) {
- this.ctx = ctx;
+ public OpenflowpluginTestNodeConnectorNotification(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(portEventListener);
- dataBroker = session.getSALService(DataBroker.class);
+ notificationService.registerNotificationListener(portEventListener);
}
- final class PortEventListener implements OpendaylightInventoryListener {
+ private static final class PortEventListener implements OpendaylightInventoryListener {
List<NodeUpdated> nodeUpdated = new ArrayList<>();
List<NodeRemoved> nodeRemoved = new ArrayList<>();
@Override
public void onNodeConnectorRemoved(NodeConnectorRemoved notification) {
- LOG.debug("NodeConnectorRemoved Notification ...................");
- LOG.debug("NodeConnectorRef " + notification.getNodeConnectorRef());
- LOG.debug("----------------------------------------------------------------------");
+ LOG.debug("NodeConnectorRemoved Notification");
+ LOG.debug("NodeConnectorRef {}", notification.getNodeConnectorRef());
nodeConnectorRemoved.add(notification);
}
@Override
public void onNodeConnectorUpdated(NodeConnectorUpdated notification) {
- LOG.debug("NodeConnectorUpdated Notification...................");
- LOG.debug("NodeConnectorRef " + notification.getNodeConnectorRef());
- LOG.debug("----------------------------------------------------------------------");
+ LOG.debug("NodeConnectorUpdated Notification");
+ LOG.debug("NodeConnectorRef {}", notification.getNodeConnectorRef());
nodeConnectorUpdated.add(notification);
}
@Override
public void onNodeRemoved(NodeRemoved notification) {
- LOG.debug("NodeRemoved Notification ...................");
- LOG.debug("NodeRef " + notification.getNodeRef());
- LOG.debug("----------------------------------------------------------------------");
+ LOG.debug("NodeRemoved Notification");
+ LOG.debug("NodeRef {}", notification.getNodeRef());
nodeRemoved.add(notification);
}
@Override
public void onNodeUpdated(NodeUpdated notification) {
- LOG.debug("NodeUpdated Notification ...................");
- LOG.debug("NodeRef " + notification.getNodeRef());
- LOG.debug("----------------------------------------------------------------------");
+ LOG.debug("NodeUpdated Notification");
+ LOG.debug("NodeRef {}", notification.getNodeRef());
nodeUpdated.add(notification);
}
}