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;
12 import org.opendaylight.mdsal.binding.api.NotificationService;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public class OpenflowpluginTestNodeConnectorNotification {
23 private static final Logger LOG = LoggerFactory.getLogger(OpenflowpluginTestNodeConnectorNotification.class);
25 private final PortEventListener portEventListener = new PortEventListener();
26 private final NotificationService notificationService;
28 public OpenflowpluginTestNodeConnectorNotification(NotificationService notificationService) {
29 this.notificationService = notificationService;
34 notificationService.registerNotificationListener(portEventListener);
37 private static final class PortEventListener implements OpendaylightInventoryListener {
39 List<NodeUpdated> nodeUpdated = new ArrayList<>();
40 List<NodeRemoved> nodeRemoved = new ArrayList<>();
41 List<NodeConnectorUpdated> nodeConnectorUpdated = new ArrayList<>();
42 List<NodeConnectorRemoved> nodeConnectorRemoved = new ArrayList<>();
45 public void onNodeConnectorRemoved(NodeConnectorRemoved notification) {
46 LOG.debug("NodeConnectorRemoved Notification");
47 LOG.debug("NodeConnectorRef {}", notification.getNodeConnectorRef());
48 nodeConnectorRemoved.add(notification);
52 public void onNodeConnectorUpdated(NodeConnectorUpdated notification) {
53 LOG.debug("NodeConnectorUpdated Notification");
54 LOG.debug("NodeConnectorRef {}", notification.getNodeConnectorRef());
55 nodeConnectorUpdated.add(notification);
59 public void onNodeRemoved(NodeRemoved notification) {
60 LOG.debug("NodeRemoved Notification");
61 LOG.debug("NodeRef {}", notification.getNodeRef());
62 nodeRemoved.add(notification);
66 public void onNodeUpdated(NodeUpdated notification) {
67 LOG.debug("NodeUpdated Notification");
68 LOG.debug("NodeRef {}", notification.getNodeRef());
69 nodeUpdated.add(notification);