blob: 8813b5b53fcc8ad1eda028ccc3230a1e4685f44c [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.Port;
19import org.onosproject.net.intent.Intent;
20import org.onosproject.net.intent.IntentId;
21
22import java.util.Set;
23
24/**
25 * Service for providing device resources.
26 */
27public interface DeviceResourceService {
28 /**
29 * Request a set of ports needed to satisfy the intent.
30 *
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070031 * @param ports set of ports to allocate
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070032 * @param intent the intent
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070033 * @return true if ports were successfully allocated, false otherwise
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070034 */
Marc De Leenheer8c2caac2015-05-28 16:37:33 -070035 boolean requestPorts(Set<Port> ports, Intent intent);
36
37 /**
38 * Returns the set of ports allocated for an intent.
39 *
40 * @param intentId the intent ID
41 * @return set of allocated ports
42 */
43 Set<Port> getAllocations(IntentId intentId);
44
45 /**
46 * Returns the intent allocated to a port.
47 *
48 * @param port the port
49 * @return intent ID allocated to the port
50 */
51 IntentId getAllocations(Port port);
52
53 /**
54 * Request a mapping between the given intents.
55 *
56 * @param keyIntentId the key intent ID
57 * @param valIntentId the value intent ID
58 * @return true if mapping was successful, false otherwise
59 */
60 boolean requestMapping(IntentId keyIntentId, IntentId valIntentId);
61
62 /**
63 * Returns the intents mapped to a lower intent.
64 *
65 * @param intentId the intent ID
66 * @return the set of intent IDs
67 */
68 Set<IntentId> getMapping(IntentId intentId);
69
Marc De Leenheer9f7d1892015-05-30 13:22:24 -070070 /**
71 * Release mapping of given intent.
72 *
73 * @param intentId intent ID
74 */
75 void releaseMapping(IntentId intentId);
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070076
77 /**
78 * Release ports associated with given intent ID.
79 *
80 * @param intentId intent ID
81 */
82 void releasePorts(IntentId intentId);
83}