blob: b6887261b633fa883b35ff6f1923ed396a0609d1 [file] [log] [blame]
sangho1e575652015-05-14 00:39:53 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
sangho1e575652015-05-14 00:39:53 -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 */
16package org.onosproject.segmentrouting;
17
Pier Luigib29144d2018-01-15 18:06:43 +010018import org.onlab.packet.IpAddress;
Pier Ventre10bd8d12016-11-26 21:05:22 -080019import org.onlab.packet.IpPrefix;
Pier Luigib29144d2018-01-15 18:06:43 +010020import org.onosproject.net.ConnectPoint;
Charles Chanc81c45b2016-10-20 17:02:44 -070021import org.onosproject.net.DeviceId;
Saurav Dasc568c342018-01-25 09:49:01 -080022import org.onosproject.net.Link;
23import org.onosproject.net.PortNumber;
Saurav Das7bcbe702017-06-13 15:35:54 -070024import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
Pier Luigi96fe0772018-02-28 12:10:50 +010025import org.onosproject.segmentrouting.mcast.McastRole;
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -070026import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription;
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080027import org.onosproject.segmentrouting.pwaas.L2Tunnel;
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070028import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080029import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
Andreas Pantelopouloscd339592018-02-23 14:18:00 -080030import org.onosproject.segmentrouting.pwaas.L2TunnelDescription;
Saurav Das7bcbe702017-06-13 15:35:54 -070031import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Dasc88d4662017-05-15 15:34:25 -070032
33import com.google.common.collect.ImmutableMap;
Pier Luigib29144d2018-01-15 18:06:43 +010034import org.onosproject.segmentrouting.storekey.McastStoreKey;
Charles Chanc81c45b2016-10-20 17:02:44 -070035
sangho1e575652015-05-14 00:39:53 -070036import java.util.List;
Charles Chanc81c45b2016-10-20 17:02:44 -070037import java.util.Map;
38import java.util.Set;
sangho1e575652015-05-14 00:39:53 -070039
40/**
41 * Segment Routing Service for REST API.
42 */
43public interface SegmentRoutingService {
Charles Chan5270ed02016-01-30 23:22:37 -080044 /**
Charles Chan5270ed02016-01-30 23:22:37 -080045 * VLAN cross-connect priority.
46 */
47 int XCONNECT_PRIORITY = 1000;
48
49 /**
50 * Default flow priority.
51 */
52 int DEFAULT_PRIORITY = 100;
53
54 /**
55 * Minimum IP priority.
56 *
Charles Chanb54e8ba2016-02-18 10:43:46 -080057 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan5270ed02016-01-30 23:22:37 -080058 * priority default entries.
59 */
60 int MIN_IP_PRIORITY = 10;
61
62 /**
63 * Subnet flooding flow priority.
64 */
65 int FLOOD_PRIORITY = 5;
66
sangho1e575652015-05-14 00:39:53 -070067 /**
68 * Returns all tunnels.
69 *
70 * @return list of tunnels
71 */
72 List<Tunnel> getTunnels();
73
74 /**
75 * Creates a tunnel.
76 *
77 * @param tunnel tunnel reference to create
sangho71abe1b2015-06-29 14:58:47 -070078 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
79 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
80 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
81 * successfully
sangho1e575652015-05-14 00:39:53 -070082 */
sangho71abe1b2015-06-29 14:58:47 -070083 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -070084
85 /**
86 * Returns all policies.
87 *
88 * @return list of policy
89 */
90 List<Policy> getPolicies();
91
92 /**
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -070093 * Returns the l2 tunnel descriptions.
94 *
Andreas Pantelopoulos811bbae2018-03-15 16:56:09 -070095 * @param pending if true fetch pending pseudowires, else fetch installed
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -070096 * @return set of l2 tunnel descriptions.
97 */
Andreas Pantelopoulos811bbae2018-03-15 16:56:09 -070098 Set<L2TunnelDescription> getL2TunnelDescriptions(boolean pending);
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -070099
100 /**
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700101 * Returns all l2 tunnels of pseudowires.
102 *
103 * @return list of l2 tunnels
104 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -0800105 List<L2Tunnel> getL2Tunnels();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700106
107 /**
108 * Returns all l2 policie of pseudowires.
109 *
110 * @return list of l2 policies.
111 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -0800112 List<L2TunnelPolicy> getL2Policies();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700113
114 /**
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700115 * Removes pseudowire.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700116 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800117 * @param pwId The id of the pseudowire.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700118 * @return SUCCESS if operation successful or a descriptive error otherwise.
119 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800120 L2TunnelHandler.Result removePseudowire(Integer pwId);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700121
122 /**
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700123 * Adds a Pseudowire to the system.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700124 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800125 * @param tunnel The pseudowire tunnel.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700126 * @return SUCCESS if operation is successful or a descriptive error otherwise.
127 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800128 L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700129
130 /**
Andreas Pantelopoulosffe69742018-03-20 13:58:49 -0700131 * Adds a set of pseudowires.
132 *
133 *
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700134 * @param l2TunnelDescriptions The pseudowires to add.
135 * @return SUCCESS if ALL pseudowires can be instantiated and are deployed, or a
136 * a descriptive error otherwise, without deploying any pseudowire.
Andreas Pantelopoulosffe69742018-03-20 13:58:49 -0700137 * @deprecated onos-1.12 use addPseudowire instead
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700138 */
Andreas Pantelopoulosffe69742018-03-20 13:58:49 -0700139 @Deprecated
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700140 L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> l2TunnelDescriptions);
141
142 /**
sangho1e575652015-05-14 00:39:53 -0700143 * Creates a policy.
144 *
145 * @param policy policy reference to create
sangho71abe1b2015-06-29 14:58:47 -0700146 * @return ID_EXISTS if the same policy ID exists,
147 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
148 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
149 * SUCCESS if the policy is created successfully.
sangho1e575652015-05-14 00:39:53 -0700150 */
sangho71abe1b2015-06-29 14:58:47 -0700151 PolicyHandler.Result createPolicy(Policy policy);
sangho1e575652015-05-14 00:39:53 -0700152
153 /**
154 * Removes a tunnel.
155 *
156 * @param tunnel tunnel reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700157 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
158 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
159 * if the tunnel is created successfully.
sangho1e575652015-05-14 00:39:53 -0700160 */
sangho71abe1b2015-06-29 14:58:47 -0700161 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -0700162
163 /**
164 * Removes a policy.
165 *
166 * @param policy policy reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700167 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
168 * SUCCESS if it is removed successfully
sangho1e575652015-05-14 00:39:53 -0700169 */
sangho71abe1b2015-06-29 14:58:47 -0700170 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das59232cf2016-04-27 18:35:50 -0700171
172 /**
173 * Use current state of the network to repopulate forwarding rules.
174 *
175 */
176 void rerouteNetwork();
Charles Chanc81c45b2016-10-20 17:02:44 -0700177
178 /**
179 * Returns device-subnet mapping.
180 *
181 * @return device-subnet mapping
182 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800183 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Dasc88d4662017-05-15 15:34:25 -0700184
185 /**
186 * Returns the current ECMP shortest path graph in this controller instance.
187 *
188 * @return ECMP shortest path graph
189 */
190 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
191
192 /**
Saurav Das7bcbe702017-06-13 15:35:54 -0700193 * Returns the destinatiomSet-NextObjective store contents.
Saurav Dasc88d4662017-05-15 15:34:25 -0700194 *
Saurav Das7bcbe702017-06-13 15:35:54 -0700195 * @return current contents of the destinationSetNextObjectiveStore
Saurav Dasc88d4662017-05-15 15:34:25 -0700196 */
Saurav Das7bcbe702017-06-13 15:35:54 -0700197 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasceccf242017-08-03 18:30:35 -0700198
199 /**
200 * Triggers the verification of all ECMP groups in the specified device.
201 * Adjusts the group buckets if verification finds that there are more or less
202 * buckets than what should be there.
203 *
204 * @param id the device identifier
205 */
206 void verifyGroups(DeviceId id);
Saurav Dasc568c342018-01-25 09:49:01 -0800207
208 /**
209 * Returns the internal link state as seen by this instance of the
210 * controller.
211 *
212 * @return the internal link state
213 */
214 ImmutableMap<Link, Boolean> getSeenLinks();
215
216 /**
217 * Returns the ports administratively disabled by the controller.
218 *
219 * @return a map of devices and port numbers for administratively disabled
220 * ports. Does not include ports manually disabled by the operator.
221 */
222 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
Pier Luigib29144d2018-01-15 18:06:43 +0100223
224 /**
225 * Returns the associated next ids to the mcast groups or to the single
226 * group if mcastIp is present.
227 *
228 * @param mcastIp the group ip
229 * @return the mapping mcastIp-device to next id
230 */
231 Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp);
232
233 /**
234 * Returns the associated roles to the mcast groups or to the single
235 * group if mcastIp is present.
236 *
237 * @param mcastIp the group ip
238 * @return the mapping mcastIp-device to mcast role
239 */
Pier Luigi96fe0772018-02-28 12:10:50 +0100240 Map<McastStoreKey, McastRole> getMcastRoles(IpAddress mcastIp);
Pier Luigib29144d2018-01-15 18:06:43 +0100241
242 /**
243 * Returns the associated paths to the mcast group.
244 *
245 * @param mcastIp the group ip
246 * @return the mapping egress point to mcast path
247 */
248 Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp);
249
sangho1e575652015-05-14 00:39:53 -0700250}