Usages of

org.onosproject.net.host.HostService.getHost(?)
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private IpAddress getIPfromMac(MacAddress mac_addr) { HostId hid = HostId.hostId(mac_addr); Host h = hostService.getHost(hid); Set<IpAddress> setIP = h.ipAddresses(); for (IpAddress ip_addr: setIP) return ip_addr; return null; }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Override public InstancePort instancePort(MacAddress macAddress) { Host host = hostService.getHost(HostId.hostId(macAddress)); if (host == null || !isValidHost(host)) { return null; } return HostBasedInstancePort.of(host); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Override public List<Intent> compile(HostToHostIntent intent, List<Intent> installable, Set<LinkResourceAllocations> resources) { boolean isAsymmetric = intent.constraints().contains(new AsymmetricPathConstraint()); Path pathOne = getPath(intent, intent.one(), intent.two()); Path pathTwo = isAsymmetric ? getPath(intent, intent.two(), intent.one()) : invertPath(pathOne); Host one = hostService.getHost(intent.one()); Host two = hostService.getHost(intent.two()); return Arrays.asList(createPathIntent(pathOne, one, two, intent), createPathIntent(pathTwo, two, one, intent)); }
protected final HostService hostService; // code omitted ... // Returns host details response. protected ObjectNode hostDetails(HostId hostId, long sid) { Host host = hostService.getHost(hostId); Annotations annot = host.annotations(); String type = annot.value(AnnotationKeys.TYPE); String name = annot.value(AnnotationKeys.NAME); String vlan = host.vlan().toString(); return envelope("showDetails", sid, json(isNullOrEmpty(name) ? hostId.toString() : name, isNullOrEmpty(type) ? "endstation" : type, new Prop("MAC", host.mac().toString()), new Prop("IP", host.ipAddresses().toString().replaceAll("[\\[\\]]", "")), new Prop("VLAN", vlan.equals("-1") ? "none" : vlan), new Separator(), new Prop("Latitude", annot.value(AnnotationKeys.LATITUDE)), new Prop("Longitude", annot.value(AnnotationKeys.LONGITUDE)))); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Override public List<Intent> compile(HostToHostIntent intent, List<Intent> installable) { boolean isAsymmetric = intent.constraints().contains(new AsymmetricPathConstraint()); Path pathOne = getPath(intent, intent.one(), intent.two()); Path pathTwo = isAsymmetric ? getPath(intent, intent.two(), intent.one()) : invertPath(pathOne); Host one = hostService.getHost(intent.one()); Host two = hostService.getHost(intent.two()); return Arrays.asList(createPathIntent(pathOne, one, two, intent), createPathIntent(pathTwo, two, one, intent)); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private Set<Host> constructHostIds(Iterator<JsonNode> elements) { Set<Host> hostIds = Sets.newHashSet(); JsonNode n; while (elements.hasNext()) { n = elements.next(); hostIds.add(hostService.getHost(HostId.hostId(n.textValue()))); } return hostIds; }
/** * Utility to send a ND reply using the supplied information. * * @param pkt the request * @param targetMac the target mac * @param hostService the host service */ protected void sendResponse(NeighbourMessageContext pkt, MacAddress targetMac, HostService hostService) { HostId dstId = HostId.hostId(pkt.srcMac(), pkt.vlan()); Host dst = hostService.getHost(dstId); if (dst == null) { log.warn("Cannot send {} response to host {} - does not exist in the store", pkt.protocol(), dstId); return; } pkt.reply(targetMac); }
private HostService hostService; // code omitted ... /** * Tests {@link ProxyArpManager#reply(Ethernet)} in the case where the * destination host is not known. * Verifies the ARP request is flooded out the correct edge ports. */ @Test public void testReplyUnknown() { Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5), Collections.singleton(IP2)); expect(hostService.getHostsByIp(IP1)) .andReturn(Collections.<Host>emptySet()); expect(hostService.getHost(HID2)).andReturn(requestor); replay(hostService); Ethernet arpRequest = buildArp(ARP.OP_REQUEST, MAC2, null, IP2, IP1); proxyArp.reply(arpRequest, getLocation(5)); verifyFlood(arpRequest); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... // Processes the incoming ARP response message. private void processArpResponse(ArpResponseMessage msg) { pendingMessages.put(msg.subject.id(), msg); if (hostService.getHost(msg.subject.id()) != null) { checkPendingArps(msg.subject.id()); } // FIXME: figure out pruning so stuff does not build up }
protected HostService hostService; // code omitted ... // Adds the specified host to the set of hosts. private void addHost(Set<Host> hosts, HostId hostId) { Host host = hostService.getHost(hostId); if (host != null) { hosts.add(host); } }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes