blob: 3269657fefc4ae5b5f1aee1a4bc07355df539e40 [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 Ventreb6a7f342016-11-26 21:05:22 -080018import org.onlab.packet.IpPrefix;
Charles Chand7844e52016-10-20 17:02:44 -070019import org.onosproject.net.DeviceId;
Saurav Das6430f412018-01-25 09:49:01 -080020import org.onosproject.net.Link;
21import org.onosproject.net.PortNumber;
Saurav Das261c3002017-06-13 15:35:54 -070022import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -070023import org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel;
24import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy;
25import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Saurav Das261c3002017-06-13 15:35:54 -070026import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Das62ae6792017-05-15 15:34:25 -070027
28import com.google.common.collect.ImmutableMap;
Charles Chand7844e52016-10-20 17:02:44 -070029
sangho27462c62015-05-14 00:39:53 -070030import java.util.List;
Charles Chand7844e52016-10-20 17:02:44 -070031import java.util.Map;
32import java.util.Set;
sangho27462c62015-05-14 00:39:53 -070033
34/**
35 * Segment Routing Service for REST API.
36 */
37public interface SegmentRoutingService {
Charles Chan82ab1932016-01-30 23:22:37 -080038 /**
Charles Chan82ab1932016-01-30 23:22:37 -080039 * VLAN cross-connect priority.
40 */
41 int XCONNECT_PRIORITY = 1000;
42
43 /**
44 * Default flow priority.
45 */
46 int DEFAULT_PRIORITY = 100;
47
48 /**
49 * Minimum IP priority.
50 *
Charles Chand86904c2016-02-18 10:43:46 -080051 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan82ab1932016-01-30 23:22:37 -080052 * priority default entries.
53 */
54 int MIN_IP_PRIORITY = 10;
55
56 /**
57 * Subnet flooding flow priority.
58 */
59 int FLOOD_PRIORITY = 5;
60
sangho27462c62015-05-14 00:39:53 -070061 /**
62 * Returns all tunnels.
63 *
64 * @return list of tunnels
65 */
66 List<Tunnel> getTunnels();
67
68 /**
69 * Creates a tunnel.
70 *
71 * @param tunnel tunnel reference to create
sanghobd812f82015-06-29 14:58:47 -070072 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
73 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
74 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
75 * successfully
sangho27462c62015-05-14 00:39:53 -070076 */
sanghobd812f82015-06-29 14:58:47 -070077 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -070078
79 /**
80 * Returns all policies.
81 *
82 * @return list of policy
83 */
84 List<Policy> getPolicies();
85
86 /**
Andreas Pantelopoulos5e7be3d2017-10-23 12:18:25 -070087 * Returns all l2 tunnels of pseudowires.
88 *
89 * @return list of l2 tunnels
90 */
91 List<DefaultL2Tunnel> getL2Tunnels();
92
93 /**
94 * Returns all l2 policie of pseudowires.
95 *
96 * @return list of l2 policies.
97 */
98 List<DefaultL2TunnelPolicy> getL2Policies();
99
100 /**
101 * Removes pw. Essentially updates configuration for PwaasConfig
102 * and sends event for removal. The rest are handled by L2TunnelHandler
103 *
104 * @param pwId The pseudowire id
105 * @return SUCCESS if operation successful or a descriptive error otherwise.
106 */
107 L2TunnelHandler.Result removePseudowire(String pwId);
108
109 /**
110 * Adds a Pseudowire to the configuration.
111 *
112 * @param tunnelId The pseudowire id
113 * @param pwLabel Pw label
114 * @param cP1 Connection Point 1 of pw
115 * @param cP1InnerVlan Outer vlan of cp2
116 * @param cP1OuterVlan Outer vlan of cp1
117 * @param cP2 Connection Point 2 of pw
118 * @param cP2InnerVlan Inner vlan of cp2
119 * @param cP2OuterVlan Outer vlan of cp1
120 * @param mode Mode of pw
121 * @param sdTag Service Delimiting tag of pw
122 * @return SUCCESS if operation is successful or a descriptive error otherwise.
123 */
124 L2TunnelHandler.Result addPseudowire(String tunnelId, String pwLabel, String cP1,
125 String cP1InnerVlan, String cP1OuterVlan, String cP2,
126 String cP2InnerVlan, String cP2OuterVlan,
127 String mode, String sdTag);
128
129 /**
sangho27462c62015-05-14 00:39:53 -0700130 * Creates a policy.
131 *
132 * @param policy policy reference to create
sanghobd812f82015-06-29 14:58:47 -0700133 * @return ID_EXISTS if the same policy ID exists,
134 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
135 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
136 * SUCCESS if the policy is created successfully.
sangho27462c62015-05-14 00:39:53 -0700137 */
sanghobd812f82015-06-29 14:58:47 -0700138 PolicyHandler.Result createPolicy(Policy policy);
sangho27462c62015-05-14 00:39:53 -0700139
140 /**
141 * Removes a tunnel.
142 *
143 * @param tunnel tunnel reference to remove
sanghobd812f82015-06-29 14:58:47 -0700144 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
145 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
146 * if the tunnel is created successfully.
sangho27462c62015-05-14 00:39:53 -0700147 */
sanghobd812f82015-06-29 14:58:47 -0700148 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -0700149
150 /**
151 * Removes a policy.
152 *
153 * @param policy policy reference to remove
sanghobd812f82015-06-29 14:58:47 -0700154 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
155 * SUCCESS if it is removed successfully
sangho27462c62015-05-14 00:39:53 -0700156 */
sanghobd812f82015-06-29 14:58:47 -0700157 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das07c74602016-04-27 18:35:50 -0700158
159 /**
160 * Use current state of the network to repopulate forwarding rules.
161 *
162 */
163 void rerouteNetwork();
Charles Chand7844e52016-10-20 17:02:44 -0700164
165 /**
166 * Returns device-subnet mapping.
167 *
168 * @return device-subnet mapping
169 */
Pier Ventreb6a7f342016-11-26 21:05:22 -0800170 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Das62ae6792017-05-15 15:34:25 -0700171
172 /**
173 * Returns the current ECMP shortest path graph in this controller instance.
174 *
175 * @return ECMP shortest path graph
176 */
177 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
178
179 /**
Saurav Das261c3002017-06-13 15:35:54 -0700180 * Returns the destinatiomSet-NextObjective store contents.
Saurav Das62ae6792017-05-15 15:34:25 -0700181 *
Saurav Das261c3002017-06-13 15:35:54 -0700182 * @return current contents of the destinationSetNextObjectiveStore
Saurav Das62ae6792017-05-15 15:34:25 -0700183 */
Saurav Das261c3002017-06-13 15:35:54 -0700184 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasfbe74572017-08-03 18:30:35 -0700185
186 /**
187 * Triggers the verification of all ECMP groups in the specified device.
188 * Adjusts the group buckets if verification finds that there are more or less
189 * buckets than what should be there.
190 *
191 * @param id the device identifier
192 */
193 void verifyGroups(DeviceId id);
Saurav Das6430f412018-01-25 09:49:01 -0800194
195 /**
196 * Returns the internal link state as seen by this instance of the
197 * controller.
198 *
199 * @return the internal link state
200 */
201 ImmutableMap<Link, Boolean> getSeenLinks();
202
203 /**
204 * Returns the ports administratively disabled by the controller.
205 *
206 * @return a map of devices and port numbers for administratively disabled
207 * ports. Does not include ports manually disabled by the operator.
208 */
209 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
sangho27462c62015-05-14 00:39:53 -0700210}