blob: 3668ba21af173fe52dc3676b1e271b8b1d287de1 [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 Das261c3002017-06-13 15:35:54 -070020import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
21import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Das62ae6792017-05-15 15:34:25 -070022
23import com.google.common.collect.ImmutableMap;
Charles Chand7844e52016-10-20 17:02:44 -070024
sangho27462c62015-05-14 00:39:53 -070025import java.util.List;
Charles Chand7844e52016-10-20 17:02:44 -070026import java.util.Map;
27import java.util.Set;
sangho27462c62015-05-14 00:39:53 -070028
29/**
30 * Segment Routing Service for REST API.
31 */
32public interface SegmentRoutingService {
Charles Chan82ab1932016-01-30 23:22:37 -080033 /**
Charles Chan82ab1932016-01-30 23:22:37 -080034 * VLAN cross-connect priority.
35 */
36 int XCONNECT_PRIORITY = 1000;
37
38 /**
39 * Default flow priority.
40 */
41 int DEFAULT_PRIORITY = 100;
42
43 /**
44 * Minimum IP priority.
45 *
Charles Chand86904c2016-02-18 10:43:46 -080046 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan82ab1932016-01-30 23:22:37 -080047 * priority default entries.
48 */
49 int MIN_IP_PRIORITY = 10;
50
51 /**
52 * Subnet flooding flow priority.
53 */
54 int FLOOD_PRIORITY = 5;
55
sangho27462c62015-05-14 00:39:53 -070056 /**
57 * Returns all tunnels.
58 *
59 * @return list of tunnels
60 */
61 List<Tunnel> getTunnels();
62
63 /**
64 * Creates a tunnel.
65 *
66 * @param tunnel tunnel reference to create
sanghobd812f82015-06-29 14:58:47 -070067 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
68 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
69 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
70 * successfully
sangho27462c62015-05-14 00:39:53 -070071 */
sanghobd812f82015-06-29 14:58:47 -070072 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -070073
74 /**
75 * Returns all policies.
76 *
77 * @return list of policy
78 */
79 List<Policy> getPolicies();
80
81 /**
82 * Creates a policy.
83 *
84 * @param policy policy reference to create
sanghobd812f82015-06-29 14:58:47 -070085 * @return ID_EXISTS if the same policy ID exists,
86 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
87 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
88 * SUCCESS if the policy is created successfully.
sangho27462c62015-05-14 00:39:53 -070089 */
sanghobd812f82015-06-29 14:58:47 -070090 PolicyHandler.Result createPolicy(Policy policy);
sangho27462c62015-05-14 00:39:53 -070091
92 /**
93 * Removes a tunnel.
94 *
95 * @param tunnel tunnel reference to remove
sanghobd812f82015-06-29 14:58:47 -070096 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
97 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
98 * if the tunnel is created successfully.
sangho27462c62015-05-14 00:39:53 -070099 */
sanghobd812f82015-06-29 14:58:47 -0700100 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -0700101
102 /**
103 * Removes a policy.
104 *
105 * @param policy policy reference to remove
sanghobd812f82015-06-29 14:58:47 -0700106 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
107 * SUCCESS if it is removed successfully
sangho27462c62015-05-14 00:39:53 -0700108 */
sanghobd812f82015-06-29 14:58:47 -0700109 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das07c74602016-04-27 18:35:50 -0700110
111 /**
112 * Use current state of the network to repopulate forwarding rules.
113 *
114 */
115 void rerouteNetwork();
Charles Chand7844e52016-10-20 17:02:44 -0700116
117 /**
118 * Returns device-subnet mapping.
119 *
120 * @return device-subnet mapping
121 */
Pier Ventreb6a7f342016-11-26 21:05:22 -0800122 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Das62ae6792017-05-15 15:34:25 -0700123
124 /**
125 * Returns the current ECMP shortest path graph in this controller instance.
126 *
127 * @return ECMP shortest path graph
128 */
129 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
130
131 /**
Saurav Das261c3002017-06-13 15:35:54 -0700132 * Returns the destinatiomSet-NextObjective store contents.
Saurav Das62ae6792017-05-15 15:34:25 -0700133 *
Saurav Das261c3002017-06-13 15:35:54 -0700134 * @return current contents of the destinationSetNextObjectiveStore
Saurav Das62ae6792017-05-15 15:34:25 -0700135 */
Saurav Das261c3002017-06-13 15:35:54 -0700136 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasfbe74572017-08-03 18:30:35 -0700137
138 /**
139 * Triggers the verification of all ECMP groups in the specified device.
140 * Adjusts the group buckets if verification finds that there are more or less
141 * buckets than what should be there.
142 *
143 * @param id the device identifier
144 */
145 void verifyGroups(DeviceId id);
sangho27462c62015-05-14 00:39:53 -0700146}