Search in sources :

Example 11 with DefaultHostDescription

use of org.onosproject.net.host.DefaultHostDescription 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);
}
Also used : DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostId(org.onosproject.net.HostId) DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostDescription(org.onosproject.net.host.HostDescription)

Example 12 with DefaultHostDescription

use of org.onosproject.net.host.DefaultHostDescription 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);
}
Also used : DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostId(org.onosproject.net.HostId) DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostDescription(org.onosproject.net.host.HostDescription)

Example 13 with DefaultHostDescription

use of org.onosproject.net.host.DefaultHostDescription 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 Location of the host
 * @param ips Set of IP addresses of the host
 */
protected void addHost(MacAddress mac, VlanId vlan, Set<HostLocation> locations, Set<IpAddress> ips) {
    HostId hid = HostId.hostId(mac, vlan);
    HostDescription desc = (ips != null) ? new DefaultHostDescription(mac, vlan, locations, ips, true) : new DefaultHostDescription(mac, vlan, locations, Collections.emptySet(), true);
    providerService.hostDetected(hid, desc, true);
}
Also used : DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostId(org.onosproject.net.HostId) DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostDescription(org.onosproject.net.host.HostDescription)

Example 14 with DefaultHostDescription

use of org.onosproject.net.host.DefaultHostDescription in project onos by opennetworkinglab.

the class NetworkConfigHostProviderTest method setUp.

@Before
public void setUp() {
    provider.providerService = providerService;
    // Initialize test variables
    ips.add(IpAddress.valueOf("10.0.0.1"));
    ips.add(IpAddress.valueOf("192.168.0.1"));
    hostDescription = new DefaultHostDescription(mac, vlan, locations, auxLocations, ips, innerVlan, outerTpid, true);
}
Also used : DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) Before(org.junit.Before)

Example 15 with DefaultHostDescription

use of org.onosproject.net.host.DefaultHostDescription in project onos by opennetworkinglab.

the class OpenstackSwitchingHostProviderTest method testProcessPortAddedForNewAddition.

/**
 * Tests the process port added method for new addition case.
 */
@Test
public void testProcessPortAddedForNewAddition() {
    org.onosproject.net.Port port = new DefaultPort(DEV2, P1, true, ANNOTATIONS);
    DeviceEvent event = new DeviceEvent(DeviceEvent.Type.PORT_ADDED, DEV2, port);
    target.portAddedHelper(event);
    HostId hostId = HostId.hostId(HOST_MAC2);
    HostDescription hostDesc = new DefaultHostDescription(HOST_MAC2, VlanId.NONE, new HostLocation(CP21, System.currentTimeMillis()), ImmutableSet.of(HOST_IP11), ANNOTATIONS);
    verifyHostResult(hostId, hostDesc);
}
Also used : DeviceEvent(org.onosproject.net.device.DeviceEvent) DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostLocation(org.onosproject.net.HostLocation) HostId(org.onosproject.net.HostId) DefaultPort(org.onosproject.net.DefaultPort) DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) HostDescription(org.onosproject.net.host.HostDescription) Test(org.junit.Test)

Aggregations

DefaultHostDescription (org.onosproject.net.host.DefaultHostDescription)16 HostDescription (org.onosproject.net.host.HostDescription)12 HostId (org.onosproject.net.HostId)10 HostLocation (org.onosproject.net.HostLocation)7 IpAddress (org.onlab.packet.IpAddress)4 MacAddress (org.onlab.packet.MacAddress)4 VlanId (org.onlab.packet.VlanId)4 Host (org.onosproject.net.Host)4 DeviceEvent (org.onosproject.net.device.DeviceEvent)4 ConnectPoint (org.onosproject.net.ConnectPoint)3 Strings (com.google.common.base.Strings)2 Set (java.util.Set)2 ExecutorService (java.util.concurrent.ExecutorService)2 Executors (java.util.concurrent.Executors)2 Collectors (java.util.stream.Collectors)2 Tools (org.onlab.util.Tools)2 Tools.groupedThreads (org.onlab.util.Tools.groupedThreads)2 CoreService (org.onosproject.core.CoreService)2 MastershipService (org.onosproject.mastership.MastershipService)2 PORT_NAME (org.onosproject.net.AnnotationKeys.PORT_NAME)2