1 package org.onosproject.incubator.net.resource.label;
3 import java.util.Collection;
6 import com.google.common.annotations.Beta;
7 import org.onosproject.event.ListenerService;
8 import org.onosproject.net.DeviceId;
10 import com.google.common.collect.Multimap;
13 * Service for providing label resource allocation.
16 public interface LabelResourceService
17 extends ListenerService<LabelResourceEvent, LabelResourceListener> {
20 * Returns labels from resource pool by a specific device id.
22 * @param deviceId device identifier
23 * @param applyNum the applying number
24 * @return collection of applying labels
26 Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
30 * Returns labels from the global label resource pool.
32 * @param applyNum the applying number
33 * @return collection of applying labels
35 Collection<LabelResource> applyFromGlobalPool(long applyNum);
38 * Releases unused labels to device pools .
40 * @param release the collection of releasing labels
41 * @return success or fail
43 boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release);
46 * Releases unused labels to the global resource pool.
48 * @param release release the collection of releasing labels
49 * @return success or fail
51 boolean releaseToGlobalPool(Set<LabelResourceId> release);
54 * Judges if the pool of a specific device id is full.
56 * @param deviceId device identifier
59 boolean isDevicePoolFull(DeviceId deviceId);
62 * Judges if the global resource pool is full.
66 boolean isGlobalPoolFull();
69 * Returns the unused label number of a label resource pool by a specific device
72 * @param deviceId device identifier
73 * @return number of unused labels
75 long getFreeNumOfDevicePool(DeviceId deviceId);
78 * Returns the unused label number of a global label resource pool.
80 * @return number of unused labels
82 long getFreeNumOfGlobalPool();
85 * Returns the label resource pool of a label resource by a specific device
88 * @param deviceId device identifier
89 * @return the device label resource pool
91 LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId);
94 * Returns the global label resource pool.
96 * @return the global label resource pool
98 LabelResourcePool getGlobalLabelResourcePool();