blob: fa7b7d643e694d69ea1e5f4d34308ca53fa5efbb [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;
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080025import org.onosproject.segmentrouting.pwaas.L2Tunnel;
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070026import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080027import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
Andreas Pantelopouloscd339592018-02-23 14:18:00 -080028import org.onosproject.segmentrouting.pwaas.L2TunnelDescription;
Saurav Das7bcbe702017-06-13 15:35:54 -070029import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Dasc88d4662017-05-15 15:34:25 -070030
31import com.google.common.collect.ImmutableMap;
Pier Luigib29144d2018-01-15 18:06:43 +010032import org.onosproject.segmentrouting.storekey.McastStoreKey;
Charles Chanc81c45b2016-10-20 17:02:44 -070033
sangho1e575652015-05-14 00:39:53 -070034import java.util.List;
Charles Chanc81c45b2016-10-20 17:02:44 -070035import java.util.Map;
36import java.util.Set;
sangho1e575652015-05-14 00:39:53 -070037
38/**
39 * Segment Routing Service for REST API.
40 */
41public interface SegmentRoutingService {
Charles Chan5270ed02016-01-30 23:22:37 -080042 /**
Charles Chan5270ed02016-01-30 23:22:37 -080043 * VLAN cross-connect priority.
44 */
45 int XCONNECT_PRIORITY = 1000;
46
47 /**
48 * Default flow priority.
49 */
50 int DEFAULT_PRIORITY = 100;
51
52 /**
53 * Minimum IP priority.
54 *
Charles Chanb54e8ba2016-02-18 10:43:46 -080055 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan5270ed02016-01-30 23:22:37 -080056 * priority default entries.
57 */
58 int MIN_IP_PRIORITY = 10;
59
60 /**
61 * Subnet flooding flow priority.
62 */
63 int FLOOD_PRIORITY = 5;
64
sangho1e575652015-05-14 00:39:53 -070065 /**
66 * Returns all tunnels.
67 *
68 * @return list of tunnels
69 */
70 List<Tunnel> getTunnels();
71
72 /**
73 * Creates a tunnel.
74 *
75 * @param tunnel tunnel reference to create
sangho71abe1b2015-06-29 14:58:47 -070076 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
77 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
78 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
79 * successfully
sangho1e575652015-05-14 00:39:53 -070080 */
sangho71abe1b2015-06-29 14:58:47 -070081 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -070082
83 /**
84 * Returns all policies.
85 *
86 * @return list of policy
87 */
88 List<Policy> getPolicies();
89
90 /**
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070091 * Returns all l2 tunnels of pseudowires.
92 *
93 * @return list of l2 tunnels
94 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080095 List<L2Tunnel> getL2Tunnels();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070096
97 /**
98 * Returns all l2 policie of pseudowires.
99 *
100 * @return list of l2 policies.
101 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -0800102 List<L2TunnelPolicy> getL2Policies();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700103
104 /**
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800105 * Removes pseudowire. Used ONLY by the REST api.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700106 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800107 * @param pwId The id of the pseudowire.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700108 * @return SUCCESS if operation successful or a descriptive error otherwise.
109 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800110 L2TunnelHandler.Result removePseudowire(Integer pwId);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700111
112 /**
113 * Adds a Pseudowire to the configuration.
114 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800115 * @param tunnel The pseudowire tunnel.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700116 * @return SUCCESS if operation is successful or a descriptive error otherwise.
117 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800118 L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700119
120 /**
sangho1e575652015-05-14 00:39:53 -0700121 * Creates a policy.
122 *
123 * @param policy policy reference to create
sangho71abe1b2015-06-29 14:58:47 -0700124 * @return ID_EXISTS if the same policy ID exists,
125 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
126 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
127 * SUCCESS if the policy is created successfully.
sangho1e575652015-05-14 00:39:53 -0700128 */
sangho71abe1b2015-06-29 14:58:47 -0700129 PolicyHandler.Result createPolicy(Policy policy);
sangho1e575652015-05-14 00:39:53 -0700130
131 /**
132 * Removes a tunnel.
133 *
134 * @param tunnel tunnel reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700135 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
136 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
137 * if the tunnel is created successfully.
sangho1e575652015-05-14 00:39:53 -0700138 */
sangho71abe1b2015-06-29 14:58:47 -0700139 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -0700140
141 /**
142 * Removes a policy.
143 *
144 * @param policy policy reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700145 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
146 * SUCCESS if it is removed successfully
sangho1e575652015-05-14 00:39:53 -0700147 */
sangho71abe1b2015-06-29 14:58:47 -0700148 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das59232cf2016-04-27 18:35:50 -0700149
150 /**
151 * Use current state of the network to repopulate forwarding rules.
152 *
153 */
154 void rerouteNetwork();
Charles Chanc81c45b2016-10-20 17:02:44 -0700155
156 /**
157 * Returns device-subnet mapping.
158 *
159 * @return device-subnet mapping
160 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800161 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Dasc88d4662017-05-15 15:34:25 -0700162
163 /**
164 * Returns the current ECMP shortest path graph in this controller instance.
165 *
166 * @return ECMP shortest path graph
167 */
168 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
169
170 /**
Saurav Das7bcbe702017-06-13 15:35:54 -0700171 * Returns the destinatiomSet-NextObjective store contents.
Saurav Dasc88d4662017-05-15 15:34:25 -0700172 *
Saurav Das7bcbe702017-06-13 15:35:54 -0700173 * @return current contents of the destinationSetNextObjectiveStore
Saurav Dasc88d4662017-05-15 15:34:25 -0700174 */
Saurav Das7bcbe702017-06-13 15:35:54 -0700175 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasceccf242017-08-03 18:30:35 -0700176
177 /**
178 * Triggers the verification of all ECMP groups in the specified device.
179 * Adjusts the group buckets if verification finds that there are more or less
180 * buckets than what should be there.
181 *
182 * @param id the device identifier
183 */
184 void verifyGroups(DeviceId id);
Saurav Dasc568c342018-01-25 09:49:01 -0800185
186 /**
187 * Returns the internal link state as seen by this instance of the
188 * controller.
189 *
190 * @return the internal link state
191 */
192 ImmutableMap<Link, Boolean> getSeenLinks();
193
194 /**
195 * Returns the ports administratively disabled by the controller.
196 *
197 * @return a map of devices and port numbers for administratively disabled
198 * ports. Does not include ports manually disabled by the operator.
199 */
200 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
Pier Luigib29144d2018-01-15 18:06:43 +0100201
202 /**
203 * Returns the associated next ids to the mcast groups or to the single
204 * group if mcastIp is present.
205 *
206 * @param mcastIp the group ip
207 * @return the mapping mcastIp-device to next id
208 */
209 Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp);
210
211 /**
212 * Returns the associated roles to the mcast groups or to the single
213 * group if mcastIp is present.
214 *
215 * @param mcastIp the group ip
216 * @return the mapping mcastIp-device to mcast role
217 */
218 Map<McastStoreKey, McastHandler.McastRole> getMcastRoles(IpAddress mcastIp);
219
220 /**
221 * Returns the associated paths to the mcast group.
222 *
223 * @param mcastIp the group ip
224 * @return the mapping egress point to mcast path
225 */
226 Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp);
227
sangho1e575652015-05-14 00:39:53 -0700228}