blob: 0ad0067905dd0af6723f7cf24a45a68b4ef13656 [file] [log] [blame]
Thomas Vachuska58de4162015-09-10 16:15:33 -07001/*
Charles Chand6832882015-10-05 17:50:33 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska58de4162015-09-10 16:15:33 -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 */
Charles Chan0b4e6182015-11-03 10:42:14 -080016package org.onosproject.segmentrouting.config;
sanghob35a6192015-04-01 13:05:26 -070017
Charles Chan9f676b62015-10-29 14:58:10 -070018import com.google.common.collect.ImmutableSet;
sangho1e575652015-05-14 00:39:53 -070019import com.google.common.collect.Lists;
sanghob35a6192015-04-01 13:05:26 -070020import org.onlab.packet.Ip4Address;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070021import org.onlab.packet.Ip4Prefix;
sanghob35a6192015-04-01 13:05:26 -070022import org.onlab.packet.MacAddress;
Charles Chan4636be02015-10-07 14:21:45 -070023import org.onosproject.incubator.net.config.basics.ConfigException;
24import org.onosproject.incubator.net.config.basics.InterfaceConfig;
25import org.onosproject.incubator.net.intf.Interface;
26import org.onosproject.net.ConnectPoint;
Charles Chand6832882015-10-05 17:50:33 -070027import org.onosproject.net.config.NetworkConfigRegistry;
Charles Chan4636be02015-10-07 14:21:45 -070028import org.onosproject.net.host.InterfaceIpAddress;
Charles Chand6832882015-10-05 17:50:33 -070029import org.onosproject.segmentrouting.config.SegmentRoutingConfig.AdjacencySid;
sanghob35a6192015-04-01 13:05:26 -070030import org.onosproject.net.DeviceId;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070031import org.onosproject.net.PortNumber;
sanghob35a6192015-04-01 13:05:26 -070032import org.slf4j.Logger;
33import org.slf4j.LoggerFactory;
34
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070035import java.util.ArrayList;
sanghob35a6192015-04-01 13:05:26 -070036import java.util.HashMap;
37import java.util.List;
38import java.util.Map;
Charles Chand6832882015-10-05 17:50:33 -070039import java.util.Set;
Saurav Das0e99e2b2015-10-28 12:39:42 -070040import java.util.concurrent.ConcurrentHashMap;
sanghob35a6192015-04-01 13:05:26 -070041
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070042/**
43 * Segment Routing configuration component that reads the
44 * segment routing related configuration from Network Configuration Manager
45 * component and organizes in more accessible formats.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070046 */
sanghob35a6192015-04-01 13:05:26 -070047public class DeviceConfiguration implements DeviceProperties {
48
49 private static final Logger log = LoggerFactory
50 .getLogger(DeviceConfiguration.class);
Sho SHIMIZU6cfc02d2015-09-11 11:19:11 -070051 private final List<Integer> allSegmentIds = new ArrayList<>();
Saurav Das0e99e2b2015-10-28 12:39:42 -070052 private final ConcurrentHashMap<DeviceId, SegmentRouterInfo> deviceConfigMap
53 = new ConcurrentHashMap<>();
sanghob35a6192015-04-01 13:05:26 -070054
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070055 private class SegmentRouterInfo {
56 int nodeSid;
57 DeviceId deviceId;
58 Ip4Address ip;
59 MacAddress mac;
60 boolean isEdge;
61 HashMap<PortNumber, Ip4Address> gatewayIps;
62 HashMap<PortNumber, Ip4Prefix> subnets;
Charles Chand6832882015-10-05 17:50:33 -070063 List<AdjacencySid> adjacencySids;
Charles Chanb8e10c82015-10-14 11:24:40 -070064
65 public SegmentRouterInfo() {
66 this.gatewayIps = new HashMap<>();
67 this.subnets = new HashMap<>();
68 }
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070069 }
sanghob35a6192015-04-01 13:05:26 -070070
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070071 /**
72 * Constructor. Reads all the configuration for all devices of type
73 * Segment Router and organizes into various maps for easier access.
Brian O'Connor52515622015-10-09 17:03:44 -070074 *
75 * @param cfgService config service
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070076 */
Charles Chand6832882015-10-05 17:50:33 -070077 public DeviceConfiguration(NetworkConfigRegistry cfgService) {
Charles Chan4636be02015-10-07 14:21:45 -070078 // Read config from device subject, excluding gatewayIps and subnets.
79 Set<DeviceId> deviceSubjects =
Charles Chand6832882015-10-05 17:50:33 -070080 cfgService.getSubjects(DeviceId.class, SegmentRoutingConfig.class);
Charles Chan4636be02015-10-07 14:21:45 -070081 deviceSubjects.forEach(subject -> {
Charles Chand6832882015-10-05 17:50:33 -070082 SegmentRoutingConfig config =
83 cfgService.getConfig(subject, SegmentRoutingConfig.class);
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070084 SegmentRouterInfo info = new SegmentRouterInfo();
Charles Chand6832882015-10-05 17:50:33 -070085 info.deviceId = subject;
Charles Chan4636be02015-10-07 14:21:45 -070086 info.nodeSid = config.getSid();
Charles Chand6832882015-10-05 17:50:33 -070087 info.ip = config.getIp();
88 info.mac = config.getMac();
89 info.isEdge = config.isEdgeRouter();
Charles Chan4636be02015-10-07 14:21:45 -070090 info.adjacencySids = config.getAdjacencySids();
Charles Chand6832882015-10-05 17:50:33 -070091
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070092 this.deviceConfigMap.put(info.deviceId, info);
93 this.allSegmentIds.add(info.nodeSid);
Charles Chand6832882015-10-05 17:50:33 -070094 });
Charles Chan4636be02015-10-07 14:21:45 -070095
96 // Read gatewayIps and subnets from port subject.
97 Set<ConnectPoint> portSubjects =
98 cfgService.getSubjects(ConnectPoint.class, InterfaceConfig.class);
99 portSubjects.forEach(subject -> {
100 InterfaceConfig config =
101 cfgService.getConfig(subject, InterfaceConfig.class);
102 Set<Interface> networkInterfaces;
103 try {
104 networkInterfaces = config.getInterfaces();
105 } catch (ConfigException e) {
106 log.error("Error loading port configuration");
107 return;
108 }
109 networkInterfaces.forEach(networkInterface -> {
110 DeviceId dpid = networkInterface.connectPoint().deviceId();
111 PortNumber port = networkInterface.connectPoint().port();
112 SegmentRouterInfo info = this.deviceConfigMap.get(dpid);
113
Charles Chanb8e10c82015-10-14 11:24:40 -0700114 // skip if there is no corresponding device for this ConenctPoint
115 if (info != null) {
116 Set<InterfaceIpAddress> interfaceAddresses = networkInterface.ipAddresses();
117 interfaceAddresses.forEach(interfaceAddress -> {
118 info.gatewayIps.put(port, interfaceAddress.ipAddress().getIp4Address());
119 info.subnets.put(port, interfaceAddress.subnetAddress().getIp4Prefix());
120 });
121 }
Charles Chan4636be02015-10-07 14:21:45 -0700122 });
123
124 });
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700125 }
126
sanghob35a6192015-04-01 13:05:26 -0700127 @Override
Charles Chan0b4e6182015-11-03 10:42:14 -0800128 public boolean isConfigured(DeviceId deviceId) {
129 return deviceConfigMap.get(deviceId) != null;
130 }
131
132 @Override
133 public int getSegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700134 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
135 if (srinfo != null) {
136 log.trace("getSegmentId for device{} is {}", deviceId, srinfo.nodeSid);
137 return srinfo.nodeSid;
sanghob35a6192015-04-01 13:05:26 -0700138 } else {
Charles Chan0b4e6182015-11-03 10:42:14 -0800139 String message = "getSegmentId fails for device: " + deviceId + ".";
140 throw new DeviceConfigNotFoundException(message);
sanghob35a6192015-04-01 13:05:26 -0700141 }
142 }
143
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700144 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700145 * Returns the Node segment id of a segment router given its Router mac address.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700146 *
147 * @param routerMac router mac address
Saurav Das0e99e2b2015-10-28 12:39:42 -0700148 * @return node segment id, or -1 if not found in config
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700149 */
150 public int getSegmentId(MacAddress routerMac) {
151 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
152 deviceConfigMap.entrySet()) {
153 if (entry.getValue().mac.equals(routerMac)) {
154 return entry.getValue().nodeSid;
155 }
156 }
sanghob35a6192015-04-01 13:05:26 -0700157
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700158 return -1;
159 }
160
161 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700162 * Returns the Node segment id of a segment router given its Router ip address.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700163 *
164 * @param routerAddress router ip address
Saurav Das0e99e2b2015-10-28 12:39:42 -0700165 * @return node segment id, or -1 if not found in config
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700166 */
167 public int getSegmentId(Ip4Address routerAddress) {
168 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
169 deviceConfigMap.entrySet()) {
170 if (entry.getValue().ip.equals(routerAddress)) {
171 return entry.getValue().nodeSid;
172 }
173 }
174
175 return -1;
176 }
177
sanghob35a6192015-04-01 13:05:26 -0700178 @Override
Charles Chan0b4e6182015-11-03 10:42:14 -0800179 public MacAddress getDeviceMac(DeviceId deviceId) throws DeviceConfigNotFoundException {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700180 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
181 if (srinfo != null) {
182 log.trace("getDeviceMac for device{} is {}", deviceId, srinfo.mac);
183 return srinfo.mac;
sanghob35a6192015-04-01 13:05:26 -0700184 } else {
Charles Chan0b4e6182015-11-03 10:42:14 -0800185 String message = "getDeviceMac fails for device: " + deviceId + ".";
186 throw new DeviceConfigNotFoundException(message);
sanghob35a6192015-04-01 13:05:26 -0700187 }
188 }
189
Charles Chan0b4e6182015-11-03 10:42:14 -0800190 @Override
191 public Ip4Address getRouterIp(DeviceId deviceId) throws DeviceConfigNotFoundException {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700192 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
193 if (srinfo != null) {
194 log.trace("getDeviceIp for device{} is {}", deviceId, srinfo.ip);
195 return srinfo.ip;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700196 } else {
Charles Chan0b4e6182015-11-03 10:42:14 -0800197 String message = "getRouterIp fails for device: " + deviceId + ".";
198 throw new DeviceConfigNotFoundException(message);
sanghob35a6192015-04-01 13:05:26 -0700199 }
sanghob35a6192015-04-01 13:05:26 -0700200 }
201
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700202 @Override
Charles Chan0b4e6182015-11-03 10:42:14 -0800203 public boolean isEdgeDevice(DeviceId deviceId) throws DeviceConfigNotFoundException {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700204 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
205 if (srinfo != null) {
206 log.trace("isEdgeDevice for device{} is {}", deviceId, srinfo.isEdge);
207 return srinfo.isEdge;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700208 } else {
Charles Chan0b4e6182015-11-03 10:42:14 -0800209 String message = "isEdgeDevice fails for device: " + deviceId + ".";
210 throw new DeviceConfigNotFoundException(message);
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700211 }
212 }
213
sanghob35a6192015-04-01 13:05:26 -0700214 @Override
215 public List<Integer> getAllDeviceSegmentIds() {
216 return allSegmentIds;
217 }
218
Charles Chanc42e84e2015-10-20 16:24:19 -0700219 @Override
220 public Map<Ip4Prefix, List<PortNumber>> getSubnetPortsMap(DeviceId deviceId) {
221 Map<Ip4Prefix, List<PortNumber>> subnetPortMap = new HashMap<>();
222
223 // Construct subnet-port mapping from port-subnet mapping
224 Map<PortNumber, Ip4Prefix> portSubnetMap =
225 this.deviceConfigMap.get(deviceId).subnets;
226 portSubnetMap.forEach((port, subnet) -> {
227 if (subnetPortMap.containsKey(subnet)) {
228 subnetPortMap.get(subnet).add(port);
229 } else {
230 ArrayList<PortNumber> ports = new ArrayList<>();
231 ports.add(port);
232 subnetPortMap.put(subnet, ports);
233 }
234 });
235
236 return subnetPortMap;
237 }
238
sanghob35a6192015-04-01 13:05:26 -0700239 /**
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700240 * Returns the device identifier or data plane identifier (dpid)
241 * of a segment router given its segment id.
sanghob35a6192015-04-01 13:05:26 -0700242 *
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700243 * @param sid segment id
244 * @return deviceId device identifier
sanghob35a6192015-04-01 13:05:26 -0700245 */
246 public DeviceId getDeviceId(int sid) {
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700247 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
248 deviceConfigMap.entrySet()) {
249 if (entry.getValue().nodeSid == sid) {
250 return entry.getValue().deviceId;
sanghob35a6192015-04-01 13:05:26 -0700251 }
252 }
253
254 return null;
255 }
256
257 /**
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700258 * Returns the device identifier or data plane identifier (dpid)
259 * of a segment router given its router ip address.
sanghob35a6192015-04-01 13:05:26 -0700260 *
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700261 * @param ipAddress router ip address
262 * @return deviceId device identifier
sanghob35a6192015-04-01 13:05:26 -0700263 */
264 public DeviceId getDeviceId(Ip4Address ipAddress) {
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700265 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
266 deviceConfigMap.entrySet()) {
267 if (entry.getValue().ip.equals(ipAddress)) {
268 return entry.getValue().deviceId;
sanghob35a6192015-04-01 13:05:26 -0700269 }
270 }
271
272 return null;
273 }
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700274
275 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700276 * Returns the configured port ip addresses for a segment router.
277 * These addresses serve as gateway IP addresses for the subnets configured
278 * on those ports.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700279 *
280 * @param deviceId device identifier
Saurav Das837e0bb2015-10-30 17:45:38 -0700281 * @return immutable set of ip addresses configured on the ports or null if not found
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700282 */
Saurav Das837e0bb2015-10-30 17:45:38 -0700283 public Set<Ip4Address> getPortIPs(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700284 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
285 if (srinfo != null) {
286 log.trace("getSubnetGatewayIps for device{} is {}", deviceId,
287 srinfo.gatewayIps.values());
Saurav Das837e0bb2015-10-30 17:45:38 -0700288 return ImmutableSet.copyOf(srinfo.gatewayIps.values());
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700289 }
Saurav Das0e99e2b2015-10-28 12:39:42 -0700290 return null;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700291 }
292
293 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700294 * Returns the configured IP addresses per port
295 * for a segment router.
296 *
297 * @param deviceId device identifier
Saurav Das0e99e2b2015-10-28 12:39:42 -0700298 * @return map of port to gateway IP addresses or null if not found
Saurav Das822c4e22015-10-23 10:51:11 -0700299 */
300 public Map<PortNumber, Ip4Address> getPortIPMap(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700301 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
302 if (srinfo != null) {
303 return srinfo.gatewayIps;
Saurav Das822c4e22015-10-23 10:51:11 -0700304 }
305 return null;
306 }
307
308 /**
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700309 * Returns the configured subnet prefixes for a segment router.
310 *
311 * @param deviceId device identifier
Saurav Das0e99e2b2015-10-28 12:39:42 -0700312 * @return list of ip prefixes or null if not found
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700313 */
Charles Chan9f676b62015-10-29 14:58:10 -0700314 public Set<Ip4Prefix> getSubnets(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700315 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
316 if (srinfo != null) {
317 log.trace("getSubnets for device{} is {}", deviceId,
318 srinfo.subnets.values());
Charles Chan9f676b62015-10-29 14:58:10 -0700319 return ImmutableSet.copyOf(srinfo.subnets.values());
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700320 }
Saurav Das0e99e2b2015-10-28 12:39:42 -0700321 return null;
322 }
323
324 /**
325 * Returns the configured subnet on the given port, or null if no
326 * subnet has been configured on the port.
327 *
328 * @param deviceId device identifier
329 * @param pnum port identifier
330 * @return configured subnet on port, or null
331 */
332 public Ip4Prefix getPortSubnet(DeviceId deviceId, PortNumber pnum) {
333 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
334 if (srinfo != null) {
335 return srinfo.subnets.get(pnum);
336 }
337 return null;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700338 }
339
340 /**
341 * Returns the router ip address of segment router that has the
342 * specified ip address in its subnets.
343 *
344 * @param destIpAddress target ip address
345 * @return router ip address
346 */
347 public Ip4Address getRouterIpAddressForASubnetHost(Ip4Address destIpAddress) {
348 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
349 deviceConfigMap.entrySet()) {
350 for (Ip4Prefix prefix:entry.getValue().subnets.values()) {
351 if (prefix.contains(destIpAddress)) {
352 return entry.getValue().ip;
353 }
354 }
355 }
356
357 log.debug("No router was found for {}", destIpAddress);
358 return null;
359 }
360
361 /**
362 * Returns the router mac address of segment router that has the
363 * specified ip address as one of its subnet gateway ip address.
364 *
365 * @param gatewayIpAddress router gateway ip address
Saurav Das0e99e2b2015-10-28 12:39:42 -0700366 * @return router mac address or null if not found
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700367 */
368 public MacAddress getRouterMacForAGatewayIp(Ip4Address gatewayIpAddress) {
369 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
370 deviceConfigMap.entrySet()) {
371 if (entry.getValue().gatewayIps.
372 values().contains(gatewayIpAddress)) {
373 return entry.getValue().mac;
374 }
375 }
376
377 log.debug("Cannot find a router for {}", gatewayIpAddress);
378 return null;
379 }
sangho666cd6d2015-04-14 16:27:13 -0700380
381
382 /**
383 * Checks if the host is in the subnet defined in the router with the
384 * device ID given.
385 *
386 * @param deviceId device identification of the router
387 * @param hostIp host IP address to check
388 * @return true if the host is within the subnet of the router,
389 * false if no subnet is defined under the router or if the host is not
390 * within the subnet defined in the router
391 */
392 public boolean inSameSubnet(DeviceId deviceId, Ip4Address hostIp) {
393
Charles Chan9f676b62015-10-29 14:58:10 -0700394 Set<Ip4Prefix> subnets = getSubnets(deviceId);
sangho666cd6d2015-04-14 16:27:13 -0700395 if (subnets == null) {
396 return false;
397 }
398
399 for (Ip4Prefix subnet: subnets) {
400 if (subnet.contains(hostIp)) {
401 return true;
402 }
403 }
404
405 return false;
406 }
sangho1e575652015-05-14 00:39:53 -0700407
408 /**
409 * Returns the ports corresponding to the adjacency Sid given.
410 *
411 * @param deviceId device identification of the router
412 * @param sid adjacency Sid
413 * @return list of port numbers
414 */
415 public List<Integer> getPortsForAdjacencySid(DeviceId deviceId, int sid) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700416 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
417 if (srinfo != null) {
418 for (AdjacencySid asid : srinfo.adjacencySids) {
Charles Chan4636be02015-10-07 14:21:45 -0700419 if (asid.getAsid() == sid) {
sangho1e575652015-05-14 00:39:53 -0700420 return asid.getPorts();
421 }
422 }
423 }
424
425 return Lists.newArrayList();
426 }
427
428 /**
429 * Check if the Sid given is whether adjacency Sid of the router device or not.
430 *
431 * @param deviceId device identification of the router
432 * @param sid Sid to check
433 * @return true if the Sid given is the adjacency Sid of the device,
434 * otherwise false
435 */
436 public boolean isAdjacencySid(DeviceId deviceId, int sid) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700437 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
438 if (srinfo != null) {
439 if (srinfo.adjacencySids.isEmpty()) {
sangho1e575652015-05-14 00:39:53 -0700440 return false;
441 } else {
Charles Chand6832882015-10-05 17:50:33 -0700442 for (AdjacencySid asid:
Saurav Das0e99e2b2015-10-28 12:39:42 -0700443 srinfo.adjacencySids) {
Charles Chan4636be02015-10-07 14:21:45 -0700444 if (asid.getAsid() == sid) {
sangho1e575652015-05-14 00:39:53 -0700445 return true;
446 }
447 }
448 return false;
449 }
450 }
451
452 return false;
453 }
Charles Chand6832882015-10-05 17:50:33 -0700454}