blob: a52a843f69a1f85b53966090bc205057388db08f [file] [log] [blame]
Marc De Leenheer1afa2a02015-05-13 09:18:07 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
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 */
Brian O'Connor6de2e202015-05-21 14:30:41 -070016package org.onosproject.net.resource.device;
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070017
18import org.onosproject.net.DeviceId;
19import org.onosproject.net.Port;
20import org.onosproject.net.intent.IntentId;
21
22import java.util.Set;
23
24public interface DeviceResourceStore {
Marc De Leenheer88194c32015-05-29 22:10:59 -070025 /**
26 * Returns unallocated ports on the given device.
27 *
28 * @param deviceId device ID
29 * @return set of unallocated ports
30 */
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070031 Set<Port> getFreePorts(DeviceId deviceId);
32
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070033 /**
34 * Allocates the given ports to the given intent.
Marc De Leenheer88194c32015-05-29 22:10:59 -070035 *
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070036 * @param ports set of ports to allocate
37 * @param intentId intent ID
38 * @return true if allocation was successful, false otherwise
39 */
40 boolean allocatePorts(Set<Port> ports, IntentId intentId);
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070041
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070042 /**
43 * Returns set of ports allocated for an intent.
44 *
45 * @param intentId the intent ID
46 * @return set of allocated ports
47 */
48 Set<Port> getAllocations(IntentId intentId);
49
50 /**
51 * Returns intent allocated to a port.
52 *
53 * @param port the port
54 * @return intent ID allocated to the port
55 */
56 IntentId getAllocations(Port port);
57
58 /**
59 * Allocates the mapping between the given intents.
60 *
61 * @param keyIntentId key intent ID
62 * @param valIntentId value intent ID
63 * @return true if mapping was successful, false otherwise
64 */
65 boolean allocateMapping(IntentId keyIntentId, IntentId valIntentId);
66
67 /**
68 * Returns the set of intents mapped to a lower intent.
69 *
70 * @param intentId intent ID
71 * @return set of intent IDs
72 */
73 Set<IntentId> getMapping(IntentId intentId);
74
75 /**
Marc De Leenheer9f7d1892015-05-30 13:22:24 -070076 * Releases the mapping of the given intent.
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070077 *
Marc De Leenheer9f7d1892015-05-30 13:22:24 -070078 * @param intentId intent ID
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070079 */
Marc De Leenheer9f7d1892015-05-30 13:22:24 -070080 void releaseMapping(IntentId intentId);
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070081
82 /**
83 * Releases the ports allocated to the given intent.
84 *
85 * @param intentId intent ID
86 * @return true if release was successful, false otherwise
87 */
88 boolean releasePorts(IntentId intentId);
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070089}