02052c37031d67f07921a0b0e2a291acb7fef260
[onosfw.git] /
1 package org.onosproject.incubator.net.resource.label;
2
3 import java.util.Collection;
4 import java.util.Set;
5
6 import com.google.common.annotations.Beta;
7 import org.onosproject.event.ListenerService;
8 import org.onosproject.net.DeviceId;
9
10 import com.google.common.collect.Multimap;
11
12 /**
13  * Service for providing label resource allocation.
14  */
15 @Beta
16 public interface LabelResourceService
17     extends ListenerService<LabelResourceEvent, LabelResourceListener> {
18
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
100 }