tom

Adding model abstractions to help flesh-out the concepts.

...@@ -22,7 +22,7 @@ public interface DeviceService { ...@@ -22,7 +22,7 @@ public interface DeviceService {
22 MastershipRole getRole(DeviceId deviceId); 22 MastershipRole getRole(DeviceId deviceId);
23 23
24 /** 24 /**
25 - * Returns an iterable collection of the currently known infrastructure 25 + * Returns a collection of the currently known infrastructure
26 * devices. 26 * devices.
27 * 27 *
28 * @return collection of devices 28 * @return collection of devices
......
1 +package org.onlab.onos.net.host;
2 +
3 +import org.onlab.onos.net.ConnectPoint;
4 +import org.onlab.onos.net.DeviceId;
5 +import org.onlab.onos.net.ElementId;
6 +import org.onlab.onos.net.Host;
7 +
8 +import java.util.Set;
9 +
10 +/**
11 + * Service for interacting with the inventory of end-station hosts.
12 + */
13 +public interface HostService {
14 +
15 + /**
16 + * Returns a collection of all end-station hosts.
17 + *
18 + * @return collection of hosts
19 + */
20 + Iterable<Host> getHosts();
21 +
22 + /**
23 + * Returns the host with the specified identifier.
24 + *
25 + * @param hostId host identifier
26 + * @return host or null if one with the given identifier is not known
27 + */
28 + Host getHost(ElementId hostId); // TODO: change to HostId
29 +
30 + // TODO: determine which ones make sense or which we care to support
31 + // Set<Host> getHostsByVlan(VlanId vlan);
32 + // Set<Host> getHostsByMac(MacAddress mac);
33 + // Set<Host> getHostsByIp(IpAddress ip);
34 +
35 + /**
36 + * Returns the set of hosts whose most recent location is the specified
37 + * connection point.
38 + *
39 + * @param connectPoint connection point
40 + * @return set of hosts connected to the connection point
41 + */
42 + Set<Host> getConnectedHosts(ConnectPoint connectPoint);
43 +
44 + /**
45 + * Returns the set of hosts whose most recent location is the specified
46 + * infrastructure device.
47 + *
48 + * @param deviceId device identifier
49 + * @return set of hosts connected to the device
50 + */
51 + Set<Host> getConnectedHosts(DeviceId deviceId);
52 +
53 + /**
54 + * Adds the specified host listener.
55 + *
56 + * @param listener host listener
57 + */
58 + void addListener(HostListener listener);
59 +
60 + /**
61 + * Removes the specified host listener.
62 + *
63 + * @param listener host listener
64 + */
65 + void removeListener(HostListener listener);
66 +
67 +}
1 +package org.onlab.onos.net.link;
2 +
3 +import org.onlab.onos.net.DeviceId;
4 +import org.onlab.onos.net.Link;
5 +
6 +import java.util.Set;
7 +
8 +/**
9 + * Service for interacting with the inventory of infrastructure links.
10 + */
11 +public interface LinkService {
12 +
13 + /**
14 + * Returns a collection of all known infrastructure links.
15 + *
16 + * @return all infrastructure links
17 + */
18 + Iterable<Link> getLinks();
19 +
20 + /**
21 + * Returns set of all infrastructure links leading to and from the
22 + * specified device.
23 + *
24 + * @param deviceId device identifier
25 + * @return set of device links
26 + */
27 + Set<Link> getDeviceLinks(DeviceId deviceId);
28 +
29 + /**
30 + * Returns set of all infrastructure links leading from the specified device.
31 + *
32 + * @param deviceId device identifier
33 + * @return set of device egress links
34 + */
35 + Set<Link> getDeviceEgressLinks(DeviceId deviceId);
36 +
37 + /**
38 + * Returns set of all infrastructure links leading to the specified device.
39 + *
40 + * @param deviceId device identifier
41 + * @return set of device ingress links
42 + */
43 + Set<Link> getDeviceInressLinks(DeviceId deviceId);
44 +
45 + /**
46 + * Adds the specified link listener.
47 + *
48 + * @param listener link listener
49 + */
50 + void addListener(LinkListener listener);
51 +
52 + /**
53 + * Removes the specified link listener.
54 + *
55 + * @param listener link listener
56 + */
57 + void removeListener(LinkListener listener);
58 +
59 +}
...@@ -17,4 +17,14 @@ public interface TopologyDescription extends Description { ...@@ -17,4 +17,14 @@ public interface TopologyDescription extends Description {
17 */ 17 */
18 Collection<Description> details(); 18 Collection<Description> details();
19 19
20 + // Default topology provider/computor should do the following:
21 + // create graph
22 + // search graph for SCC clusters (Tarjan)
23 + // search graph for all pairs shortest paths based on hop-count
24 + // this means all shortest paths, between all pairs; not just one shortest path
25 + // optionally use path results to produce destination-rooted broadcast trees
26 +
27 + // provide description with the graph, clusters, paths and trees upwards
28 +
20 } 29 }
30 +
......
1 +package org.onlab.onos.net.topology;
2 +
3 +import org.onlab.onos.event.AbstractEvent;
4 +import org.onlab.onos.net.Topology;
5 +
6 +/**
7 + * Describes network topology event.
8 + */
9 +public class TopologyEvent extends AbstractEvent<TopologyEvent.Type, Topology> {
10 +
11 + /**
12 + * Type of topology events.
13 + */
14 + public enum Type {
15 + /**
16 + * Signifies that topology has changed.
17 + */
18 + TOPOLOGY_CHANGED
19 + }
20 +
21 + /**
22 + * Creates an event of a given type and for the specified topology and the
23 + * current time.
24 + *
25 + * @param type topology event type
26 + * @param topology event topology subject
27 + */
28 + public TopologyEvent(Type type, Topology topology) {
29 + super(type, topology);
30 + }
31 +
32 + /**
33 + * Creates an event of a given type and for the specified topology and time.
34 + *
35 + * @param type link event type
36 + * @param topology event topology subject
37 + * @param time occurrence time
38 + */
39 + public TopologyEvent(Type type, Topology topology, long time) {
40 + super(type, topology, time);
41 + }
42 +
43 +}
1 +package org.onlab.onos.net.topology;
2 +
3 +import org.onlab.onos.event.EventListener;
4 +
5 +/**
6 + * Entity capable of receiving network topology related events.
7 + */
8 +public interface TopologyListener extends EventListener<TopologyEvent> {
9 +}
1 +package org.onlab.onos.net.topology;
2 +
3 +import org.onlab.onos.net.Topology;
4 +
5 +/**
6 + * Service for providing network topology information.
7 + */
8 +public interface TopologyService {
9 +
10 + /**
11 + * Returns the current topology descriptor.
12 + *
13 + * @return current topology
14 + */
15 + Topology currentTopology();
16 +
17 + // TODO: Figure out hot to best export graph traversal methods via Graph/Vertex/Edge
18 + // TODO: figure out how we want this to be presented, via Topology or via TopologyService
19 + // Set<TopologyCluster> getClusters(Topology topology);
20 + // Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst);
21 + // Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight);
22 + // boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
23 + // boolean isInBroadcastTree(Topology topology, ConnectPoint connectPoint);
24 +
25 + /**
26 + * Adds the specified topology listener.
27 + *
28 + * @param listener topology listener
29 + */
30 + void addListener(TopologyListener listener);
31 +
32 + /**
33 + * Removes the specified topology listener.
34 + *
35 + * @param listener topology listener
36 + */
37 + void removeListener(TopologyListener listener);
38 +
39 +}