blob: 3c3c1fb025c235cdb48a2e32859037db775344db [file] [log] [blame]
tom35c0dc32014-09-19 10:00:58 -07001package org.onlab.onos.net.link;
2
3import org.onlab.onos.net.ConnectPoint;
4import org.onlab.onos.net.DeviceId;
5import org.onlab.onos.net.Link;
6import org.onlab.onos.net.provider.ProviderId;
7
8import java.util.Set;
9
10/**
11 * Manages inventory of infrastructure links using whatever means are appropriate.
12 */
13public interface LinkStore {
14
15 /**
16 * Returns the number of links in the store.
17 *
18 * @return number of links
19 */
20 int getLinkCount();
21
22 /**
23 * Returns an iterable collection of all links in the inventory.
24 *
25 * @return collection of all links
26 */
27 Iterable<Link> getLinks();
28
29 /**
30 * Returns all links egressing from the specified device.
31 *
32 * @param deviceId device identifier
33 * @return set of device links
34 */
35 Set<Link> getDeviceEgressLinks(DeviceId deviceId);
36
37 /**
38 * Returns all links ingressing from the specified device.
39 *
40 * @param deviceId device identifier
41 * @return set of device links
42 */
43 Set<Link> getDeviceIngressLinks(DeviceId deviceId);
44
45 /**
46 * Returns the link between the two end-points.
47 *
48 * @param src source connection point
49 * @param dst destination connection point
50 * @return link or null if one not found between the end-points
51 */
52 Link getLink(ConnectPoint src, ConnectPoint dst);
53
54 /**
55 * Returns all links egressing from the specified connection point.
56 *
57 * @param src source connection point
58 * @return set of connection point links
59 */
60 Set<Link> getEgressLinks(ConnectPoint src);
61
62 /**
63 * Returns all links ingressing to the specified connection point.
64 *
65 * @param dst destination connection point
66 * @return set of connection point links
67 */
68 Set<Link> getIngressLinks(ConnectPoint dst);
69
70 /**
71 * Creates a new link, or updates an existing one, based on the given
72 * information.
73 *
74 * @param providerId provider identity
75 * @param linkDescription link description
76 * @return create or update link event, or null if no change resulted
77 */
78 public LinkEvent createOrUpdateLink(ProviderId providerId,
79 LinkDescription linkDescription);
80
81 /**
82 * Removes the link based on the specified information.
83 *
84 * @param src link source
85 * @param dst link destination
86 * @return remove link event, or null if no change resulted
87 */
88 LinkEvent removeLink(ConnectPoint src, ConnectPoint dst);
89
90}