use of org.onosproject.net.host.HostDescription in project onos by opennetworkinglab.
the class NetworkConfigHostProvider method updateHost.
/**
* Updates host information.
* IP information will be replaced if host exists.
*
* @param mac MAC address of the host
* @param vlan VLAN ID of the host
* @param locations Location of the host
* @param ips Set of IP addresses of the host
*/
protected void updateHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<IpAddress> ips) {
HostId hid = HostId.hostId(mac, vlan);
HostDescription desc = new DefaultHostDescription(mac, vlan, locations, ips, true);
providerService.hostDetected(hid, desc, true);
}
use of org.onosproject.net.host.HostDescription in project onos by opennetworkinglab.
the class NetworkConfigHostProvider method updateHost.
/**
* Updates host information.
* IP information will be replaced if host exists.
*
* @param mac MAC address of the host
* @param vlan VLAN ID of the host
* @param locations Locations of the host
* @param auxLocations auxiliary locations of the host
* @param ips Set of IP addresses of the host
* @param innerVlan host inner VLAN identifier
* @param outerTpid outer TPID of a host
*/
protected void updateHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<HostLocation> auxLocations, Set<IpAddress> ips, VlanId innerVlan, EthType outerTpid) {
HostId hid = HostId.hostId(mac, vlan);
HostDescription desc = new DefaultHostDescription(mac, vlan, locations, auxLocations, ips, innerVlan, outerTpid, true);
providerService.hostDetected(hid, desc, true);
}
use of org.onosproject.net.host.HostDescription in project onos by opennetworkinglab.
the class NetworkConfigHostProvider method addHost.
/**
* Adds host information.
* IP information will be appended if host exists.
*
* @param mac MAC address of the host
* @param vlan VLAN ID of the host
* @param locations Locations of the host
* @param auxLocations auxiliary locations of the host
* @param ips Set of IP addresses of the host
* @param innerVlan host inner VLAN identifier
* @param outerTpid outer TPID of a host
*/
protected void addHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<HostLocation> auxLocations, Set<IpAddress> ips, VlanId innerVlan, EthType outerTpid) {
HostId hid = HostId.hostId(mac, vlan);
HostDescription desc = (ips != null) ? new DefaultHostDescription(mac, vlan, locations, auxLocations, ips, innerVlan, outerTpid, true) : new DefaultHostDescription(mac, vlan, locations, auxLocations, Collections.emptySet(), innerVlan, outerTpid, true);
providerService.hostDetected(hid, desc, true);
}
use of org.onosproject.net.host.HostDescription in project onos by opennetworkinglab.
the class HostLocationProviderTest method receiveRs.
/**
* When receiving RouterSolicitation, update location and IP.
*/
@Test
public void receiveRs() {
testProcessor.process(new TestRSPacketContext(DEV4));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat("receiveRs. No host description expected", providerService.descriptions.size(), is(1)));
final HostDescription desc = providerService.descriptions.get(0);
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(desc.location(), is(LOCATION2)));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(desc.hwAddress(), is(MAC2)));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(desc.ipAddress().toArray()[0], is(IP_ADDRESS2)));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(desc.vlan(), is(VLAN)));
}
use of org.onosproject.net.host.HostDescription in project onos by opennetworkinglab.
the class HostLocationProviderTest method receiveNs.
/**
* When receiving NeighborSolicitation, updates location and IP.
*/
@Test
public void receiveNs() {
testProcessor.process(new TestNsPacketContext(DEV4));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat("receiveNs. One host description expected", providerService.descriptions.size(), is(1)));
HostDescription descr = providerService.descriptions.get(0);
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(descr.location(), is(LOCATION2)));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(descr.hwAddress(), is(MAC2)));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(descr.ipAddress().toArray()[0], is(IP_ADDRESS2)));
TestTools.assertAfter(ASSERTION_DELAY, () -> assertThat(descr.vlan(), is(VLAN)));
}
Aggregations