X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fhosttracker_new%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fhosttracker%2Finternal%2FDeviceManagerImpl.java;h=95d33ceef90fcaf019cead9ffe9a2a97858e8e47;hb=2f14a41bbd09010114116aef1499641f7251bf83;hp=7e979424376a2e26fa7fe7a6aed6ca26ca25786d;hpb=04d0fda19d5d508e844ec2e29ed12f823af8d10b;p=controller.git diff --git a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java index 7e97942437..95d33ceef9 100755 --- a/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java +++ b/opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java @@ -2227,8 +2227,16 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, @Override public Set getInactiveStaticHosts() { - // TODO Auto-generated method stub - return null; + Collection devices = Collections + .unmodifiableCollection(inactiveStaticDevices.values()); + Iterator i = devices.iterator(); + Set nc = new HashSet(); + while (i.hasNext()) { + Entity ent = i.next(); + nc.add(ent.toHostNodeConnector()); + + } + return nc; } @Override @@ -2277,6 +2285,16 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, listener.deviceRemoved(d); } } + //go through inactive entites. + Set inactive = this.getInactiveStaticHosts(); + for(HostNodeConnector nc : inactive){ + Integer ip =toIPv4Address(nc.getNetworkAddress().getAddress()); + if(ip.equals(addr)){ + this.inactiveStaticDevices.remove(nc.getnodeConnector()); + } + } + + return new Status(StatusCode.SUCCESS); } @@ -2335,15 +2353,17 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, Entity ent = inactiveStaticDevices.get(nodeConnector); Device device = this.learnDeviceByEntity(ent); - HostNodeConnector host = device.toHostNodeConnector(); - if (host != null) { - inactiveStaticDevices.remove(nodeConnector); - for (IfNewHostNotify notify : newHostNotify) - notify.notifyHTClient(host); - for (IDeviceListener listener : listeners) - listener.deviceAdded(device); - } else { - logger.debug("handleNodeConnectorStatusDown {}", nodeConnector); + if(device!=null){ + HostNodeConnector host = device.toHostNodeConnector(); + if (host != null) { + inactiveStaticDevices.remove(nodeConnector); + for (IfNewHostNotify notify : newHostNotify) + notify.notifyHTClient(host); + for (IDeviceListener listener : listeners) + listener.deviceAdded(device); + } else { + logger.debug("handleNodeConnectorStatusDown {}", nodeConnector); + } } }else{ // remove all devices on the node that went down.