blob: dc3d7b1b649db4c072c4c47a9246e637e8d8c4ba [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 *
95 * @return set of l2 tunnel descriptions.
96 */
97 Set<L2TunnelDescription> getL2TunnelDescriptions();
98
99 /**
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700100 * Returns all l2 tunnels of pseudowires.
101 *
102 * @return list of l2 tunnels
103 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -0800104 List<L2Tunnel> getL2Tunnels();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700105
106 /**
107 * Returns all l2 policie of pseudowires.
108 *
109 * @return list of l2 policies.
110 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -0800111 List<L2TunnelPolicy> getL2Policies();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700112
113 /**
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700114 * Removes pseudowire.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700115 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800116 * @param pwId The id of the pseudowire.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700117 * @return SUCCESS if operation successful or a descriptive error otherwise.
118 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800119 L2TunnelHandler.Result removePseudowire(Integer pwId);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700120
121 /**
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700122 * Adds a Pseudowire to the system.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700123 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800124 * @param tunnel The pseudowire tunnel.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700125 * @return SUCCESS if operation is successful or a descriptive error otherwise.
126 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800127 L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700128
129 /**
Andreas Pantelopoulosff691b72018-03-12 16:30:20 -0700130 * Adss a set of pseudowires.
131 * @param l2TunnelDescriptions The pseudowires to add.
132 * @return SUCCESS if ALL pseudowires can be instantiated and are deployed, or a
133 * a descriptive error otherwise, without deploying any pseudowire.
134 */
135 L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> l2TunnelDescriptions);
136
137 /**
sangho1e575652015-05-14 00:39:53 -0700138 * Creates a policy.
139 *
140 * @param policy policy reference to create
sangho71abe1b2015-06-29 14:58:47 -0700141 * @return ID_EXISTS if the same policy ID exists,
142 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
143 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
144 * SUCCESS if the policy is created successfully.
sangho1e575652015-05-14 00:39:53 -0700145 */
sangho71abe1b2015-06-29 14:58:47 -0700146 PolicyHandler.Result createPolicy(Policy policy);
sangho1e575652015-05-14 00:39:53 -0700147
148 /**
149 * Removes a tunnel.
150 *
151 * @param tunnel tunnel reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700152 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
153 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
154 * if the tunnel is created successfully.
sangho1e575652015-05-14 00:39:53 -0700155 */
sangho71abe1b2015-06-29 14:58:47 -0700156 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -0700157
158 /**
159 * Removes a policy.
160 *
161 * @param policy policy reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700162 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
163 * SUCCESS if it is removed successfully
sangho1e575652015-05-14 00:39:53 -0700164 */
sangho71abe1b2015-06-29 14:58:47 -0700165 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das59232cf2016-04-27 18:35:50 -0700166
167 /**
168 * Use current state of the network to repopulate forwarding rules.
169 *
170 */
171 void rerouteNetwork();
Charles Chanc81c45b2016-10-20 17:02:44 -0700172
173 /**
174 * Returns device-subnet mapping.
175 *
176 * @return device-subnet mapping
177 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800178 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Dasc88d4662017-05-15 15:34:25 -0700179
180 /**
181 * Returns the current ECMP shortest path graph in this controller instance.
182 *
183 * @return ECMP shortest path graph
184 */
185 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
186
187 /**
Saurav Das7bcbe702017-06-13 15:35:54 -0700188 * Returns the destinatiomSet-NextObjective store contents.
Saurav Dasc88d4662017-05-15 15:34:25 -0700189 *
Saurav Das7bcbe702017-06-13 15:35:54 -0700190 * @return current contents of the destinationSetNextObjectiveStore
Saurav Dasc88d4662017-05-15 15:34:25 -0700191 */
Saurav Das7bcbe702017-06-13 15:35:54 -0700192 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasceccf242017-08-03 18:30:35 -0700193
194 /**
195 * Triggers the verification of all ECMP groups in the specified device.
196 * Adjusts the group buckets if verification finds that there are more or less
197 * buckets than what should be there.
198 *
199 * @param id the device identifier
200 */
201 void verifyGroups(DeviceId id);
Saurav Dasc568c342018-01-25 09:49:01 -0800202
203 /**
204 * Returns the internal link state as seen by this instance of the
205 * controller.
206 *
207 * @return the internal link state
208 */
209 ImmutableMap<Link, Boolean> getSeenLinks();
210
211 /**
212 * Returns the ports administratively disabled by the controller.
213 *
214 * @return a map of devices and port numbers for administratively disabled
215 * ports. Does not include ports manually disabled by the operator.
216 */
217 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
Pier Luigib29144d2018-01-15 18:06:43 +0100218
219 /**
220 * Returns the associated next ids to the mcast groups or to the single
221 * group if mcastIp is present.
222 *
223 * @param mcastIp the group ip
224 * @return the mapping mcastIp-device to next id
225 */
226 Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp);
227
228 /**
229 * Returns the associated roles to the mcast groups or to the single
230 * group if mcastIp is present.
231 *
232 * @param mcastIp the group ip
233 * @return the mapping mcastIp-device to mcast role
234 */
Pier Luigi96fe0772018-02-28 12:10:50 +0100235 Map<McastStoreKey, McastRole> getMcastRoles(IpAddress mcastIp);
Pier Luigib29144d2018-01-15 18:06:43 +0100236
237 /**
238 * Returns the associated paths to the mcast group.
239 *
240 * @param mcastIp the group ip
241 * @return the mapping egress point to mcast path
242 */
243 Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp);
244
sangho1e575652015-05-14 00:39:53 -0700245}