blob: 3af4f9f799ee6f03a09eff9452ef0fcb4ddbd98a [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
tom35c0dc32014-09-19 10:00:58 -070016package org.onlab.onos.net.link;
17
18import org.onlab.onos.net.ConnectPoint;
19import org.onlab.onos.net.DeviceId;
20import org.onlab.onos.net.Link;
21import org.onlab.onos.net.provider.ProviderId;
tomf80c9722014-09-24 14:49:18 -070022import org.onlab.onos.store.Store;
tom35c0dc32014-09-19 10:00:58 -070023
24import java.util.Set;
25
26/**
tome4729872014-09-23 00:37:37 -070027 * Manages inventory of infrastructure links; not intended for direct use.
tom35c0dc32014-09-19 10:00:58 -070028 */
tomf80c9722014-09-24 14:49:18 -070029public interface LinkStore extends Store<LinkEvent, LinkStoreDelegate> {
tom35c0dc32014-09-19 10:00:58 -070030
31 /**
32 * Returns the number of links in the store.
33 *
34 * @return number of links
35 */
36 int getLinkCount();
37
38 /**
39 * Returns an iterable collection of all links in the inventory.
40 *
41 * @return collection of all links
42 */
43 Iterable<Link> getLinks();
44
45 /**
46 * Returns all links egressing from the specified device.
47 *
48 * @param deviceId device identifier
49 * @return set of device links
50 */
51 Set<Link> getDeviceEgressLinks(DeviceId deviceId);
52
53 /**
54 * Returns all links ingressing from the specified device.
55 *
56 * @param deviceId device identifier
57 * @return set of device links
58 */
59 Set<Link> getDeviceIngressLinks(DeviceId deviceId);
60
61 /**
62 * Returns the link between the two end-points.
63 *
64 * @param src source connection point
65 * @param dst destination connection point
66 * @return link or null if one not found between the end-points
67 */
68 Link getLink(ConnectPoint src, ConnectPoint dst);
69
70 /**
71 * Returns all links egressing from the specified connection point.
72 *
73 * @param src source connection point
74 * @return set of connection point links
75 */
76 Set<Link> getEgressLinks(ConnectPoint src);
77
78 /**
79 * Returns all links ingressing to the specified connection point.
80 *
81 * @param dst destination connection point
82 * @return set of connection point links
83 */
84 Set<Link> getIngressLinks(ConnectPoint dst);
85
86 /**
87 * Creates a new link, or updates an existing one, based on the given
88 * information.
89 *
90 * @param providerId provider identity
91 * @param linkDescription link description
92 * @return create or update link event, or null if no change resulted
93 */
94 public LinkEvent createOrUpdateLink(ProviderId providerId,
95 LinkDescription linkDescription);
96
97 /**
Thomas Vachuska57126fe2014-11-11 17:13:24 -080098 * Removes the link, or marks it as inactive if the link is durable,
99 * based on the specified information.
100 *
101 * @param src link source
102 * @param dst link destination
103 * @return remove or update link event, or null if no change resulted
104 */
105 LinkEvent removeOrDownLink(ConnectPoint src, ConnectPoint dst);
106
107 /**
tom35c0dc32014-09-19 10:00:58 -0700108 * Removes the link based on the specified information.
109 *
110 * @param src link source
111 * @param dst link destination
112 * @return remove link event, or null if no change resulted
113 */
114 LinkEvent removeLink(ConnectPoint src, ConnectPoint dst);
115
Thomas Vachuska57126fe2014-11-11 17:13:24 -0800116
tom35c0dc32014-09-19 10:00:58 -0700117}