/** * Copy constructor * * @param h Host to copy values from * * @return constructed copy */ public Host(Host h) throws ConstructionException { if (h == null) { throw new ConstructionException("Passed null host"); } this.dataLayerAddress = h.getDataLayerAddress(); this.networkAddress = h.getNetworkAddress(); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((nodeConnector == null) ? 0 : nodeConnector.hashCode()); result = prime * result + (staticHost ? 1231 : 1237); result = prime * result + vlan; return result; }
public String toJson() { return "{\"host\":\"" + super.toString() + "\", " + "\"vlan\":\"" + String.valueOf(vlan) + "\",\"NodeConnector\":\"" + nodeConnector.toString() + "\"," + "\"static\":\"" + String.valueOf(isStaticHost()) + "\"}"; }
try { DataLinkAddress dla = new EthernetAddress(host.getDataLayerAddressBytes()); h = new Host(dla, host.getNetworkAddress()); } catch (ConstructionException ce) { p = null; logger.debug("Notifying Topology Manager for Host {} Being {}", h.getNetworkAddress().getHostAddress(), add ? "Added" : "Deleted"); if (add == true) {
public IncomingHostData(Map<Host, Long> hostData) { this.stats = new ArrayList<HostStatistics>(); for (Host h : hostData.keySet()) this.stats.add(new HostStatistics(h.getNetworkAddress(), hostData.get(h))); }
List<Host> hosts = topology.getHostsAttachedToNodeConnector(connector); for (Host host : hosts) { EthernetAddress dmac = (EthernetAddress) host.getDataLayerAddress(); String hostId = String.valueOf(hid); NodeBean hostBean = new NodeBean(hostId, host.getNetworkAddressAsString(), NodeType.HOST); List<Map<String, Object>> adjacencies = new LinkedList<Map<String, Object>>(); EdgeBean edge = new EdgeBean(connector, hid);
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } HostNodeConnector other = (HostNodeConnector) obj; if (nodeConnector == null) { if (other.nodeConnector != null) { return false; } } else if (!nodeConnector.equals(other.nodeConnector)) { return false; } if (staticHost != other.staticHost) { return false; } if (vlan != other.vlan) { return false; } return true; }
private Host handleHostAvailability(String containerName, String networkAddr) { IfIptoHost hostTracker = (IfIptoHost) ServiceHelper.getInstance(IfIptoHost.class, containerName, this); if (hostTracker == null) throw new ServiceUnavailableException("Host tracker " + RestMessages.SERVICEUNAVAILABLE.toString()); Set<HostNodeConnector> allHosts = hostTracker.getAllHosts(); if (allHosts == null) throw new ResourceNotFoundException(networkAddr + " : " + RestMessages.NOHOST.toString()); Host host = null; try { InetAddress networkAddress = InetAddress.getByName(networkAddr); for (Host h : allHosts) { if (h.getNetworkAddress().equals(networkAddress)) { host = h; break; } } } catch (UnknownHostException e) { } if (host == null) throw new ResourceNotFoundException(networkAddr + " : " + RestMessages.NOHOST.toString()); return host; } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } HostNodeConnector other = (HostNodeConnector) obj; if (nodeConnector == null) { if (other.nodeConnector != null) { return false; } } else if (!nodeConnector.equals(other.nodeConnector)) { return false; } if (staticHost != other.staticHost) { return false; } if (vlan != other.vlan) { return false; } return true; }
public String toJson() { return "{\"host\":\"" + super.toString() + "\", " + "\"vlan\":\"" + String.valueOf(vlan) + "\",\"NodeConnector\":\"" + nodeConnector.toString() + "\"," + "\"static\":\"" + String.valueOf(isStaticHost()) + "\"}"; }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((nodeConnector == null) ? 0 : nodeConnector.hashCode()); result = prime * result + (staticHost ? 1231 : 1237); result = prime * result + vlan; return result; }