Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
Showing
141 changed files
with
89 additions
and
13 deletions
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | 6 | ||
7 | <parent> | 7 | <parent> |
8 | <groupId>org.onlab.onos</groupId> | 8 | <groupId>org.onlab.onos</groupId> |
9 | - <artifactId>onos-net</artifactId> | 9 | + <artifactId>onos-core</artifactId> |
10 | <version>1.0.0-SNAPSHOT</version> | 10 | <version>1.0.0-SNAPSHOT</version> |
11 | <relativePath>../pom.xml</relativePath> | 11 | <relativePath>../pom.xml</relativePath> |
12 | </parent> | 12 | </parent> | ... | ... |
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | +import org.onlab.packet.IPv4; | ||
4 | +import org.onlab.packet.MACAddress; | ||
5 | + | ||
6 | +import java.util.Set; | ||
7 | + | ||
3 | /** | 8 | /** |
4 | * Abstraction of an end-station host on the network, essentially a NIC. | 9 | * Abstraction of an end-station host on the network, essentially a NIC. |
5 | */ | 10 | */ |
6 | public interface Host extends Element { | 11 | public interface Host extends Element { |
7 | 12 | ||
8 | - // MAC, IP(s), optional VLAN ID | 13 | + /** |
14 | + * Host identification. | ||
15 | + * | ||
16 | + * @return host id | ||
17 | + */ | ||
18 | + HostId id(); | ||
19 | + | ||
20 | + /** | ||
21 | + * Returns the host MAC address. | ||
22 | + * | ||
23 | + * @return mac address | ||
24 | + */ | ||
25 | + MACAddress mac(); | ||
9 | 26 | ||
27 | + /** | ||
28 | + * Returns set of IP addresses currently bound to the host MAC address. | ||
29 | + * | ||
30 | + * @return set of IP addresses; empty if no IP address is bound | ||
31 | + */ | ||
32 | + Set<IPv4> ipAddresses(); | ||
10 | 33 | ||
11 | /** | 34 | /** |
12 | * Returns the most recent host location where the host attaches to the | 35 | * Returns the most recent host location where the host attaches to the |
... | @@ -16,6 +39,6 @@ public interface Host extends Element { | ... | @@ -16,6 +39,6 @@ public interface Host extends Element { |
16 | */ | 39 | */ |
17 | HostLocation location(); | 40 | HostLocation location(); |
18 | 41 | ||
19 | - // list of recent locations? | 42 | + // TODO: explore capturing list of recent locations to aid in mobility |
20 | 43 | ||
21 | } | 44 | } | ... | ... |
1 | package org.onlab.onos.net; | 1 | package org.onlab.onos.net; |
2 | 2 | ||
3 | +import org.onlab.packet.MACAddress; | ||
4 | + | ||
3 | import java.net.URI; | 5 | import java.net.URI; |
4 | 6 | ||
5 | /** | 7 | /** |
... | @@ -16,6 +18,7 @@ public final class HostId extends ElementId { | ... | @@ -16,6 +18,7 @@ public final class HostId extends ElementId { |
16 | * Creates a device id using the supplied URI. | 18 | * Creates a device id using the supplied URI. |
17 | * | 19 | * |
18 | * @param uri device URI | 20 | * @param uri device URI |
21 | + * @return host identifier | ||
19 | */ | 22 | */ |
20 | public static HostId hostId(URI uri) { | 23 | public static HostId hostId(URI uri) { |
21 | return new HostId(uri); | 24 | return new HostId(uri); |
... | @@ -25,9 +28,23 @@ public final class HostId extends ElementId { | ... | @@ -25,9 +28,23 @@ public final class HostId extends ElementId { |
25 | * Creates a device id using the supplied URI string. | 28 | * Creates a device id using the supplied URI string. |
26 | * | 29 | * |
27 | * @param string device URI string | 30 | * @param string device URI string |
31 | + * @return host identifier | ||
28 | */ | 32 | */ |
29 | public static HostId hostId(String string) { | 33 | public static HostId hostId(String string) { |
30 | return hostId(URI.create(string)); | 34 | return hostId(URI.create(string)); |
31 | } | 35 | } |
32 | 36 | ||
37 | + /** | ||
38 | + * Creates a device id using the supplied MAC & VLAN ID. | ||
39 | + * | ||
40 | + * @param mac mac address | ||
41 | + * @param vlanId vlan identifier | ||
42 | + * @return host identifier | ||
43 | + */ | ||
44 | + // FIXME: replace vlanId long with a rich data-type, e.g. VLanId or something like that | ||
45 | + public static HostId hostId(MACAddress mac, long vlanId) { | ||
46 | + // FIXME: use more efficient means of encoding | ||
47 | + return hostId("nic" + ":" + mac + "/" + vlanId); | ||
48 | + } | ||
49 | + | ||
33 | } | 50 | } | ... | ... |
... | @@ -105,7 +105,7 @@ public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> { | ... | @@ -105,7 +105,7 @@ public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> { |
105 | * | 105 | * |
106 | * @return port subject or null if the event is not port specific. | 106 | * @return port subject or null if the event is not port specific. |
107 | */ | 107 | */ |
108 | - Port port() { | 108 | + public Port port() { |
109 | return port; | 109 | return port; |
110 | } | 110 | } |
111 | 111 | ... | ... |
... | @@ -23,6 +23,11 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { | ... | @@ -23,6 +23,11 @@ public class HostEvent extends AbstractEvent<HostEvent.Type, Host> { |
23 | HOST_REMOVED, | 23 | HOST_REMOVED, |
24 | 24 | ||
25 | /** | 25 | /** |
26 | + * Signifies that host data changed, e.g. IP address | ||
27 | + */ | ||
28 | + HOST_UPDATED, | ||
29 | + | ||
30 | + /** | ||
26 | * Signifies that a host location has changed. | 31 | * Signifies that a host location has changed. |
27 | */ | 32 | */ |
28 | HOST_MOVED | 33 | HOST_MOVED | ... | ... |
1 | package org.onlab.onos.net.host; | 1 | package org.onlab.onos.net.host; |
2 | 2 | ||
3 | +import org.onlab.onos.net.HostId; | ||
3 | import org.onlab.onos.net.provider.ProviderService; | 4 | import org.onlab.onos.net.provider.ProviderService; |
4 | 5 | ||
5 | /** | 6 | /** |
... | @@ -11,15 +12,16 @@ public interface HostProviderService extends ProviderService<HostProvider> { | ... | @@ -11,15 +12,16 @@ public interface HostProviderService extends ProviderService<HostProvider> { |
11 | * Notifies the core when a host has been detected on a network along with | 12 | * Notifies the core when a host has been detected on a network along with |
12 | * information that identifies the hoot location. | 13 | * information that identifies the hoot location. |
13 | * | 14 | * |
15 | + * @param hostId id of the host that been detected | ||
14 | * @param hostDescription description of host and its location | 16 | * @param hostDescription description of host and its location |
15 | */ | 17 | */ |
16 | - void hostDetected(HostDescription hostDescription); | 18 | + void hostDetected(HostId hostId, HostDescription hostDescription); |
17 | 19 | ||
18 | /** | 20 | /** |
19 | * Notifies the core when a host is no longer detected on a network. | 21 | * Notifies the core when a host is no longer detected on a network. |
20 | * | 22 | * |
21 | - * @param hostDescription description of host | 23 | + * @param hostId id of the host that vanished |
22 | */ | 24 | */ |
23 | - void hostVanished(HostDescription hostDescription); | 25 | + void hostVanished(HostId hostId); |
24 | 26 | ||
25 | } | 27 | } | ... | ... |
... | @@ -2,8 +2,10 @@ package org.onlab.onos.net.host; | ... | @@ -2,8 +2,10 @@ package org.onlab.onos.net.host; |
2 | 2 | ||
3 | import org.onlab.onos.net.ConnectPoint; | 3 | import org.onlab.onos.net.ConnectPoint; |
4 | import org.onlab.onos.net.DeviceId; | 4 | import org.onlab.onos.net.DeviceId; |
5 | -import org.onlab.onos.net.ElementId; | ||
6 | import org.onlab.onos.net.Host; | 5 | import org.onlab.onos.net.Host; |
6 | +import org.onlab.onos.net.HostId; | ||
7 | +import org.onlab.packet.IPv4; | ||
8 | +import org.onlab.packet.MACAddress; | ||
7 | 9 | ||
8 | import java.util.Set; | 10 | import java.util.Set; |
9 | 11 | ||
... | @@ -13,6 +15,13 @@ import java.util.Set; | ... | @@ -13,6 +15,13 @@ import java.util.Set; |
13 | public interface HostService { | 15 | public interface HostService { |
14 | 16 | ||
15 | /** | 17 | /** |
18 | + * Returns the number of end-station hosts known to the system. | ||
19 | + * | ||
20 | + * @return number of end-station hosts | ||
21 | + */ | ||
22 | + public int getHostCount(); | ||
23 | + | ||
24 | + /** | ||
16 | * Returns a collection of all end-station hosts. | 25 | * Returns a collection of all end-station hosts. |
17 | * | 26 | * |
18 | * @return collection of hosts | 27 | * @return collection of hosts |
... | @@ -25,12 +34,32 @@ public interface HostService { | ... | @@ -25,12 +34,32 @@ public interface HostService { |
25 | * @param hostId host identifier | 34 | * @param hostId host identifier |
26 | * @return host or null if one with the given identifier is not known | 35 | * @return host or null if one with the given identifier is not known |
27 | */ | 36 | */ |
28 | - Host getHost(ElementId hostId); // TODO: change to HostId | 37 | + Host getHost(HostId hostId); |
38 | + | ||
39 | + /** | ||
40 | + * Returns the set of hosts that belong to the specified VLAN. | ||
41 | + * | ||
42 | + * @param vlanId vlan identifier | ||
43 | + * @return set of hosts in the given vlan id | ||
44 | + */ | ||
45 | + // FIXME: change long to VLanId | ||
46 | + Set<Host> getHostsByVlan(long vlanId); | ||
29 | 47 | ||
30 | - // TODO: determine which ones make sense or which we care to support | 48 | + /** |
31 | - // Set<Host> getHostsByVlan(VlanId vlan); | 49 | + * Returns the set of hosts that have the specified MAC address. |
32 | - // Set<Host> getHostsByMac(MacAddress mac); | 50 | + * |
33 | - // Set<Host> getHostsByIp(IpAddress ip); | 51 | + * @param mac mac address |
52 | + * @return set of hosts with the given mac | ||
53 | + */ | ||
54 | + Set<Host> getHostsByMac(MACAddress mac); | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns the set of hosts that have the specified IP address. | ||
58 | + * | ||
59 | + * @param ip ip address | ||
60 | + * @return set of hosts with the given IP | ||
61 | + */ | ||
62 | + Set<Host> getHostsByIp(IPv4 ip); | ||
34 | 63 | ||
35 | /** | 64 | /** |
36 | * Returns the set of hosts whose most recent location is the specified | 65 | * Returns the set of hosts whose most recent location is the specified | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
net/core/trivial/pom.xml
deleted
100644 → 0
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
src/main/javadoc/doc-files/onos-tiers.png
0 → 100644
41.9 KB
-
Please register or login to post a comment