blob: c329d3da21960711db743021aae2ca77277810de [file] [log] [blame]
sangho27462c62015-05-14 00:39:53 -07001/*
Brian O'Connor0947d7e2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
sangho27462c62015-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 Luigi0f9635b2018-01-15 18:06:43 +010018import org.onlab.packet.IpAddress;
Pier Ventreb6a7f342016-11-26 21:05:22 -080019import org.onlab.packet.IpPrefix;
Pier Luigi0f9635b2018-01-15 18:06:43 +010020import org.onosproject.net.ConnectPoint;
Charles Chand7844e52016-10-20 17:02:44 -070021import org.onosproject.net.DeviceId;
Saurav Das6430f412018-01-25 09:49:01 -080022import org.onosproject.net.Link;
23import org.onosproject.net.PortNumber;
Saurav Das261c3002017-06-13 15:35:54 -070024import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
Pier Luigi69f774d2018-02-28 12:10:50 +010025import org.onosproject.segmentrouting.mcast.McastRole;
Andreas Pantelopoulosfc4bc2a2018-03-12 16:30:20 -070026import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription;
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -080027import org.onosproject.segmentrouting.pwaas.L2Tunnel;
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -070028import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -080029import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
Andreas Pantelopouloscdbb22c2018-02-23 14:18:00 -080030import org.onosproject.segmentrouting.pwaas.L2TunnelDescription;
Saurav Das261c3002017-06-13 15:35:54 -070031import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Das62ae6792017-05-15 15:34:25 -070032
33import com.google.common.collect.ImmutableMap;
Pier Luigi0f9635b2018-01-15 18:06:43 +010034import org.onosproject.segmentrouting.storekey.McastStoreKey;
Charles Chand7844e52016-10-20 17:02:44 -070035
sangho27462c62015-05-14 00:39:53 -070036import java.util.List;
Charles Chand7844e52016-10-20 17:02:44 -070037import java.util.Map;
38import java.util.Set;
sangho27462c62015-05-14 00:39:53 -070039
40/**
41 * Segment Routing Service for REST API.
42 */
43public interface SegmentRoutingService {
Charles Chan82ab1932016-01-30 23:22:37 -080044 /**
Charles Chan82ab1932016-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 Chand86904c2016-02-18 10:43:46 -080057 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan82ab1932016-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
sangho27462c62015-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
sanghobd812f82015-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
sangho27462c62015-05-14 00:39:53 -070082 */
sanghobd812f82015-06-29 14:58:47 -070083 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho27462c62015-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 Pantelopoulosfc4bc2a2018-03-12 16:30:20 -070093 * Returns the l2 tunnel descriptions.
94 *
Andreas Pantelopoulosd988c1a2018-03-15 16:56:09 -070095 * @param pending if true fetch pending pseudowires, else fetch installed
Andreas Pantelopoulosfc4bc2a2018-03-12 16:30:20 -070096 * @return set of l2 tunnel descriptions.
97 */
Andreas Pantelopoulosd988c1a2018-03-15 16:56:09 -070098 Set<L2TunnelDescription> getL2TunnelDescriptions(boolean pending);
Andreas Pantelopoulosfc4bc2a2018-03-12 16:30:20 -070099
100 /**
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700101 * Returns all l2 tunnels of pseudowires.
102 *
103 * @return list of l2 tunnels
104 */
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -0800105 List<L2Tunnel> getL2Tunnels();
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700106
107 /**
108 * Returns all l2 policie of pseudowires.
109 *
110 * @return list of l2 policies.
111 */
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -0800112 List<L2TunnelPolicy> getL2Policies();
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700113
114 /**
Andreas Pantelopoulosfc4bc2a2018-03-12 16:30:20 -0700115 * Removes pseudowire.
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700116 *
Andreas Pantelopouloscdbb22c2018-02-23 14:18:00 -0800117 * @param pwId The id of the pseudowire.
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700118 * @return SUCCESS if operation successful or a descriptive error otherwise.
119 */
Andreas Pantelopouloscdbb22c2018-02-23 14:18:00 -0800120 L2TunnelHandler.Result removePseudowire(Integer pwId);
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700121
122 /**
Andreas Pantelopoulosfc4bc2a2018-03-12 16:30:20 -0700123 * Adds a Pseudowire to the system.
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700124 *
Andreas Pantelopouloscdbb22c2018-02-23 14:18:00 -0800125 * @param tunnel The pseudowire tunnel.
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700126 * @return SUCCESS if operation is successful or a descriptive error otherwise.
127 */
Andreas Pantelopouloscdbb22c2018-02-23 14:18:00 -0800128 L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel);
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700129
130 /**
Andreas Pantelopoulosfc4bc2a2018-03-12 16:30:20 -0700131 * Adss a set of pseudowires.
132 * @param l2TunnelDescriptions The pseudowires to add.
133 * @return SUCCESS if ALL pseudowires can be instantiated and are deployed, or a
134 * a descriptive error otherwise, without deploying any pseudowire.
135 */
136 L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> l2TunnelDescriptions);
137
138 /**
sangho27462c62015-05-14 00:39:53 -0700139 * Creates a policy.
140 *
141 * @param policy policy reference to create
sanghobd812f82015-06-29 14:58:47 -0700142 * @return ID_EXISTS if the same policy ID exists,
143 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
144 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
145 * SUCCESS if the policy is created successfully.
sangho27462c62015-05-14 00:39:53 -0700146 */
sanghobd812f82015-06-29 14:58:47 -0700147 PolicyHandler.Result createPolicy(Policy policy);
sangho27462c62015-05-14 00:39:53 -0700148
149 /**
150 * Removes a tunnel.
151 *
152 * @param tunnel tunnel reference to remove
sanghobd812f82015-06-29 14:58:47 -0700153 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
154 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
155 * if the tunnel is created successfully.
sangho27462c62015-05-14 00:39:53 -0700156 */
sanghobd812f82015-06-29 14:58:47 -0700157 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -0700158
159 /**
160 * Removes a policy.
161 *
162 * @param policy policy reference to remove
sanghobd812f82015-06-29 14:58:47 -0700163 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
164 * SUCCESS if it is removed successfully
sangho27462c62015-05-14 00:39:53 -0700165 */
sanghobd812f82015-06-29 14:58:47 -0700166 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das07c74602016-04-27 18:35:50 -0700167
168 /**
169 * Use current state of the network to repopulate forwarding rules.
170 *
171 */
172 void rerouteNetwork();
Charles Chand7844e52016-10-20 17:02:44 -0700173
174 /**
175 * Returns device-subnet mapping.
176 *
177 * @return device-subnet mapping
178 */
Pier Ventreb6a7f342016-11-26 21:05:22 -0800179 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Das62ae6792017-05-15 15:34:25 -0700180
181 /**
182 * Returns the current ECMP shortest path graph in this controller instance.
183 *
184 * @return ECMP shortest path graph
185 */
186 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
187
188 /**
Saurav Das261c3002017-06-13 15:35:54 -0700189 * Returns the destinatiomSet-NextObjective store contents.
Saurav Das62ae6792017-05-15 15:34:25 -0700190 *
Saurav Das261c3002017-06-13 15:35:54 -0700191 * @return current contents of the destinationSetNextObjectiveStore
Saurav Das62ae6792017-05-15 15:34:25 -0700192 */
Saurav Das261c3002017-06-13 15:35:54 -0700193 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasfbe74572017-08-03 18:30:35 -0700194
195 /**
196 * Triggers the verification of all ECMP groups in the specified device.
197 * Adjusts the group buckets if verification finds that there are more or less
198 * buckets than what should be there.
199 *
200 * @param id the device identifier
201 */
202 void verifyGroups(DeviceId id);
Saurav Das6430f412018-01-25 09:49:01 -0800203
204 /**
205 * Returns the internal link state as seen by this instance of the
206 * controller.
207 *
208 * @return the internal link state
209 */
210 ImmutableMap<Link, Boolean> getSeenLinks();
211
212 /**
213 * Returns the ports administratively disabled by the controller.
214 *
215 * @return a map of devices and port numbers for administratively disabled
216 * ports. Does not include ports manually disabled by the operator.
217 */
218 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
Pier Luigi0f9635b2018-01-15 18:06:43 +0100219
220 /**
221 * Returns the associated next ids to the mcast groups or to the single
222 * group if mcastIp is present.
223 *
224 * @param mcastIp the group ip
225 * @return the mapping mcastIp-device to next id
226 */
227 Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp);
228
229 /**
230 * Returns the associated roles to the mcast groups or to the single
231 * group if mcastIp is present.
232 *
233 * @param mcastIp the group ip
234 * @return the mapping mcastIp-device to mcast role
235 */
Pier Luigi69f774d2018-02-28 12:10:50 +0100236 Map<McastStoreKey, McastRole> getMcastRoles(IpAddress mcastIp);
Pier Luigi0f9635b2018-01-15 18:06:43 +0100237
238 /**
239 * Returns the associated paths to the mcast group.
240 *
241 * @param mcastIp the group ip
242 * @return the mapping egress point to mcast path
243 */
244 Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp);
245
sangho27462c62015-05-14 00:39:53 -0700246}