import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.concepts.Registration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static String lldpSecureKey;
- private final ListenerRegistration<NotificationListener> lldpNotificationRegistration;
+ private final Registration lldpNotificationRegistration;
@SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
@Inject
LOG.info("Starting LLDPActivator with lldpSecureKey: {}", lldpSecureKey);
- lldpNotificationRegistration = notificationService.registerNotificationListener(lldpDiscoveryListener);
+ lldpNotificationRegistration =
+ notificationService.registerListener(PacketReceived.class, lldpDiscoveryListener);
LOG.info("LLDPDiscoveryListener started.");
}
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService.Listener;
import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
import org.opendaylight.openflowplugin.applications.topology.lldp.utils.LLDPDiscoveryUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Singleton
-public class LLDPDiscoveryListener implements PacketProcessingListener {
+public class LLDPDiscoveryListener implements Listener<PacketReceived> {
private static final Logger LOG = LoggerFactory.getLogger(LLDPDiscoveryListener.class);
private final LLDPLinkAger lldpLinkAger;
final LLDPLinkAger lldpLinkAger, final EntityOwnershipService entityOwnershipService) {
this.notificationService = notificationService;
this.lldpLinkAger = lldpLinkAger;
- this.eos = entityOwnershipService;
+ eos = entityOwnershipService;
}
@Override
- public void onPacketReceived(final PacketReceived lldp) {
+ public void onNotification(final PacketReceived lldp) {
NodeConnectorRef src = LLDPDiscoveryUtils.lldpToNodeConnectorRef(lldp.getPayload(), true);
if (src != null) {
final NodeKey nodeKey = lldp.getIngress().getValue().firstKeyOf(Node.class);
final LinkDiscovered ld = ldb.build();
final boolean linkWasPresent = lldpLinkAger.isLinkPresent(ld);
lldpLinkAger.put(ld);
- if (LLDPDiscoveryUtils.isEntityOwned(this.eos, nodeKey.getId().getValue())) {
+ if (LLDPDiscoveryUtils.isEntityOwned(eos, nodeKey.getId().getValue())) {
if (linkWasPresent) {
LOG.trace("Link {} already present in the cache, skip publishing the notification.", ld);
} else {