blob: 4cd524563e4c2ee230336c3fda15c2f3d9702005 [file] [log] [blame]
Sho SHIMIZUd97a9502015-08-18 10:02:30 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Sho SHIMIZUd97a9502015-08-18 10:02:30 -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 */
Sho SHIMIZUe18cb122016-02-22 21:04:56 -080016package org.onosproject.net.resource.impl;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070017
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -080018import com.google.common.collect.ImmutableSet;
Sho SHIMIZU72f81b12016-02-09 09:26:17 -080019import com.google.common.collect.Lists;
HIGUCHI Yuta6057d082016-04-29 11:57:23 -070020
Sho SHIMIZU44f37612015-11-25 16:23:22 -080021import org.onlab.packet.MplsLabel;
22import org.onlab.packet.VlanId;
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080023import org.onlab.util.Bandwidth;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080024import org.onlab.util.ItemNotFoundException;
Sho SHIMIZU76b046e2016-02-24 11:45:44 -080025import org.onosproject.mastership.MastershipService;
HIGUCHI Yuta6057d082016-04-29 11:57:23 -070026import org.onosproject.net.ChannelSpacing;
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080027import org.onosproject.net.ConnectPoint;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070028import org.onosproject.net.Device;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080029import org.onosproject.net.DeviceId;
HIGUCHI Yuta6057d082016-04-29 11:57:23 -070030import org.onosproject.net.GridType;
HIGUCHI Yutad39e3762015-12-04 09:43:16 -080031import org.onosproject.net.OchSignal;
Toru Furusawac23f5832015-12-04 11:39:18 -080032import org.onosproject.net.Port;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080033import org.onosproject.net.PortNumber;
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +020034import org.onosproject.net.TributarySlot;
HIGUCHI Yutad39e3762015-12-04 09:43:16 -080035import org.onosproject.net.behaviour.LambdaQuery;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080036import org.onosproject.net.behaviour.MplsQuery;
Toru Furusawac23f5832015-12-04 11:39:18 -080037import org.onosproject.net.behaviour.TributarySlotQuery;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080038import org.onosproject.net.behaviour.VlanQuery;
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080039import org.onosproject.net.config.NetworkConfigService;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070040import org.onosproject.net.device.DeviceEvent;
41import org.onosproject.net.device.DeviceListener;
HIGUCHI Yuta11d16092015-12-04 23:35:43 -080042import org.onosproject.net.device.DeviceService;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080043import org.onosproject.net.driver.DriverHandler;
44import org.onosproject.net.driver.DriverService;
Sho SHIMIZUe18cb122016-02-22 21:04:56 -080045import org.onosproject.net.resource.DiscreteResource;
46import org.onosproject.net.resource.ResourceAdminService;
Sho SHIMIZUb6c63a32016-05-26 12:07:19 -070047import org.onosproject.net.config.basics.BandwidthCapacity;
Sho SHIMIZUe18cb122016-02-22 21:04:56 -080048import org.onosproject.net.resource.Resource;
Sho SHIMIZUa6b4dc72016-03-11 19:00:20 -080049import org.onosproject.net.resource.ResourceQueryService;
Sho SHIMIZUe18cb122016-02-22 21:04:56 -080050import org.onosproject.net.resource.Resources;
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +020051import org.slf4j.Logger;
52import org.slf4j.LoggerFactory;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070053
HIGUCHI Yutad39e3762015-12-04 09:43:16 -080054import java.util.Collections;
Naoki Shiotabe394c82016-02-03 16:44:29 -080055import java.util.LinkedList;
56import java.util.List;
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080057import java.util.Optional;
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -080058import java.util.Set;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070059import java.util.concurrent.ExecutorService;
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +020060import java.util.stream.Collectors;
HIGUCHI Yuta6057d082016-04-29 11:57:23 -070061import java.util.stream.Stream;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070062
63import static com.google.common.base.Preconditions.checkNotNull;
64
65/**
66 * An implementation of DeviceListener registering devices as resources.
67 */
68final class ResourceDeviceListener implements DeviceListener {
69
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +020070 private static final Logger log = LoggerFactory.getLogger(ResourceDeviceListener.class);
71
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070072 private final ResourceAdminService adminService;
Sho SHIMIZUa6b4dc72016-03-11 19:00:20 -080073 private final ResourceQueryService resourceService;
HIGUCHI Yuta11d16092015-12-04 23:35:43 -080074 private final DeviceService deviceService;
Sho SHIMIZU76b046e2016-02-24 11:45:44 -080075 private final MastershipService mastershipService;
Sho SHIMIZU44f37612015-11-25 16:23:22 -080076 private final DriverService driverService;
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080077 private final NetworkConfigService netcfgService;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070078 private final ExecutorService executor;
79
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080080
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070081 /**
82 * Creates an instance with the specified ResourceAdminService and ExecutorService.
83 *
84 * @param adminService instance invoked to register resources
Sho SHIMIZUa6b4dc72016-03-11 19:00:20 -080085 * @param resourceService {@link ResourceQueryService} to be used
Jian Lidfba7392016-01-22 16:46:58 -080086 * @param deviceService {@link DeviceService} to be used
Sho SHIMIZU76b046e2016-02-24 11:45:44 -080087 * @param mastershipService {@link MastershipService} to be used
Jian Lidfba7392016-01-22 16:46:58 -080088 * @param driverService {@link DriverService} to be used
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -080089 * @param netcfgService {@link NetworkConfigService} to be used.
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070090 * @param executor executor used for processing resource registration
91 */
Sho SHIMIZUa6b4dc72016-03-11 19:00:20 -080092 ResourceDeviceListener(ResourceAdminService adminService, ResourceQueryService resourceService,
Sho SHIMIZU76b046e2016-02-24 11:45:44 -080093 DeviceService deviceService, MastershipService mastershipService,
94 DriverService driverService, NetworkConfigService netcfgService,
95 ExecutorService executor) {
Sho SHIMIZUd97a9502015-08-18 10:02:30 -070096 this.adminService = checkNotNull(adminService);
Naoki Shiotabe394c82016-02-03 16:44:29 -080097 this.resourceService = checkNotNull(resourceService);
HIGUCHI Yuta11d16092015-12-04 23:35:43 -080098 this.deviceService = checkNotNull(deviceService);
Sho SHIMIZU76b046e2016-02-24 11:45:44 -080099 this.mastershipService = checkNotNull(mastershipService);
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800100 this.driverService = checkNotNull(driverService);
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -0800101 this.netcfgService = checkNotNull(netcfgService);
Sho SHIMIZUd97a9502015-08-18 10:02:30 -0700102 this.executor = checkNotNull(executor);
103 }
104
105 @Override
106 public void event(DeviceEvent event) {
107 Device device = event.subject();
Sho SHIMIZU76b046e2016-02-24 11:45:44 -0800108 // registration happens only when the caller is the master of the device
109 if (!mastershipService.isLocalMaster(device.id())) {
110 return;
111 }
112
Sho SHIMIZUd97a9502015-08-18 10:02:30 -0700113 switch (event.type()) {
114 case DEVICE_ADDED:
115 registerDeviceResource(device);
116 break;
Sho SHIMIZUe60a5ab2015-08-20 11:51:49 -0700117 case DEVICE_REMOVED:
118 unregisterDeviceResource(device);
119 break;
HIGUCHI Yuta11d16092015-12-04 23:35:43 -0800120 case DEVICE_AVAILABILITY_CHANGED:
121 if (deviceService.isAvailable(device.id())) {
122 registerDeviceResource(device);
123 // TODO: do we need to walk the ports?
124 } else {
125 unregisterDeviceResource(device);
126 }
127 break;
Sho SHIMIZU08fdbd22015-08-19 16:59:35 -0700128 case PORT_ADDED:
HIGUCHI Yuta11d16092015-12-04 23:35:43 -0800129 case PORT_UPDATED:
130 if (event.port().isEnabled()) {
131 registerPortResource(device, event.port());
132 } else {
133 unregisterPortResource(device, event.port());
134 }
Sho SHIMIZUc2ddedd2015-08-20 11:54:29 -0700135 break;
Sho SHIMIZUe2292842015-08-20 11:59:23 -0700136 case PORT_REMOVED:
137 unregisterPortResource(device, event.port());
138 break;
Sho SHIMIZUd97a9502015-08-18 10:02:30 -0700139 default:
140 break;
141 }
142 }
143
144 private void registerDeviceResource(Device device) {
HIGUCHI Yuta060da9a2016-03-11 19:16:35 -0800145 executor.execute(() -> adminService.register(Resources.discrete(device.id()).resource()));
Sho SHIMIZUd97a9502015-08-18 10:02:30 -0700146 }
Sho SHIMIZU08fdbd22015-08-19 16:59:35 -0700147
Sho SHIMIZUe60a5ab2015-08-20 11:51:49 -0700148 private void unregisterDeviceResource(Device device) {
HIGUCHI Yuta060da9a2016-03-11 19:16:35 -0800149 executor.execute(() -> {
Sho SHIMIZU2fbc33c2016-02-09 14:03:23 -0800150 DiscreteResource devResource = Resources.discrete(device.id()).resource();
Naoki Shiotabe394c82016-02-03 16:44:29 -0800151 List<Resource> allResources = getDescendantResources(devResource);
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800152 adminService.unregister(Lists.transform(allResources, Resource::id));
Naoki Shiotabe394c82016-02-03 16:44:29 -0800153 });
Sho SHIMIZUe60a5ab2015-08-20 11:51:49 -0700154 }
155
Sho SHIMIZU08fdbd22015-08-19 16:59:35 -0700156 private void registerPortResource(Device device, Port port) {
Sho SHIMIZU460b9722016-01-28 10:48:26 -0800157 Resource portPath = Resources.discrete(device.id(), port.number()).resource();
HIGUCHI Yuta060da9a2016-03-11 19:16:35 -0800158 executor.execute(() -> {
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800159 adminService.register(portPath);
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +0200160
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -0800161 queryBandwidth(device.id(), port.number())
162 .map(bw -> portPath.child(Bandwidth.class, bw.bps()))
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800163 .map(adminService::register)
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -0800164 .ifPresent(success -> {
165 if (!success) {
Ray Milkey0ae473d2016-04-04 10:56:47 -0700166 log.warn("Failed to register Bandwidth for {}", portPath.id());
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -0800167 }
168 });
169
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800170 // for VLAN IDs
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800171 Set<VlanId> vlans = queryVlanIds(device.id(), port.number());
172 if (!vlans.isEmpty()) {
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800173 adminService.register(vlans.stream()
174 .map(portPath::child)
175 .collect(Collectors.toList()));
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800176 }
177
178 // for MPLS labels
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800179 Set<MplsLabel> mplsLabels = queryMplsLabels(device.id(), port.number());
180 if (!mplsLabels.isEmpty()) {
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800181 adminService.register(mplsLabels.stream()
182 .map(portPath::child)
183 .collect(Collectors.toList()));
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800184 }
185
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800186 // for Lambdas
Marc De Leenheer622861d2015-12-15 22:52:52 -0800187 Set<OchSignal> lambdas = queryLambdas(device.id(), port.number());
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800188 if (!lambdas.isEmpty()) {
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800189 adminService.register(lambdas.stream()
190 .map(portPath::child)
191 .collect(Collectors.toList()));
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800192 }
193
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800194 // for Tributary slots
Toru Furusawac23f5832015-12-04 11:39:18 -0800195 Set<TributarySlot> tSlots = queryTributarySlots(device.id(), port.number());
196 if (!tSlots.isEmpty()) {
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800197 adminService.register(tSlots.stream()
198 .map(portPath::child)
199 .collect(Collectors.toList()));
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -0800200 }
201 });
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +0200202 }
203
Sho SHIMIZUe2292842015-08-20 11:59:23 -0700204 private void unregisterPortResource(Device device, Port port) {
HIGUCHI Yuta060da9a2016-03-11 19:16:35 -0800205 executor.execute(() -> {
Sho SHIMIZU2fbc33c2016-02-09 14:03:23 -0800206 DiscreteResource portResource = Resources.discrete(device.id(), port.number()).resource();
Naoki Shiotabe394c82016-02-03 16:44:29 -0800207 List<Resource> allResources = getDescendantResources(portResource);
Sho SHIMIZU7b326972016-02-09 15:53:39 -0800208 adminService.unregister(Lists.transform(allResources, Resource::id));
Naoki Shiotabe394c82016-02-03 16:44:29 -0800209 });
210 }
211
212 // Returns list of all descendant resources of given resource, including itself.
Sho SHIMIZU2fbc33c2016-02-09 14:03:23 -0800213 private List<Resource> getDescendantResources(DiscreteResource parent) {
Naoki Shiotabe394c82016-02-03 16:44:29 -0800214 LinkedList<Resource> allResources = new LinkedList<>();
215 allResources.add(parent);
216
Sho SHIMIZU2fbc33c2016-02-09 14:03:23 -0800217 Set<Resource> nextResources = resourceService.getRegisteredResources(parent.id());
Naoki Shiotabe394c82016-02-03 16:44:29 -0800218 while (!nextResources.isEmpty()) {
219 Set<Resource> currentResources = nextResources;
220 // resource list should be ordered from leaf to root
221 allResources.addAll(0, currentResources);
222
223 nextResources = currentResources.stream()
Sho SHIMIZU2fbc33c2016-02-09 14:03:23 -0800224 .filter(r -> r instanceof DiscreteResource)
225 .map(r -> (DiscreteResource) r)
226 .flatMap(r -> resourceService.getRegisteredResources(r.id()).stream())
Naoki Shiotabe394c82016-02-03 16:44:29 -0800227 .collect(Collectors.toSet());
228 }
229
230 return allResources;
Sho SHIMIZUe2292842015-08-20 11:59:23 -0700231 }
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +0200232
HIGUCHI Yuta1d7c9cb2016-01-20 18:22:36 -0800233 /**
234 * Query bandwidth capacity on a port.
235 *
236 * @param did {@link DeviceId}
237 * @param number {@link PortNumber}
238 * @return bandwidth capacity
239 */
240 private Optional<Bandwidth> queryBandwidth(DeviceId did, PortNumber number) {
241 // Check and use netcfg first.
242 ConnectPoint cp = new ConnectPoint(did, number);
243 BandwidthCapacity config = netcfgService.getConfig(cp, BandwidthCapacity.class);
244 if (config != null) {
245 log.trace("Registering configured bandwidth {} for {}/{}", config.capacity(), did, number);
246 return Optional.of(config.capacity());
247 }
248
249 // populate bandwidth value, assuming portSpeed == bandwidth
250 Port port = deviceService.getPort(did, number);
251 if (port != null) {
252 return Optional.of(Bandwidth.mbps(port.portSpeed()));
253 }
254 return Optional.empty();
255 }
256
Marc De Leenheer622861d2015-12-15 22:52:52 -0800257 private Set<OchSignal> queryLambdas(DeviceId did, PortNumber port) {
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800258 try {
259 DriverHandler handler = driverService.createHandler(did);
HIGUCHI Yuta82b3c112016-01-07 22:22:26 -0800260 if (handler == null || !handler.hasBehaviour(LambdaQuery.class)) {
Marc De Leenheer622861d2015-12-15 22:52:52 -0800261 return Collections.emptySet();
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800262 }
263 LambdaQuery query = handler.behaviour(LambdaQuery.class);
HIGUCHI Yuta11d16092015-12-04 23:35:43 -0800264 if (query != null) {
Marc De Leenheer2c305302015-12-07 21:37:44 -0800265 return query.queryLambdas(port).stream()
HIGUCHI Yuta6057d082016-04-29 11:57:23 -0700266 .flatMap(ResourceDeviceListener::toResourceGrid)
Marc De Leenheer622861d2015-12-15 22:52:52 -0800267 .collect(Collectors.toSet());
HIGUCHI Yuta11d16092015-12-04 23:35:43 -0800268 } else {
Marc De Leenheer622861d2015-12-15 22:52:52 -0800269 return Collections.emptySet();
HIGUCHI Yuta11d16092015-12-04 23:35:43 -0800270 }
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800271 } catch (ItemNotFoundException e) {
Marc De Leenheer622861d2015-12-15 22:52:52 -0800272 return Collections.emptySet();
HIGUCHI Yutad39e3762015-12-04 09:43:16 -0800273 }
274 }
275
HIGUCHI Yuta6057d082016-04-29 11:57:23 -0700276 /**
277 * Convert {@link OchSignal} into gridtype used to track Resource.
278 *
279 * @param ochSignal {@link OchSignal}
280 * @return {@code ochSignal} mapped to Stream of flex grid slots with 6.25 GHz spacing
281 * and 12.5 GHz slot width.
282 */
283 private static Stream<OchSignal> toResourceGrid(OchSignal ochSignal) {
284 if (ochSignal.gridType() != GridType.FLEX) {
285 return OchSignal.toFlexGrid(ochSignal).stream();
286 }
287 if (ochSignal.gridType() == GridType.FLEX &&
288 ochSignal.channelSpacing() == ChannelSpacing.CHL_6P25GHZ &&
289 ochSignal.slotGranularity() == 1) {
290 // input was already flex grid slots with 6.25 GHz spacing and 12.5 GHz slot width.
291 return Stream.of(ochSignal);
292 }
293 // FIXME handle FLEX but not 6.25 GHz spacing or 12.5 GHz slot width case.
294 log.error("Converting {} to resource tracking grid not supported yet.", ochSignal);
295 return Stream.<OchSignal>builder().build();
296 }
297
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800298 private Set<VlanId> queryVlanIds(DeviceId device, PortNumber port) {
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800299 try {
300 DriverHandler handler = driverService.createHandler(device);
HIGUCHI Yuta82b3c112016-01-07 22:22:26 -0800301 if (handler == null || !handler.hasBehaviour(VlanQuery.class)) {
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800302 return ImmutableSet.of();
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800303 }
304
305 VlanQuery query = handler.behaviour(VlanQuery.class);
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800306 if (query == null) {
307 return ImmutableSet.of();
308 }
309 return query.queryVlanIds(port);
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800310 } catch (ItemNotFoundException e) {
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800311 return ImmutableSet.of();
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800312 }
313 }
314
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800315 private Set<MplsLabel> queryMplsLabels(DeviceId device, PortNumber port) {
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800316 try {
317 DriverHandler handler = driverService.createHandler(device);
HIGUCHI Yuta82b3c112016-01-07 22:22:26 -0800318 if (handler == null || !handler.hasBehaviour(MplsQuery.class)) {
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800319 return ImmutableSet.of();
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800320 }
321
322 MplsQuery query = handler.behaviour(MplsQuery.class);
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800323 if (query == null) {
324 return ImmutableSet.of();
325 }
326 return query.queryMplsLabels(port);
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800327 } catch (ItemNotFoundException e) {
HIGUCHI Yutab7a15d72015-12-15 09:54:40 -0800328 return ImmutableSet.of();
Sho SHIMIZU44f37612015-11-25 16:23:22 -0800329 }
330 }
331
Toru Furusawac23f5832015-12-04 11:39:18 -0800332 private Set<TributarySlot> queryTributarySlots(DeviceId device, PortNumber port) {
333 try {
Toru Furusawac23f5832015-12-04 11:39:18 -0800334 DriverHandler handler = driverService.createHandler(device);
HIGUCHI Yuta82b3c112016-01-07 22:22:26 -0800335 if (handler == null || !handler.hasBehaviour(TributarySlotQuery.class)) {
Toru Furusawac23f5832015-12-04 11:39:18 -0800336 return Collections.emptySet();
337 }
338 TributarySlotQuery query = handler.behaviour(TributarySlotQuery.class);
339 if (query != null) {
340 return query.queryTributarySlots(port);
341 } else {
342 return Collections.emptySet();
343 }
344 } catch (ItemNotFoundException e) {
345 return Collections.emptySet();
346 }
Rimon Ashkenazye2410ff2015-11-10 14:11:08 +0200347 }
Sho SHIMIZUd97a9502015-08-18 10:02:30 -0700348}