blob: aaaa7f9bd4cf31e49e63f433c458f0da1d8dcac4 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.link;
tomedf06bb2014-08-27 16:22:15 -070017
alshabibb5522ff2014-09-29 19:20:00 -070018import java.util.Set;
19
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070020import org.onosproject.event.ListenerService;
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.Link;
tomedf06bb2014-08-27 16:22:15 -070024
tomedf06bb2014-08-27 16:22:15 -070025/**
26 * Service for interacting with the inventory of infrastructure links.
27 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070028public interface LinkService
29 extends ListenerService<LinkEvent, LinkListener> {
tomedf06bb2014-08-27 16:22:15 -070030
31 /**
tomeadbb462014-09-07 16:10:19 -070032 * Returns the count of all known infrastructure links.
33 *
34 * @return number of infrastructure links
35 */
36 int getLinkCount();
37
38 /**
tomedf06bb2014-08-27 16:22:15 -070039 * Returns a collection of all known infrastructure links.
40 *
41 * @return all infrastructure links
42 */
43 Iterable<Link> getLinks();
44
45 /**
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080046 * Returns a collection of all active infrastructure links.
47 *
48 * @return all infrastructure links
49 */
50 Iterable<Link> getActiveLinks();
51
52 /**
tomedf06bb2014-08-27 16:22:15 -070053 * Returns set of all infrastructure links leading to and from the
54 * specified device.
55 *
56 * @param deviceId device identifier
57 * @return set of device links
58 */
59 Set<Link> getDeviceLinks(DeviceId deviceId);
60
61 /**
62 * Returns set of all infrastructure links leading from the specified device.
63 *
64 * @param deviceId device identifier
65 * @return set of device egress links
66 */
67 Set<Link> getDeviceEgressLinks(DeviceId deviceId);
68
69 /**
70 * Returns set of all infrastructure links leading to the specified device.
71 *
72 * @param deviceId device identifier
73 * @return set of device ingress links
74 */
tomd176fc42014-09-08 00:12:30 -070075 Set<Link> getDeviceIngressLinks(DeviceId deviceId);
tomedf06bb2014-08-27 16:22:15 -070076
77 /**
tomeadbb462014-09-07 16:10:19 -070078 * Returns set of all infrastructure links leading to and from the
79 * specified connection point.
80 *
81 * @param connectPoint connection point
82 * @return set of links
83 */
84 Set<Link> getLinks(ConnectPoint connectPoint);
85
86 /**
87 * Returns set of all infrastructure links leading from the specified
88 * connection point.
89 *
90 * @param connectPoint connection point
91 * @return set of device egress links
92 */
93 Set<Link> getEgressLinks(ConnectPoint connectPoint);
94
95 /**
96 * Returns set of all infrastructure links leading to the specified
97 * connection point.
98 *
99 * @param connectPoint connection point
100 * @return set of device ingress links
101 */
tomd176fc42014-09-08 00:12:30 -0700102 Set<Link> getIngressLinks(ConnectPoint connectPoint);
tomeadbb462014-09-07 16:10:19 -0700103
Thomas Vachuskaca60f2b2014-11-06 01:34:28 -0800104 // FIXME: I don't think this makes sense; discuss and remove or adjust return
105 // to be a Set<Link> or add Link.Type parameter
tomeadbb462014-09-07 16:10:19 -0700106 /**
tomd176fc42014-09-08 00:12:30 -0700107 * Returns the infrastructure links between the specified source
tomeadbb462014-09-07 16:10:19 -0700108 * and destination connection points.
109 *
110 * @param src source connection point
111 * @param dst destination connection point
tomd176fc42014-09-08 00:12:30 -0700112 * @return link from source to destination; null if none found
tomeadbb462014-09-07 16:10:19 -0700113 */
tomd176fc42014-09-08 00:12:30 -0700114 Link getLink(ConnectPoint src, ConnectPoint dst);
tomeadbb462014-09-07 16:10:19 -0700115
tomedf06bb2014-08-27 16:22:15 -0700116}