Usages of

org.onosproject.net.host.HostService.getHosts()
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private void storeHosts() { for (Host host : hostService.getHosts()) { for (IpAddress ip : host.ipAddresses()) { hostStore.put(ip.toString(), host); } } }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private void updateExistHosts(OXPHostRequest oxpHostRequest) { List<OXPHost> oxpHosts = new ArrayList<>(); for (Host host : hostService.getHosts()) { oxpHosts.addAll(toOxpHosts(host, OXPHostState.ACTIVE)); } sendHostChangeMsg(oxpHosts, oxpHostRequest); }
private TableRow[] generateTableRows(HostService service) { List<TableRow> list = new ArrayList<>(); for (Host host : service.getHosts()) { list.add(new HostTableRow(host)); } return list.toArray(new TableRow[list.size()]); }
final HostService mockHostService = createMock(HostService.class); // code omitted ... /** * Initializes test mocks and environment. */ @Before public void setUpTest() { expect(mockHostService.getHosts()).andReturn(hosts).anyTimes(); // Register the services needed for the test final CodecManager codecService = new CodecManager(); codecService.activate(); ServiceDirectory testDirectory = new TestServiceDirectory() .add(HostService.class, mockHostService) .add(CodecService.class, codecService) .add(HostProviderRegistry.class, mockHostProviderRegistry); BaseResource.setServiceDirectory(testDirectory); }
final HostService mockHostService = createMock(HostService.class); // code omitted ... /** * Initializes test mocks and environment. */ @Before public void setUpTest() { expect(mockHostService.getHosts()).andReturn(hosts).anyTimes(); // Register the services needed for the test final CodecManager codecService = new CodecManager(); codecService.activate(); ServiceDirectory testDirectory = new TestServiceDirectory() .add(HostService.class, mockHostService) .add(CodecService.class, codecService); BaseResource.setServiceDirectory(testDirectory); }
final HostService mockHostService = createMock(HostService.class); // code omitted ... @Before public void setUp() { expect(mockHostService.getHosts()).andReturn(hosts).anyTimes(); // Register the services needed for the test final CodecManager codecService = new CodecManager(); codecService.activate(); ServiceDirectory testDirectory = new TestServiceDirectory() .add(HostService.class, mockHostService) .add(CodecService.class, codecService); BaseResource.setServiceDirectory(testDirectory); }
private HostService hostService; // code omitted ... protected void readInitialHosts(DeviceId devId) { hostService.getHosts().forEach(host -> { DeviceId deviceId = host.location().deviceId(); // The host does not attach to this device if (!deviceId.equals(devId)) { return; } processHostAddedEventInternal(host); }); }
private HostService hostService; // code omitted ... protected void init(DeviceId devId) { hostService.getHosts().forEach(host -> { DeviceId deviceId = host.location().deviceId(); // The host does not attach to this device if (!deviceId.equals(devId)) { return; } processHostAdded(host); }); }
private HostService hostService; // code omitted ... protected void readInitialHosts(DeviceId devId) { hostService.getHosts().forEach(host -> { DeviceId deviceId = host.location().deviceId(); // The host does not attach to this device if (!deviceId.equals(devId)) { return; } processHostAdded(host); }); }
private HostService hostService; // code omitted ... private Set<HostHighlight> hostHighlightsInSameNetwork(HostId hostId) { Set<HostHighlight> hostHighlights = Sets.newHashSet(); Streams.stream(hostService.getHosts()) .filter(host -> isHostInSameNetwork(host, networkId(hostId))) .forEach(host -> { HostHighlight hostHighlight = new HostHighlight(host.id().toString()); hostHighlight.setBadge(createBadge(getVni(host))); hostHighlights.add(hostHighlight); }); return hostHighlights; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes