blob: 9b35de18f3cd2cc36edc5aeb1c18b8c1aac212ca [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
6import org.onosproject.net.DeviceId;
7
8import com.google.common.collect.Multimap;
9
10/**
11 * Service for providing label resource allocation.
12 */
13public interface LabelResourceService {
14
15 /**
16 * Returns labels from resource pool by a specific device id.
17 *
18 * @param deviceId device identifier
19 * @param applyNum the applying number
20 * @return collection of applying labels
21 */
22 Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
23 long applyNum);
24
25 /**
26 * Returns labels from the global label resource pool.
27 *
28 * @param applyNum the applying number
29 * @return collection of applying labels
30 */
31 Collection<LabelResource> applyFromGlobalPool(long applyNum);
32
33 /**
34 * Releases unused labels to device pools .
35 *
36 * @param release the collection of releasing labels
37 * @return success or fail
38 */
39 boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release);
40
41 /**
42 * Releases unused labels to the global resource pool.
43 *
44 * @param release release the collection of releasing labels
45 * @return success or fail
46 */
47 boolean releaseToGlobalPool(Set<LabelResourceId> release);
48
49 /**
50 * Judges if the pool of a specific device id is full.
51 *
52 * @param deviceId device identifier
53 * @return yes or no
54 */
55 boolean isDevicePoolFull(DeviceId deviceId);
56
57 /**
58 * Judges if the global resource pool is full.
59 *
60 * @return yes or no
61 */
62 boolean isGlobalPoolFull();
63
64 /**
65 * Returns the unused label number of a label resource pool by a specific device
66 * id.
67 *
68 * @param deviceId device identifier
69 * @return number of unused labels
70 */
71 long getFreeNumOfDevicePool(DeviceId deviceId);
72
73 /**
74 * Returns the unused label number of a global label resource pool.
75 *
76 * @return number of unused labels
77 */
78 long getFreeNumOfGlobalPool();
79
80 /**
81 * Returns the label resource pool of a label resource by a specific device
82 * id.
83 *
84 * @param deviceId device identifier
85 * @return the device label resource pool
86 */
87 LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId);
88
89 /**
90 * Returns the global label resource pool.
91 *
92 * @return the global label resource pool
93 */
94 LabelResourcePool getGlobalLabelResourcePool();
95
96 /**
97 * Adds the specified label resource listener.
98 *
99 * @param listener label resource listener
100 */
101 void addListener(LabelResourceListener listener);
102
103 /**
104 * Removes the specified label resource listener.
105 *
106 * @param listener label resource listener
107 */
108 void removeListener(LabelResourceListener listener);
109}