blob: 97a662a6c6295ee8ae2cc6c544baea282d61653d [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 */
sanghob35a6192015-04-01 13:05:26 -070016package org.onosproject.segmentrouting;
17
sangho1e575652015-05-14 00:39:53 -070018import com.google.common.collect.Lists;
sanghob35a6192015-04-01 13:05:26 -070019import org.onlab.packet.Ip4Address;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070020import org.onlab.packet.Ip4Prefix;
sanghob35a6192015-04-01 13:05:26 -070021import org.onlab.packet.MacAddress;
Charles Chan4636be02015-10-07 14:21:45 -070022import org.onosproject.incubator.net.config.basics.ConfigException;
23import org.onosproject.incubator.net.config.basics.InterfaceConfig;
24import org.onosproject.incubator.net.intf.Interface;
25import org.onosproject.net.ConnectPoint;
Charles Chand6832882015-10-05 17:50:33 -070026import org.onosproject.net.config.NetworkConfigRegistry;
Charles Chan4636be02015-10-07 14:21:45 -070027import org.onosproject.net.host.InterfaceIpAddress;
Charles Chand6832882015-10-05 17:50:33 -070028import org.onosproject.segmentrouting.config.SegmentRoutingConfig;
29import org.onosproject.segmentrouting.config.SegmentRoutingConfig.AdjacencySid;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070030import org.onosproject.segmentrouting.grouphandler.DeviceProperties;
sanghob35a6192015-04-01 13:05:26 -070031import org.onosproject.net.DeviceId;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070032import org.onosproject.net.PortNumber;
sanghob35a6192015-04-01 13:05:26 -070033import org.slf4j.Logger;
34import org.slf4j.LoggerFactory;
35
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070036import java.util.ArrayList;
sanghob35a6192015-04-01 13:05:26 -070037import java.util.HashMap;
38import java.util.List;
39import java.util.Map;
Charles Chand6832882015-10-05 17:50:33 -070040import java.util.Set;
Saurav Das0e99e2b2015-10-28 12:39:42 -070041import java.util.concurrent.ConcurrentHashMap;
sanghob35a6192015-04-01 13:05:26 -070042
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070043/**
44 * Segment Routing configuration component that reads the
45 * segment routing related configuration from Network Configuration Manager
46 * component and organizes in more accessible formats.
47 *
48 * TODO: Merge multiple Segment Routing configuration wrapper classes into one.
49 */
sanghob35a6192015-04-01 13:05:26 -070050public class DeviceConfiguration implements DeviceProperties {
51
52 private static final Logger log = LoggerFactory
53 .getLogger(DeviceConfiguration.class);
Sho SHIMIZU6cfc02d2015-09-11 11:19:11 -070054 private final List<Integer> allSegmentIds = new ArrayList<>();
Saurav Das0e99e2b2015-10-28 12:39:42 -070055 private final ConcurrentHashMap<DeviceId, SegmentRouterInfo> deviceConfigMap
56 = new ConcurrentHashMap<>();
sanghob35a6192015-04-01 13:05:26 -070057
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070058 private class SegmentRouterInfo {
59 int nodeSid;
60 DeviceId deviceId;
61 Ip4Address ip;
62 MacAddress mac;
63 boolean isEdge;
64 HashMap<PortNumber, Ip4Address> gatewayIps;
65 HashMap<PortNumber, Ip4Prefix> subnets;
Charles Chand6832882015-10-05 17:50:33 -070066 List<AdjacencySid> adjacencySids;
Charles Chanb8e10c82015-10-14 11:24:40 -070067
68 public SegmentRouterInfo() {
69 this.gatewayIps = new HashMap<>();
70 this.subnets = new HashMap<>();
71 }
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070072 }
sanghob35a6192015-04-01 13:05:26 -070073
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070074 /**
75 * Constructor. Reads all the configuration for all devices of type
76 * Segment Router and organizes into various maps for easier access.
Brian O'Connor52515622015-10-09 17:03:44 -070077 *
78 * @param cfgService config service
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070079 */
Charles Chand6832882015-10-05 17:50:33 -070080 public DeviceConfiguration(NetworkConfigRegistry cfgService) {
Charles Chan4636be02015-10-07 14:21:45 -070081 // Read config from device subject, excluding gatewayIps and subnets.
82 Set<DeviceId> deviceSubjects =
Charles Chand6832882015-10-05 17:50:33 -070083 cfgService.getSubjects(DeviceId.class, SegmentRoutingConfig.class);
Charles Chan4636be02015-10-07 14:21:45 -070084 deviceSubjects.forEach(subject -> {
Charles Chand6832882015-10-05 17:50:33 -070085 SegmentRoutingConfig config =
86 cfgService.getConfig(subject, SegmentRoutingConfig.class);
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070087 SegmentRouterInfo info = new SegmentRouterInfo();
Charles Chand6832882015-10-05 17:50:33 -070088 info.deviceId = subject;
Charles Chan4636be02015-10-07 14:21:45 -070089 info.nodeSid = config.getSid();
Charles Chand6832882015-10-05 17:50:33 -070090 info.ip = config.getIp();
91 info.mac = config.getMac();
92 info.isEdge = config.isEdgeRouter();
Charles Chan4636be02015-10-07 14:21:45 -070093 info.adjacencySids = config.getAdjacencySids();
Charles Chand6832882015-10-05 17:50:33 -070094
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -070095 this.deviceConfigMap.put(info.deviceId, info);
96 this.allSegmentIds.add(info.nodeSid);
Charles Chand6832882015-10-05 17:50:33 -070097 });
Charles Chan4636be02015-10-07 14:21:45 -070098
99 // Read gatewayIps and subnets from port subject.
100 Set<ConnectPoint> portSubjects =
101 cfgService.getSubjects(ConnectPoint.class, InterfaceConfig.class);
102 portSubjects.forEach(subject -> {
103 InterfaceConfig config =
104 cfgService.getConfig(subject, InterfaceConfig.class);
105 Set<Interface> networkInterfaces;
106 try {
107 networkInterfaces = config.getInterfaces();
108 } catch (ConfigException e) {
109 log.error("Error loading port configuration");
110 return;
111 }
112 networkInterfaces.forEach(networkInterface -> {
113 DeviceId dpid = networkInterface.connectPoint().deviceId();
114 PortNumber port = networkInterface.connectPoint().port();
115 SegmentRouterInfo info = this.deviceConfigMap.get(dpid);
116
Charles Chanb8e10c82015-10-14 11:24:40 -0700117 // skip if there is no corresponding device for this ConenctPoint
118 if (info != null) {
119 Set<InterfaceIpAddress> interfaceAddresses = networkInterface.ipAddresses();
120 interfaceAddresses.forEach(interfaceAddress -> {
121 info.gatewayIps.put(port, interfaceAddress.ipAddress().getIp4Address());
122 info.subnets.put(port, interfaceAddress.subnetAddress().getIp4Prefix());
123 });
124 }
Charles Chan4636be02015-10-07 14:21:45 -0700125 });
126
127 });
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700128 }
129
130 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700131 * Returns the Node segment id of a segment router.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700132 *
133 * @param deviceId device identifier
134 * @return segment id
135 */
sanghob35a6192015-04-01 13:05:26 -0700136 @Override
137 public int getSegmentId(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700138 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
139 if (srinfo != null) {
140 log.trace("getSegmentId for device{} is {}", deviceId, srinfo.nodeSid);
141 return srinfo.nodeSid;
sanghob35a6192015-04-01 13:05:26 -0700142 } else {
Srikanth Vavilapalli23181912015-05-04 09:48:09 -0700143 log.warn("getSegmentId for device {} "
144 + "throwing IllegalStateException "
145 + "because device does not exist in config", deviceId);
sanghob35a6192015-04-01 13:05:26 -0700146 throw new IllegalStateException();
147 }
148 }
149
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700150 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700151 * Returns the Node segment id of a segment router given its Router mac address.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700152 *
153 * @param routerMac router mac address
Saurav Das0e99e2b2015-10-28 12:39:42 -0700154 * @return node segment id, or -1 if not found in config
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700155 */
156 public int getSegmentId(MacAddress routerMac) {
157 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
158 deviceConfigMap.entrySet()) {
159 if (entry.getValue().mac.equals(routerMac)) {
160 return entry.getValue().nodeSid;
161 }
162 }
sanghob35a6192015-04-01 13:05:26 -0700163
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700164 return -1;
165 }
166
167 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700168 * Returns the Node segment id of a segment router given its Router ip address.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700169 *
170 * @param routerAddress router ip address
Saurav Das0e99e2b2015-10-28 12:39:42 -0700171 * @return node segment id, or -1 if not found in config
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700172 */
173 public int getSegmentId(Ip4Address routerAddress) {
174 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
175 deviceConfigMap.entrySet()) {
176 if (entry.getValue().ip.equals(routerAddress)) {
177 return entry.getValue().nodeSid;
178 }
179 }
180
181 return -1;
182 }
183
184 /**
185 * Returns the router mac of a segment router.
186 *
187 * @param deviceId device identifier
188 * @return router mac address
189 */
sanghob35a6192015-04-01 13:05:26 -0700190 @Override
191 public MacAddress getDeviceMac(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700192 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
193 if (srinfo != null) {
194 log.trace("getDeviceMac for device{} is {}", deviceId, srinfo.mac);
195 return srinfo.mac;
sanghob35a6192015-04-01 13:05:26 -0700196 } else {
Srikanth Vavilapalli23181912015-05-04 09:48:09 -0700197 log.warn("getDeviceMac for device {} "
198 + "throwing IllegalStateException "
199 + "because device does not exist in config", deviceId);
sanghob35a6192015-04-01 13:05:26 -0700200 throw new IllegalStateException();
201 }
202 }
203
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700204 /**
205 * Returns the router ip address of a segment router.
206 *
207 * @param deviceId device identifier
208 * @return router ip address
209 */
210 public Ip4Address getRouterIp(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700211 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
212 if (srinfo != null) {
213 log.trace("getDeviceIp for device{} is {}", deviceId, srinfo.ip);
214 return srinfo.ip;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700215 } else {
Srikanth Vavilapalli23181912015-05-04 09:48:09 -0700216 log.warn("getRouterIp for device {} "
217 + "throwing IllegalStateException "
218 + "because device does not exist in config", deviceId);
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700219 throw new IllegalStateException();
sanghob35a6192015-04-01 13:05:26 -0700220 }
sanghob35a6192015-04-01 13:05:26 -0700221 }
222
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700223 /**
224 * Indicates if the segment router is a edge router or
Saurav Das822c4e22015-10-23 10:51:11 -0700225 * a core/backbone router.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700226 *
227 * @param deviceId device identifier
228 * @return boolean
229 */
230 @Override
231 public boolean isEdgeDevice(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700232 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
233 if (srinfo != null) {
234 log.trace("isEdgeDevice for device{} is {}", deviceId, srinfo.isEdge);
235 return srinfo.isEdge;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700236 } else {
Srikanth Vavilapalli23181912015-05-04 09:48:09 -0700237 log.warn("isEdgeDevice for device {} "
238 + "throwing IllegalStateException "
239 + "because device does not exist in config", deviceId);
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700240 throw new IllegalStateException();
241 }
242 }
243
244 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700245 * Returns the node segment ids of all configured segment routers.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700246 *
Saurav Das822c4e22015-10-23 10:51:11 -0700247 * @return list of node segment ids
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700248 */
sanghob35a6192015-04-01 13:05:26 -0700249 @Override
250 public List<Integer> getAllDeviceSegmentIds() {
251 return allSegmentIds;
252 }
253
sanghob35a6192015-04-01 13:05:26 -0700254 /**
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700255 * Returns the device identifier or data plane identifier (dpid)
256 * of a segment router given its segment id.
sanghob35a6192015-04-01 13:05:26 -0700257 *
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700258 * @param sid segment id
259 * @return deviceId device identifier
sanghob35a6192015-04-01 13:05:26 -0700260 */
261 public DeviceId getDeviceId(int sid) {
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700262 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
263 deviceConfigMap.entrySet()) {
264 if (entry.getValue().nodeSid == sid) {
265 return entry.getValue().deviceId;
sanghob35a6192015-04-01 13:05:26 -0700266 }
267 }
268
269 return null;
270 }
271
272 /**
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700273 * Returns the device identifier or data plane identifier (dpid)
274 * of a segment router given its router ip address.
sanghob35a6192015-04-01 13:05:26 -0700275 *
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700276 * @param ipAddress router ip address
277 * @return deviceId device identifier
sanghob35a6192015-04-01 13:05:26 -0700278 */
279 public DeviceId getDeviceId(Ip4Address ipAddress) {
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700280 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
281 deviceConfigMap.entrySet()) {
282 if (entry.getValue().ip.equals(ipAddress)) {
283 return entry.getValue().deviceId;
sanghob35a6192015-04-01 13:05:26 -0700284 }
285 }
286
287 return null;
288 }
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700289
290 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700291 * Returns the configured port ip addresses for a segment router.
292 * These addresses serve as gateway IP addresses for the subnets configured
293 * on those ports.
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700294 *
295 * @param deviceId device identifier
Saurav Das0e99e2b2015-10-28 12:39:42 -0700296 * @return list of ip addresses configured on the ports or null if not found
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700297 */
Saurav Das822c4e22015-10-23 10:51:11 -0700298 public List<Ip4Address> getPortIPs(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700299 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
300 if (srinfo != null) {
301 log.trace("getSubnetGatewayIps for device{} is {}", deviceId,
302 srinfo.gatewayIps.values());
303 return new ArrayList<>(srinfo.gatewayIps.values());
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700304 }
Saurav Das0e99e2b2015-10-28 12:39:42 -0700305 return null;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700306 }
307
308 /**
Saurav Das822c4e22015-10-23 10:51:11 -0700309 * Returns the configured IP addresses per port
310 * for a segment router.
311 *
312 * @param deviceId device identifier
Saurav Das0e99e2b2015-10-28 12:39:42 -0700313 * @return map of port to gateway IP addresses or null if not found
Saurav Das822c4e22015-10-23 10:51:11 -0700314 */
315 public Map<PortNumber, Ip4Address> getPortIPMap(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700316 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
317 if (srinfo != null) {
318 return srinfo.gatewayIps;
Saurav Das822c4e22015-10-23 10:51:11 -0700319 }
320 return null;
321 }
322
323 /**
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700324 * Returns the configured subnet prefixes for a segment router.
325 *
326 * @param deviceId device identifier
Saurav Das0e99e2b2015-10-28 12:39:42 -0700327 * @return list of ip prefixes or null if not found
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700328 */
329 public List<Ip4Prefix> getSubnets(DeviceId deviceId) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700330 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
331 if (srinfo != null) {
332 log.trace("getSubnets for device{} is {}", deviceId,
333 srinfo.subnets.values());
334 return new ArrayList<>(srinfo.subnets.values());
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700335 }
Saurav Das0e99e2b2015-10-28 12:39:42 -0700336 return null;
337 }
338
339 /**
340 * Returns the configured subnet on the given port, or null if no
341 * subnet has been configured on the port.
342 *
343 * @param deviceId device identifier
344 * @param pnum port identifier
345 * @return configured subnet on port, or null
346 */
347 public Ip4Prefix getPortSubnet(DeviceId deviceId, PortNumber pnum) {
348 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
349 if (srinfo != null) {
350 return srinfo.subnets.get(pnum);
351 }
352 return null;
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700353 }
354
355 /**
356 * Returns the router ip address of segment router that has the
357 * specified ip address in its subnets.
358 *
359 * @param destIpAddress target ip address
360 * @return router ip address
361 */
362 public Ip4Address getRouterIpAddressForASubnetHost(Ip4Address destIpAddress) {
363 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
364 deviceConfigMap.entrySet()) {
365 for (Ip4Prefix prefix:entry.getValue().subnets.values()) {
366 if (prefix.contains(destIpAddress)) {
367 return entry.getValue().ip;
368 }
369 }
370 }
371
372 log.debug("No router was found for {}", destIpAddress);
373 return null;
374 }
375
376 /**
377 * Returns the router mac address of segment router that has the
378 * specified ip address as one of its subnet gateway ip address.
379 *
380 * @param gatewayIpAddress router gateway ip address
Saurav Das0e99e2b2015-10-28 12:39:42 -0700381 * @return router mac address or null if not found
Srikanth Vavilapalli4db76e32015-04-07 15:12:32 -0700382 */
383 public MacAddress getRouterMacForAGatewayIp(Ip4Address gatewayIpAddress) {
384 for (Map.Entry<DeviceId, SegmentRouterInfo> entry:
385 deviceConfigMap.entrySet()) {
386 if (entry.getValue().gatewayIps.
387 values().contains(gatewayIpAddress)) {
388 return entry.getValue().mac;
389 }
390 }
391
392 log.debug("Cannot find a router for {}", gatewayIpAddress);
393 return null;
394 }
sangho666cd6d2015-04-14 16:27:13 -0700395
396
397 /**
398 * Checks if the host is in the subnet defined in the router with the
399 * device ID given.
400 *
401 * @param deviceId device identification of the router
402 * @param hostIp host IP address to check
403 * @return true if the host is within the subnet of the router,
404 * false if no subnet is defined under the router or if the host is not
405 * within the subnet defined in the router
406 */
407 public boolean inSameSubnet(DeviceId deviceId, Ip4Address hostIp) {
408
409 List<Ip4Prefix> subnets = getSubnets(deviceId);
410 if (subnets == null) {
411 return false;
412 }
413
414 for (Ip4Prefix subnet: subnets) {
415 if (subnet.contains(hostIp)) {
416 return true;
417 }
418 }
419
420 return false;
421 }
sangho1e575652015-05-14 00:39:53 -0700422
423 /**
424 * Returns the ports corresponding to the adjacency Sid given.
425 *
426 * @param deviceId device identification of the router
427 * @param sid adjacency Sid
428 * @return list of port numbers
429 */
430 public List<Integer> getPortsForAdjacencySid(DeviceId deviceId, int sid) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700431 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
432 if (srinfo != null) {
433 for (AdjacencySid asid : srinfo.adjacencySids) {
Charles Chan4636be02015-10-07 14:21:45 -0700434 if (asid.getAsid() == sid) {
sangho1e575652015-05-14 00:39:53 -0700435 return asid.getPorts();
436 }
437 }
438 }
439
440 return Lists.newArrayList();
441 }
442
443 /**
444 * Check if the Sid given is whether adjacency Sid of the router device or not.
445 *
446 * @param deviceId device identification of the router
447 * @param sid Sid to check
448 * @return true if the Sid given is the adjacency Sid of the device,
449 * otherwise false
450 */
451 public boolean isAdjacencySid(DeviceId deviceId, int sid) {
Saurav Das0e99e2b2015-10-28 12:39:42 -0700452 SegmentRouterInfo srinfo = deviceConfigMap.get(deviceId);
453 if (srinfo != null) {
454 if (srinfo.adjacencySids.isEmpty()) {
sangho1e575652015-05-14 00:39:53 -0700455 return false;
456 } else {
Charles Chand6832882015-10-05 17:50:33 -0700457 for (AdjacencySid asid:
Saurav Das0e99e2b2015-10-28 12:39:42 -0700458 srinfo.adjacencySids) {
Charles Chan4636be02015-10-07 14:21:45 -0700459 if (asid.getAsid() == sid) {
sangho1e575652015-05-14 00:39:53 -0700460 return true;
461 }
462 }
463 return false;
464 }
465 }
466
467 return false;
468 }
Charles Chand6832882015-10-05 17:50:33 -0700469}