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=03909076164561b84b7685771479e515d0dbc3f4;hb=3911d99453f72ba1a7120ff87d35d6089f28ff54;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..0390907616 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 @@ -385,11 +385,11 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener, long newDomain = 0; boolean newBD = false; - if (oldDomain < newDomain) - return -1; - else if (oldDomain > newDomain) + if (oldDomain < newDomain) { + return -1; + } else if (oldDomain > newDomain) { return 1; - + } // Give preference to OFPP_LOCAL always if (!oldAP.getPort().getType().equals(NodeConnectorIDType.SWSTACK) && newAP.getPort().getType() @@ -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.