blob: 759495bc63eff8dbf7915bb780aa2777e017267b [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 Pantelopoulosb21547d2018-02-22 12:32:42 -080026import org.onosproject.segmentrouting.pwaas.L2Tunnel;
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070027import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080028import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
Andreas Pantelopouloscd339592018-02-23 14:18:00 -080029import org.onosproject.segmentrouting.pwaas.L2TunnelDescription;
Saurav Das7bcbe702017-06-13 15:35:54 -070030import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Dasc88d4662017-05-15 15:34:25 -070031
32import com.google.common.collect.ImmutableMap;
Pier Luigib29144d2018-01-15 18:06:43 +010033import org.onosproject.segmentrouting.storekey.McastStoreKey;
Charles Chanc81c45b2016-10-20 17:02:44 -070034
sangho1e575652015-05-14 00:39:53 -070035import java.util.List;
Charles Chanc81c45b2016-10-20 17:02:44 -070036import java.util.Map;
37import java.util.Set;
sangho1e575652015-05-14 00:39:53 -070038
39/**
40 * Segment Routing Service for REST API.
41 */
42public interface SegmentRoutingService {
Charles Chan5270ed02016-01-30 23:22:37 -080043 /**
Charles Chan5270ed02016-01-30 23:22:37 -080044 * VLAN cross-connect priority.
45 */
46 int XCONNECT_PRIORITY = 1000;
47
48 /**
49 * Default flow priority.
50 */
51 int DEFAULT_PRIORITY = 100;
52
53 /**
54 * Minimum IP priority.
55 *
Charles Chanb54e8ba2016-02-18 10:43:46 -080056 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan5270ed02016-01-30 23:22:37 -080057 * priority default entries.
58 */
59 int MIN_IP_PRIORITY = 10;
60
61 /**
62 * Subnet flooding flow priority.
63 */
64 int FLOOD_PRIORITY = 5;
65
sangho1e575652015-05-14 00:39:53 -070066 /**
67 * Returns all tunnels.
68 *
69 * @return list of tunnels
70 */
71 List<Tunnel> getTunnels();
72
73 /**
74 * Creates a tunnel.
75 *
76 * @param tunnel tunnel reference to create
sangho71abe1b2015-06-29 14:58:47 -070077 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
78 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
79 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
80 * successfully
sangho1e575652015-05-14 00:39:53 -070081 */
sangho71abe1b2015-06-29 14:58:47 -070082 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -070083
84 /**
85 * Returns all policies.
86 *
87 * @return list of policy
88 */
89 List<Policy> getPolicies();
90
91 /**
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070092 * Returns all l2 tunnels of pseudowires.
93 *
94 * @return list of l2 tunnels
95 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -080096 List<L2Tunnel> getL2Tunnels();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070097
98 /**
99 * Returns all l2 policie of pseudowires.
100 *
101 * @return list of l2 policies.
102 */
Andreas Pantelopoulosb21547d2018-02-22 12:32:42 -0800103 List<L2TunnelPolicy> getL2Policies();
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700104
105 /**
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800106 * Removes pseudowire. Used ONLY by the REST api.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700107 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800108 * @param pwId The id of the pseudowire.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700109 * @return SUCCESS if operation successful or a descriptive error otherwise.
110 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800111 L2TunnelHandler.Result removePseudowire(Integer pwId);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700112
113 /**
114 * Adds a Pseudowire to the configuration.
115 *
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800116 * @param tunnel The pseudowire tunnel.
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700117 * @return SUCCESS if operation is successful or a descriptive error otherwise.
118 */
Andreas Pantelopouloscd339592018-02-23 14:18:00 -0800119 L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel);
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -0700120
121 /**
sangho1e575652015-05-14 00:39:53 -0700122 * Creates a policy.
123 *
124 * @param policy policy reference to create
sangho71abe1b2015-06-29 14:58:47 -0700125 * @return ID_EXISTS if the same policy ID exists,
126 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
127 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
128 * SUCCESS if the policy is created successfully.
sangho1e575652015-05-14 00:39:53 -0700129 */
sangho71abe1b2015-06-29 14:58:47 -0700130 PolicyHandler.Result createPolicy(Policy policy);
sangho1e575652015-05-14 00:39:53 -0700131
132 /**
133 * Removes a tunnel.
134 *
135 * @param tunnel tunnel reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700136 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
137 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
138 * if the tunnel is created successfully.
sangho1e575652015-05-14 00:39:53 -0700139 */
sangho71abe1b2015-06-29 14:58:47 -0700140 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -0700141
142 /**
143 * Removes a policy.
144 *
145 * @param policy policy reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700146 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
147 * SUCCESS if it is removed successfully
sangho1e575652015-05-14 00:39:53 -0700148 */
sangho71abe1b2015-06-29 14:58:47 -0700149 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das59232cf2016-04-27 18:35:50 -0700150
151 /**
152 * Use current state of the network to repopulate forwarding rules.
153 *
154 */
155 void rerouteNetwork();
Charles Chanc81c45b2016-10-20 17:02:44 -0700156
157 /**
158 * Returns device-subnet mapping.
159 *
160 * @return device-subnet mapping
161 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800162 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Dasc88d4662017-05-15 15:34:25 -0700163
164 /**
165 * Returns the current ECMP shortest path graph in this controller instance.
166 *
167 * @return ECMP shortest path graph
168 */
169 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
170
171 /**
Saurav Das7bcbe702017-06-13 15:35:54 -0700172 * Returns the destinatiomSet-NextObjective store contents.
Saurav Dasc88d4662017-05-15 15:34:25 -0700173 *
Saurav Das7bcbe702017-06-13 15:35:54 -0700174 * @return current contents of the destinationSetNextObjectiveStore
Saurav Dasc88d4662017-05-15 15:34:25 -0700175 */
Saurav Das7bcbe702017-06-13 15:35:54 -0700176 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasceccf242017-08-03 18:30:35 -0700177
178 /**
179 * Triggers the verification of all ECMP groups in the specified device.
180 * Adjusts the group buckets if verification finds that there are more or less
181 * buckets than what should be there.
182 *
183 * @param id the device identifier
184 */
185 void verifyGroups(DeviceId id);
Saurav Dasc568c342018-01-25 09:49:01 -0800186
187 /**
188 * Returns the internal link state as seen by this instance of the
189 * controller.
190 *
191 * @return the internal link state
192 */
193 ImmutableMap<Link, Boolean> getSeenLinks();
194
195 /**
196 * Returns the ports administratively disabled by the controller.
197 *
198 * @return a map of devices and port numbers for administratively disabled
199 * ports. Does not include ports manually disabled by the operator.
200 */
201 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
Pier Luigib29144d2018-01-15 18:06:43 +0100202
203 /**
204 * Returns the associated next ids to the mcast groups or to the single
205 * group if mcastIp is present.
206 *
207 * @param mcastIp the group ip
208 * @return the mapping mcastIp-device to next id
209 */
210 Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp);
211
212 /**
213 * Returns the associated roles to the mcast groups or to the single
214 * group if mcastIp is present.
215 *
216 * @param mcastIp the group ip
217 * @return the mapping mcastIp-device to mcast role
218 */
Pier Luigi96fe0772018-02-28 12:10:50 +0100219 Map<McastStoreKey, McastRole> getMcastRoles(IpAddress mcastIp);
Pier Luigib29144d2018-01-15 18:06:43 +0100220
221 /**
222 * Returns the associated paths to the mcast group.
223 *
224 * @param mcastIp the group ip
225 * @return the mapping egress point to mcast path
226 */
227 Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp);
228
sangho1e575652015-05-14 00:39:53 -0700229}