blob: 6f115e4f09e63e5882873eeabc2c3959c435a0a8 [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;
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -080025import org.onosproject.segmentrouting.pwaas.L2Tunnel;
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -070026import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -080027import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
Saurav Das261c3002017-06-13 15:35:54 -070028import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Das62ae6792017-05-15 15:34:25 -070029
30import com.google.common.collect.ImmutableMap;
Pier Luigi0f9635b2018-01-15 18:06:43 +010031import org.onosproject.segmentrouting.storekey.McastStoreKey;
Charles Chand7844e52016-10-20 17:02:44 -070032
sangho27462c62015-05-14 00:39:53 -070033import java.util.List;
Charles Chand7844e52016-10-20 17:02:44 -070034import java.util.Map;
35import java.util.Set;
sangho27462c62015-05-14 00:39:53 -070036
37/**
38 * Segment Routing Service for REST API.
39 */
40public interface SegmentRoutingService {
Charles Chan82ab1932016-01-30 23:22:37 -080041 /**
Charles Chan82ab1932016-01-30 23:22:37 -080042 * VLAN cross-connect priority.
43 */
44 int XCONNECT_PRIORITY = 1000;
45
46 /**
47 * Default flow priority.
48 */
49 int DEFAULT_PRIORITY = 100;
50
51 /**
52 * Minimum IP priority.
53 *
Charles Chand86904c2016-02-18 10:43:46 -080054 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan82ab1932016-01-30 23:22:37 -080055 * priority default entries.
56 */
57 int MIN_IP_PRIORITY = 10;
58
59 /**
60 * Subnet flooding flow priority.
61 */
62 int FLOOD_PRIORITY = 5;
63
sangho27462c62015-05-14 00:39:53 -070064 /**
65 * Returns all tunnels.
66 *
67 * @return list of tunnels
68 */
69 List<Tunnel> getTunnels();
70
71 /**
72 * Creates a tunnel.
73 *
74 * @param tunnel tunnel reference to create
sanghobd812f82015-06-29 14:58:47 -070075 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
76 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
77 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
78 * successfully
sangho27462c62015-05-14 00:39:53 -070079 */
sanghobd812f82015-06-29 14:58:47 -070080 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -070081
82 /**
83 * Returns all policies.
84 *
85 * @return list of policy
86 */
87 List<Policy> getPolicies();
88
89 /**
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -070090 * Returns all l2 tunnels of pseudowires.
91 *
92 * @return list of l2 tunnels
93 */
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -080094 List<L2Tunnel> getL2Tunnels();
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -070095
96 /**
97 * Returns all l2 policie of pseudowires.
98 *
99 * @return list of l2 policies.
100 */
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -0800101 List<L2TunnelPolicy> getL2Policies();
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700102
103 /**
104 * Removes pw. Essentially updates configuration for PwaasConfig
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -0800105 * and sends event for removal. The rest are handled by DefaultL2TunnelHandler
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700106 *
107 * @param pwId The pseudowire id
108 * @return SUCCESS if operation successful or a descriptive error otherwise.
109 */
110 L2TunnelHandler.Result removePseudowire(String pwId);
111
112 /**
113 * Adds a Pseudowire to the configuration.
114 *
115 * @param tunnelId The pseudowire id
116 * @param pwLabel Pw label
117 * @param cP1 Connection Point 1 of pw
118 * @param cP1InnerVlan Outer vlan of cp2
119 * @param cP1OuterVlan Outer vlan of cp1
120 * @param cP2 Connection Point 2 of pw
121 * @param cP2InnerVlan Inner vlan of cp2
122 * @param cP2OuterVlan Outer vlan of cp1
123 * @param mode Mode of pw
124 * @param sdTag Service Delimiting tag of pw
125 * @return SUCCESS if operation is successful or a descriptive error otherwise.
126 */
127 L2TunnelHandler.Result addPseudowire(String tunnelId, String pwLabel, String cP1,
Andreas Pantelopoulos4c7de132018-02-22 12:32:42 -0800128 String cP1InnerVlan, String cP1OuterVlan, String cP2,
129 String cP2InnerVlan, String cP2OuterVlan,
130 String mode, String sdTag);
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -0700131
132 /**
sangho27462c62015-05-14 00:39:53 -0700133 * Creates a policy.
134 *
135 * @param policy policy reference to create
sanghobd812f82015-06-29 14:58:47 -0700136 * @return ID_EXISTS if the same policy ID exists,
137 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
138 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
139 * SUCCESS if the policy is created successfully.
sangho27462c62015-05-14 00:39:53 -0700140 */
sanghobd812f82015-06-29 14:58:47 -0700141 PolicyHandler.Result createPolicy(Policy policy);
sangho27462c62015-05-14 00:39:53 -0700142
143 /**
144 * Removes a tunnel.
145 *
146 * @param tunnel tunnel reference to remove
sanghobd812f82015-06-29 14:58:47 -0700147 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
148 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
149 * if the tunnel is created successfully.
sangho27462c62015-05-14 00:39:53 -0700150 */
sanghobd812f82015-06-29 14:58:47 -0700151 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -0700152
153 /**
154 * Removes a policy.
155 *
156 * @param policy policy reference to remove
sanghobd812f82015-06-29 14:58:47 -0700157 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
158 * SUCCESS if it is removed successfully
sangho27462c62015-05-14 00:39:53 -0700159 */
sanghobd812f82015-06-29 14:58:47 -0700160 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das07c74602016-04-27 18:35:50 -0700161
162 /**
163 * Use current state of the network to repopulate forwarding rules.
164 *
165 */
166 void rerouteNetwork();
Charles Chand7844e52016-10-20 17:02:44 -0700167
168 /**
169 * Returns device-subnet mapping.
170 *
171 * @return device-subnet mapping
172 */
Pier Ventreb6a7f342016-11-26 21:05:22 -0800173 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Das62ae6792017-05-15 15:34:25 -0700174
175 /**
176 * Returns the current ECMP shortest path graph in this controller instance.
177 *
178 * @return ECMP shortest path graph
179 */
180 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
181
182 /**
Saurav Das261c3002017-06-13 15:35:54 -0700183 * Returns the destinatiomSet-NextObjective store contents.
Saurav Das62ae6792017-05-15 15:34:25 -0700184 *
Saurav Das261c3002017-06-13 15:35:54 -0700185 * @return current contents of the destinationSetNextObjectiveStore
Saurav Das62ae6792017-05-15 15:34:25 -0700186 */
Saurav Das261c3002017-06-13 15:35:54 -0700187 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasfbe74572017-08-03 18:30:35 -0700188
189 /**
190 * Triggers the verification of all ECMP groups in the specified device.
191 * Adjusts the group buckets if verification finds that there are more or less
192 * buckets than what should be there.
193 *
194 * @param id the device identifier
195 */
196 void verifyGroups(DeviceId id);
Saurav Das6430f412018-01-25 09:49:01 -0800197
198 /**
199 * Returns the internal link state as seen by this instance of the
200 * controller.
201 *
202 * @return the internal link state
203 */
204 ImmutableMap<Link, Boolean> getSeenLinks();
205
206 /**
207 * Returns the ports administratively disabled by the controller.
208 *
209 * @return a map of devices and port numbers for administratively disabled
210 * ports. Does not include ports manually disabled by the operator.
211 */
212 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
Pier Luigi0f9635b2018-01-15 18:06:43 +0100213
214 /**
215 * Returns the associated next ids to the mcast groups or to the single
216 * group if mcastIp is present.
217 *
218 * @param mcastIp the group ip
219 * @return the mapping mcastIp-device to next id
220 */
221 Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp);
222
223 /**
224 * Returns the associated roles to the mcast groups or to the single
225 * group if mcastIp is present.
226 *
227 * @param mcastIp the group ip
228 * @return the mapping mcastIp-device to mcast role
229 */
230 Map<McastStoreKey, McastHandler.McastRole> getMcastRoles(IpAddress mcastIp);
231
232 /**
233 * Returns the associated paths to the mcast group.
234 *
235 * @param mcastIp the group ip
236 * @return the mapping egress point to mcast path
237 */
238 Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp);
239
sangho27462c62015-05-14 00:39:53 -0700240}