Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.incubator.net.domain; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | |
| 20 | import java.util.List; |
| 21 | import java.util.Set; |
| 22 | |
| 23 | /** |
| 24 | * FIXME. |
| 25 | */ |
| 26 | @Beta |
| 27 | public interface IntentDomainProvider { |
| 28 | |
| 29 | /** |
| 30 | * Requests that the provider attempt to satisfy the intent primitive. |
| 31 | * The application must apply the context before the intent resource |
| 32 | * can be used. Request contexts can be explictly cancelled, or they will |
| 33 | * eventually time out so that resources can be reused. |
| 34 | * |
Brian O'Connor | 59a9285 | 2015-07-30 19:08:24 -0700 | [diff] [blame] | 35 | * @param domain intent domain for the request |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 36 | * @param primitive intent primitive |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 37 | * @return intent resources that specify paths that satisfy the request. |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 38 | */ |
| 39 | //TODO Consider an iterable and/or holds (only hold one or two reservation(s) at a time) |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 40 | List<DomainIntentResource> request(IntentDomain domain, IntentPrimitive primitive); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Request that the provider attempt to modify an existing resource to satisfy |
| 44 | * a new intent primitive. The application must apply the context before |
| 45 | * the intent resource can be used. |
| 46 | * |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 47 | * @param oldResource the resource to be replaced |
| 48 | * @param newResource the resource to be applied |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 49 | * @return request contexts that contain resources to satisfy the intent |
| 50 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 51 | DomainIntentResource modify(DomainIntentResource oldResource, DomainIntentResource newResource); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * Requests that the provider release an intent resource. |
| 55 | * |
| 56 | * @param resource intent resource |
| 57 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 58 | void release(DomainIntentResource resource); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 59 | |
| 60 | /** |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 61 | * Requests that the provider apply the path from the intent resource. |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 62 | * |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 63 | * @param domainIntentResource request context |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 64 | * @return intent resource that satisfies the intent |
| 65 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 66 | DomainIntentResource apply(DomainIntentResource domainIntentResource); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 67 | |
| 68 | /** |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 69 | * Requests that the provider cancel the path. Requests that are not applied |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 70 | * will be eventually timed out by the provider. |
| 71 | * |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 72 | * @param domainIntentResource the intent resource whose path should be cancelled. |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 73 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 74 | void cancel(DomainIntentResource domainIntentResource); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Returns all intent resources held by the provider. |
| 78 | * |
| 79 | * @return set of intent resources |
| 80 | */ |
Aaron Kruglikov | b4916d0 | 2015-09-08 16:22:25 -0700 | [diff] [blame^] | 81 | Set<DomainIntentResource> getResources(); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | |