+ // Topology update is for some reason outside of listeners registry
+ // logic
+ Entity[] ents = update.device.getEntities();
+ Entity e = ents[ents.length-1];
+ NodeConnector p = e.getPort();
+ Node node = p.getNode();
+ Host h = null;
+ try {
+ byte[] mac = NetUtils.longToByteArray6(e.getMacAddress());
+ DataLinkAddress dla = new EthernetAddress(
+ mac);
+ e.getIpv4Address();
+ InetAddress.getAllByName(e.getIpv4Address().toString());
+ h = new org.opendaylight.controller.sal.core.Host(dla,
+ InetAddress.getByName(e.getIpv4Address().toString()));
+ } catch (ConstructionException ce) {
+ p = null;
+ h = null;
+ } catch (UnknownHostException ue){
+ p = null;
+ h = null;
+ }
+
+ if (topology != null && p != null && h != null) {
+ if (update.change.equals(DeviceUpdate.Change.ADD)) {
+ Tier tier = new Tier(1);
+ switchManager.setNodeProp(node, tier);
+ topology.updateHostLink(p, h, UpdateType.ADDED, null);
+ } else {
+ // No need to reset the tiering if no other hosts are currently
+ // connected
+ // If this switch was discovered to be an access switch, it
+ // still is even if the host is down
+ Tier tier = new Tier(0);
+ switchManager.setNodeProp(node, tier);
+ topology.updateHostLink(p, h, UpdateType.REMOVED, null);
+ }
+ }
+
+ if (listeners == null && newHostNotify.isEmpty()) {