blob: 3f5a3b8f68fc2da9c6b4632a885bc793e6fb0b90 [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 Ventre10bd8d12016-11-26 21:05:22 -080018import org.onlab.packet.IpPrefix;
Charles Chanc81c45b2016-10-20 17:02:44 -070019import org.onosproject.net.DeviceId;
Saurav Das95047002018-01-25 09:49:01 -080020import org.onosproject.net.Link;
21import org.onosproject.net.PortNumber;
Saurav Das7bcbe702017-06-13 15:35:54 -070022import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
23import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Dasc88d4662017-05-15 15:34:25 -070024
25import com.google.common.collect.ImmutableMap;
Charles Chanc81c45b2016-10-20 17:02:44 -070026
sangho1e575652015-05-14 00:39:53 -070027import java.util.List;
Charles Chanc81c45b2016-10-20 17:02:44 -070028import java.util.Map;
29import java.util.Set;
sangho1e575652015-05-14 00:39:53 -070030
31/**
32 * Segment Routing Service for REST API.
33 */
34public interface SegmentRoutingService {
Charles Chan5270ed02016-01-30 23:22:37 -080035 /**
Charles Chan5270ed02016-01-30 23:22:37 -080036 * VLAN cross-connect priority.
37 */
38 int XCONNECT_PRIORITY = 1000;
39
40 /**
41 * Default flow priority.
42 */
43 int DEFAULT_PRIORITY = 100;
44
45 /**
46 * Minimum IP priority.
47 *
Charles Chanb54e8ba2016-02-18 10:43:46 -080048 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan5270ed02016-01-30 23:22:37 -080049 * priority default entries.
50 */
51 int MIN_IP_PRIORITY = 10;
52
53 /**
54 * Subnet flooding flow priority.
55 */
56 int FLOOD_PRIORITY = 5;
57
sangho1e575652015-05-14 00:39:53 -070058 /**
59 * Returns all tunnels.
60 *
61 * @return list of tunnels
62 */
63 List<Tunnel> getTunnels();
64
65 /**
66 * Creates a tunnel.
67 *
68 * @param tunnel tunnel reference to create
sangho71abe1b2015-06-29 14:58:47 -070069 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
70 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
71 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
72 * successfully
sangho1e575652015-05-14 00:39:53 -070073 */
sangho71abe1b2015-06-29 14:58:47 -070074 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -070075
76 /**
77 * Returns all policies.
78 *
79 * @return list of policy
80 */
81 List<Policy> getPolicies();
82
83 /**
84 * Creates a policy.
85 *
86 * @param policy policy reference to create
sangho71abe1b2015-06-29 14:58:47 -070087 * @return ID_EXISTS if the same policy ID exists,
88 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
89 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
90 * SUCCESS if the policy is created successfully.
sangho1e575652015-05-14 00:39:53 -070091 */
sangho71abe1b2015-06-29 14:58:47 -070092 PolicyHandler.Result createPolicy(Policy policy);
sangho1e575652015-05-14 00:39:53 -070093
94 /**
95 * Removes a tunnel.
96 *
97 * @param tunnel tunnel reference to remove
sangho71abe1b2015-06-29 14:58:47 -070098 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
99 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
100 * if the tunnel is created successfully.
sangho1e575652015-05-14 00:39:53 -0700101 */
sangho71abe1b2015-06-29 14:58:47 -0700102 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -0700103
104 /**
105 * Removes a policy.
106 *
107 * @param policy policy reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700108 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
109 * SUCCESS if it is removed successfully
sangho1e575652015-05-14 00:39:53 -0700110 */
sangho71abe1b2015-06-29 14:58:47 -0700111 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das59232cf2016-04-27 18:35:50 -0700112
113 /**
114 * Use current state of the network to repopulate forwarding rules.
115 *
116 */
117 void rerouteNetwork();
Charles Chanc81c45b2016-10-20 17:02:44 -0700118
119 /**
120 * Returns device-subnet mapping.
121 *
122 * @return device-subnet mapping
123 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800124 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Dasc88d4662017-05-15 15:34:25 -0700125
126 /**
127 * Returns the current ECMP shortest path graph in this controller instance.
128 *
129 * @return ECMP shortest path graph
130 */
131 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
132
133 /**
Saurav Das7bcbe702017-06-13 15:35:54 -0700134 * Returns the destinatiomSet-NextObjective store contents.
Saurav Dasc88d4662017-05-15 15:34:25 -0700135 *
Saurav Das7bcbe702017-06-13 15:35:54 -0700136 * @return current contents of the destinationSetNextObjectiveStore
Saurav Dasc88d4662017-05-15 15:34:25 -0700137 */
Saurav Das7bcbe702017-06-13 15:35:54 -0700138 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasceccf242017-08-03 18:30:35 -0700139
140 /**
141 * Triggers the verification of all ECMP groups in the specified device.
142 * Adjusts the group buckets if verification finds that there are more or less
143 * buckets than what should be there.
144 *
145 * @param id the device identifier
146 */
147 void verifyGroups(DeviceId id);
Saurav Das95047002018-01-25 09:49:01 -0800148
149 /**
150 * Returns the internal link state as seen by this instance of the
151 * controller.
152 *
153 * @return the internal link state
154 */
155 ImmutableMap<Link, Boolean> getSeenLinks();
156
157 /**
158 * Returns the ports administratively disabled by the controller.
159 *
160 * @return a map of devices and port numbers for administratively disabled
161 * ports. Does not include ports manually disabled by the operator.
162 */
163 ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState();
sangho1e575652015-05-14 00:39:53 -0700164}