blob: 4ef607925e6b67ba825c8fe661f1c216ba5cbe7d [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 Das7bcbe702017-06-13 15:35:54 -070020import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070021import org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel;
22import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy;
23import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
Saurav Das7bcbe702017-06-13 15:35:54 -070024import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
Saurav Dasc88d4662017-05-15 15:34:25 -070025
26import com.google.common.collect.ImmutableMap;
Charles Chanc81c45b2016-10-20 17:02:44 -070027
sangho1e575652015-05-14 00:39:53 -070028import java.util.List;
Charles Chanc81c45b2016-10-20 17:02:44 -070029import java.util.Map;
30import java.util.Set;
sangho1e575652015-05-14 00:39:53 -070031
32/**
33 * Segment Routing Service for REST API.
34 */
35public interface SegmentRoutingService {
Charles Chan5270ed02016-01-30 23:22:37 -080036 /**
Charles Chan5270ed02016-01-30 23:22:37 -080037 * VLAN cross-connect priority.
38 */
39 int XCONNECT_PRIORITY = 1000;
40
41 /**
42 * Default flow priority.
43 */
44 int DEFAULT_PRIORITY = 100;
45
46 /**
47 * Minimum IP priority.
48 *
Charles Chanb54e8ba2016-02-18 10:43:46 -080049 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan5270ed02016-01-30 23:22:37 -080050 * priority default entries.
51 */
52 int MIN_IP_PRIORITY = 10;
53
54 /**
55 * Subnet flooding flow priority.
56 */
57 int FLOOD_PRIORITY = 5;
58
sangho1e575652015-05-14 00:39:53 -070059 /**
60 * Returns all tunnels.
61 *
62 * @return list of tunnels
63 */
64 List<Tunnel> getTunnels();
65
66 /**
67 * Creates a tunnel.
68 *
69 * @param tunnel tunnel reference to create
sangho71abe1b2015-06-29 14:58:47 -070070 * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID
71 * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR
72 * if the tunnel creation failed internally, SUCCESS if the tunnel is created
73 * successfully
sangho1e575652015-05-14 00:39:53 -070074 */
sangho71abe1b2015-06-29 14:58:47 -070075 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -070076
77 /**
78 * Returns all policies.
79 *
80 * @return list of policy
81 */
82 List<Policy> getPolicies();
83
84 /**
Andreas Pantelopoulos27532cd2017-10-23 12:18:25 -070085 * Returns all l2 tunnels of pseudowires.
86 *
87 * @return list of l2 tunnels
88 */
89 List<DefaultL2Tunnel> getL2Tunnels();
90
91 /**
92 * Returns all l2 policie of pseudowires.
93 *
94 * @return list of l2 policies.
95 */
96 List<DefaultL2TunnelPolicy> getL2Policies();
97
98 /**
99 * Removes pw. Essentially updates configuration for PwaasConfig
100 * and sends event for removal. The rest are handled by L2TunnelHandler
101 *
102 * @param pwId The pseudowire id
103 * @return SUCCESS if operation successful or a descriptive error otherwise.
104 */
105 L2TunnelHandler.Result removePseudowire(String pwId);
106
107 /**
108 * Adds a Pseudowire to the configuration.
109 *
110 * @param tunnelId The pseudowire id
111 * @param pwLabel Pw label
112 * @param cP1 Connection Point 1 of pw
113 * @param cP1InnerVlan Outer vlan of cp2
114 * @param cP1OuterVlan Outer vlan of cp1
115 * @param cP2 Connection Point 2 of pw
116 * @param cP2InnerVlan Inner vlan of cp2
117 * @param cP2OuterVlan Outer vlan of cp1
118 * @param mode Mode of pw
119 * @param sdTag Service Delimiting tag of pw
120 * @return SUCCESS if operation is successful or a descriptive error otherwise.
121 */
122 L2TunnelHandler.Result addPseudowire(String tunnelId, String pwLabel, String cP1,
123 String cP1InnerVlan, String cP1OuterVlan, String cP2,
124 String cP2InnerVlan, String cP2OuterVlan,
125 String mode, String sdTag);
126
127 /**
sangho1e575652015-05-14 00:39:53 -0700128 * Creates a policy.
129 *
130 * @param policy policy reference to create
sangho71abe1b2015-06-29 14:58:47 -0700131 * @return ID_EXISTS if the same policy ID exists,
132 * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel
133 * does not exists, UNSUPPORTED_TYPE if the policy type is not supported,
134 * SUCCESS if the policy is created successfully.
sangho1e575652015-05-14 00:39:53 -0700135 */
sangho71abe1b2015-06-29 14:58:47 -0700136 PolicyHandler.Result createPolicy(Policy policy);
sangho1e575652015-05-14 00:39:53 -0700137
138 /**
139 * Removes a tunnel.
140 *
141 * @param tunnel tunnel reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700142 * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists,
143 * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS
144 * if the tunnel is created successfully.
sangho1e575652015-05-14 00:39:53 -0700145 */
sangho71abe1b2015-06-29 14:58:47 -0700146 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho1e575652015-05-14 00:39:53 -0700147
148 /**
149 * Removes a policy.
150 *
151 * @param policy policy reference to remove
sangho71abe1b2015-06-29 14:58:47 -0700152 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
153 * SUCCESS if it is removed successfully
sangho1e575652015-05-14 00:39:53 -0700154 */
sangho71abe1b2015-06-29 14:58:47 -0700155 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das59232cf2016-04-27 18:35:50 -0700156
157 /**
158 * Use current state of the network to repopulate forwarding rules.
159 *
160 */
161 void rerouteNetwork();
Charles Chanc81c45b2016-10-20 17:02:44 -0700162
163 /**
164 * Returns device-subnet mapping.
165 *
166 * @return device-subnet mapping
167 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800168 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Dasc88d4662017-05-15 15:34:25 -0700169
170 /**
171 * Returns the current ECMP shortest path graph in this controller instance.
172 *
173 * @return ECMP shortest path graph
174 */
175 ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg();
176
177 /**
Saurav Das7bcbe702017-06-13 15:35:54 -0700178 * Returns the destinatiomSet-NextObjective store contents.
Saurav Dasc88d4662017-05-15 15:34:25 -0700179 *
Saurav Das7bcbe702017-06-13 15:35:54 -0700180 * @return current contents of the destinationSetNextObjectiveStore
Saurav Dasc88d4662017-05-15 15:34:25 -0700181 */
Saurav Das7bcbe702017-06-13 15:35:54 -0700182 ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet();
Saurav Dasceccf242017-08-03 18:30:35 -0700183
184 /**
185 * Triggers the verification of all ECMP groups in the specified device.
186 * Adjusts the group buckets if verification finds that there are more or less
187 * buckets than what should be there.
188 *
189 * @param id the device identifier
190 */
191 void verifyGroups(DeviceId id);
sangho1e575652015-05-14 00:39:53 -0700192}