Usages of

org.onosproject.net.host.HostService.startMonitoringIp(?)
private HostService hostService; // code omitted ... /** * Sets expectations on the host service for a given host. * * @param host host */ private void expectHost(Host host) { // Assume the host only has one IP address IpAddress ip = host.ipAddresses().iterator().next(); expect(hostService.getHostsByIp(ip)) .andReturn(Sets.newHashSet(host)).anyTimes(); hostService.startMonitoringIp(ip); expectLastCall().anyTimes(); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private ResolvedRoute resolve(Route route) { hostService.startMonitoringIp(route.nextHop()); Set<Host> hosts = hostService.getHostsByIp(route.nextHop()); Optional<Host> host = hosts.stream().findFirst(); if (host.isPresent()) { return new ResolvedRoute(route, host.get().mac(), host.get().vlan(), host.get().location()); } else { return null; } }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private ResolvedRoute resolve(Route route) { hostService.startMonitoringIp(route.nextHop()); Set<Host> hosts = hostService.getHostsByIp(route.nextHop()); return hosts.stream().findFirst() .map(host -> new ResolvedRoute(route, host.mac(), host.vlan(), host.location())) .orElse(null); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Activate public void activate(ComponentContext context) { cfgService.registerProperties(getClass()); modified(context); // "org.onosproject.aaa" is the FQDN of our app appId = coreService.registerApplication("org.onosproject.aaa"); // register our event handler packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 2); requestIntercepts(); // Instantiate the map of the state machines stateMachineMap = Collections.synchronizedMap(Maps.newHashMap()); hostService.startMonitoringIp(IpAddress.valueOf(radiusIpAddress)); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Activate public void activate(ComponentContext context) { cfgService.registerProperties(getClass()); modified(context); // "org.onosproject.aaa" is the FQDN of our app appId = coreService.registerApplication("org.onosproject.aaa"); // register our event handler packetService.addProcessor(processor, PacketProcessor.director(2)); requestIntercepts(); // Instantiate the map of the state machines stateMachineMap = Collections.synchronizedMap(Maps.newHashMap()); hostService.startMonitoringIp(IpAddress.valueOf(radiusIpAddress)); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Activate public void activate() { netCfgService.addListener(cfgListener); netCfgService.registerConfigFactory(factory); // "org.onosproject.aaa" is the FQDN of our app appId = coreService.registerApplication("org.onosproject.aaa"); cfgListener.reconfigureNetwork(netCfgService.getConfig(appId, AAAConfig.class)); // register our event handler packetService.addProcessor(processor, PacketProcessor.director(2)); requestIntercepts(); StateMachine.initializeMaps(); hostService.startMonitoringIp(IpAddress.valueOf(radiusIpAddress)); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... @Activate public void activate(ComponentContext context) { cfgService.registerProperties(getClass()); modified(context); // "org.onosproject.aaa" is the FQDN of our app appId = coreService.registerApplication("org.onosproject.aaa"); // register our event handler packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 2); TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); selector.matchEthType(EthType.EtherType.EAPOL.ethType().toShort()); packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId); // Instantiate the map of the state machines stateMachineMap = Collections.synchronizedMap(Maps.newHashMap()); hostService.startMonitoringIp(IpAddress.valueOf(radiusIpAddress)); }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private void resolve(Route route) { // Monitor the IP address for updates of the MAC address hostService.startMonitoringIp(route.nextHop()); MacAddress nextHopMac = routeStore.getNextHop(route.nextHop()); if (nextHopMac == null) { Set<Host> hosts = hostService.getHostsByIp(route.nextHop()); Optional<Host> host = hosts.stream().findFirst(); if (host.isPresent()) { nextHopMac = host.get().mac(); } } if (nextHopMac != null) { routeStore.updateNextHop(route.nextHop(), nextHopMac); } }
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected HostService hostService; // code omitted ... private void resolve(Route route) { // Monitor the IP address for updates of the MAC address hostService.startMonitoringIp(route.nextHop()); NextHopData nextHopData = routeStore.getNextHop(route.nextHop()); if (nextHopData == null) { Set<Host> hosts = hostService.getHostsByIp(route.nextHop()); Optional<Host> host = hosts.stream().findFirst(); if (host.isPresent()) { nextHopData = NextHopData.fromHost(host.get()); } } if (nextHopData != null) { routeStore.updateNextHop(route.nextHop(), nextHopData); } }
private HostService hostService; // code omitted ... /** * Sets up the host service with details of some hosts. */ private void setUpHostService() { hostService = createMock(HostService.class); hostService.addListener(anyObject(HostListener.class)); expectLastCall().anyTimes(); IpAddress host1Address = IpAddress.valueOf("192.168.10.1"); Host host1 = new DefaultHost(ProviderId.NONE, HostId.NONE, MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE, new HostLocation(SW1_ETH1, 1), Sets.newHashSet(host1Address)); expect(hostService.getHostsByIp(host1Address)) .andReturn(Sets.newHashSet(host1)).anyTimes(); hostService.startMonitoringIp(host1Address); expectLastCall().anyTimes(); IpAddress host2Address = IpAddress.valueOf("192.168.20.1"); Host host2 = new DefaultHost(ProviderId.NONE, HostId.NONE, MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE, new HostLocation(SW2_ETH1, 1), Sets.newHashSet(host2Address)); expect(hostService.getHostsByIp(host2Address)) .andReturn(Sets.newHashSet(host2)).anyTimes(); hostService.startMonitoringIp(host2Address); expectLastCall().anyTimes(); replay(hostService); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes