blob: 70775f0837a4da0632414505afc641f96c2dd415 [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 */
tomedf06bb2014-08-27 16:22:15 -070016package org.onlab.onos.net.link;
17
alshabibb5522ff2014-09-29 19:20:00 -070018import java.util.Set;
19
tomeadbb462014-09-07 16:10:19 -070020import org.onlab.onos.net.ConnectPoint;
tomedf06bb2014-08-27 16:22:15 -070021import org.onlab.onos.net.DeviceId;
22import org.onlab.onos.net.Link;
23
tomedf06bb2014-08-27 16:22:15 -070024/**
25 * Service for interacting with the inventory of infrastructure links.
26 */
27public interface LinkService {
28
29 /**
tomeadbb462014-09-07 16:10:19 -070030 * Returns the count of all known infrastructure links.
31 *
32 * @return number of infrastructure links
33 */
34 int getLinkCount();
35
36 /**
tomedf06bb2014-08-27 16:22:15 -070037 * Returns a collection of all known infrastructure links.
38 *
39 * @return all infrastructure links
40 */
41 Iterable<Link> getLinks();
42
43 /**
44 * Returns set of all infrastructure links leading to and from the
45 * specified device.
46 *
47 * @param deviceId device identifier
48 * @return set of device links
49 */
50 Set<Link> getDeviceLinks(DeviceId deviceId);
51
52 /**
53 * Returns set of all infrastructure links leading from the specified device.
54 *
55 * @param deviceId device identifier
56 * @return set of device egress links
57 */
58 Set<Link> getDeviceEgressLinks(DeviceId deviceId);
59
60 /**
61 * Returns set of all infrastructure links leading to the specified device.
62 *
63 * @param deviceId device identifier
64 * @return set of device ingress links
65 */
tomd176fc42014-09-08 00:12:30 -070066 Set<Link> getDeviceIngressLinks(DeviceId deviceId);
tomedf06bb2014-08-27 16:22:15 -070067
68 /**
tomeadbb462014-09-07 16:10:19 -070069 * Returns set of all infrastructure links leading to and from the
70 * specified connection point.
71 *
72 * @param connectPoint connection point
73 * @return set of links
74 */
75 Set<Link> getLinks(ConnectPoint connectPoint);
76
77 /**
78 * Returns set of all infrastructure links leading from the specified
79 * connection point.
80 *
81 * @param connectPoint connection point
82 * @return set of device egress links
83 */
84 Set<Link> getEgressLinks(ConnectPoint connectPoint);
85
86 /**
87 * Returns set of all infrastructure links leading to the specified
88 * connection point.
89 *
90 * @param connectPoint connection point
91 * @return set of device ingress links
92 */
tomd176fc42014-09-08 00:12:30 -070093 Set<Link> getIngressLinks(ConnectPoint connectPoint);
tomeadbb462014-09-07 16:10:19 -070094
95 /**
tomd176fc42014-09-08 00:12:30 -070096 * Returns the infrastructure links between the specified source
tomeadbb462014-09-07 16:10:19 -070097 * and destination connection points.
98 *
99 * @param src source connection point
100 * @param dst destination connection point
tomd176fc42014-09-08 00:12:30 -0700101 * @return link from source to destination; null if none found
tomeadbb462014-09-07 16:10:19 -0700102 */
tomd176fc42014-09-08 00:12:30 -0700103 Link getLink(ConnectPoint src, ConnectPoint dst);
tomeadbb462014-09-07 16:10:19 -0700104
105 /**
tomedf06bb2014-08-27 16:22:15 -0700106 * Adds the specified link listener.
107 *
108 * @param listener link listener
109 */
110 void addListener(LinkListener listener);
111
112 /**
113 * Removes the specified link listener.
114 *
115 * @param listener link listener
116 */
117 void removeListener(LinkListener listener);
118
119}