blob: 02052c37031d67f07921a0b0e2a291acb7fef260 [file] [log] [blame]
Brian O'Connor6de2e202015-05-21 14:30:41 -07001package org.onosproject.incubator.net.resource.label;
jccfff0de92015-03-28 01:40:08 -07002
3import java.util.Collection;
4import java.util.Set;
5
Brian O'Connor893b9222015-06-25 15:07:04 -04006import com.google.common.annotations.Beta;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -07007import org.onosproject.event.ListenerService;
jccfff0de92015-03-28 01:40:08 -07008import org.onosproject.net.DeviceId;
9
10import com.google.common.collect.Multimap;
11
12/**
13 * Service for providing label resource allocation.
14 */
Brian O'Connor893b9222015-06-25 15:07:04 -040015@Beta
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070016public interface LabelResourceService
17 extends ListenerService<LabelResourceEvent, LabelResourceListener> {
jccfff0de92015-03-28 01:40:08 -070018
19 /**
20 * Returns labels from resource pool by a specific device id.
21 *
22 * @param deviceId device identifier
23 * @param applyNum the applying number
24 * @return collection of applying labels
25 */
26 Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
27 long applyNum);
28
29 /**
30 * Returns labels from the global label resource pool.
31 *
32 * @param applyNum the applying number
33 * @return collection of applying labels
34 */
35 Collection<LabelResource> applyFromGlobalPool(long applyNum);
36
37 /**
38 * Releases unused labels to device pools .
39 *
40 * @param release the collection of releasing labels
41 * @return success or fail
42 */
43 boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release);
44
45 /**
46 * Releases unused labels to the global resource pool.
47 *
48 * @param release release the collection of releasing labels
49 * @return success or fail
50 */
51 boolean releaseToGlobalPool(Set<LabelResourceId> release);
52
53 /**
54 * Judges if the pool of a specific device id is full.
55 *
56 * @param deviceId device identifier
57 * @return yes or no
58 */
59 boolean isDevicePoolFull(DeviceId deviceId);
60
61 /**
62 * Judges if the global resource pool is full.
63 *
64 * @return yes or no
65 */
66 boolean isGlobalPoolFull();
67
68 /**
69 * Returns the unused label number of a label resource pool by a specific device
70 * id.
71 *
72 * @param deviceId device identifier
73 * @return number of unused labels
74 */
75 long getFreeNumOfDevicePool(DeviceId deviceId);
76
77 /**
78 * Returns the unused label number of a global label resource pool.
79 *
80 * @return number of unused labels
81 */
82 long getFreeNumOfGlobalPool();
83
84 /**
85 * Returns the label resource pool of a label resource by a specific device
86 * id.
87 *
88 * @param deviceId device identifier
89 * @return the device label resource pool
90 */
91 LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId);
92
93 /**
94 * Returns the global label resource pool.
95 *
96 * @return the global label resource pool
97 */
98 LabelResourcePool getGlobalLabelResourcePool();
99
jccfff0de92015-03-28 01:40:08 -0700100}