Thomas Vachuska | edc944c | 2014-11-04 15:42:25 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Thomas Vachuska | edc944c | 2014-11-04 15:42:25 -0800 | [diff] [blame] | 17 | |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 19 | import org.onosproject.net.Link; |
| 20 | import org.onosproject.net.Path; |
Brian O'Connor | 6de2e20 | 2015-05-21 14:30:41 -0700 | [diff] [blame] | 21 | import org.onosproject.net.resource.link.LinkResourceService; |
Thomas Vachuska | edc944c | 2014-11-04 15:42:25 -0800 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Representation of a connectivity constraint capable of evaluating a link |
| 25 | * and determining the cost of traversing that link in the context of this |
| 26 | * constraint. |
| 27 | */ |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 28 | @Beta |
Thomas Vachuska | edc944c | 2014-11-04 15:42:25 -0800 | [diff] [blame] | 29 | public interface Constraint { |
| 30 | |
| 31 | // TODO: Consider separating cost vs viability. |
| 32 | |
| 33 | /** |
| 34 | * Evaluates the specified link and provides the cost for its traversal. |
| 35 | * |
| 36 | * @param link link to be evaluated |
| 37 | * @param resourceService resource service for validating availability of |
| 38 | * link resources |
| 39 | * @return cost of link traversal |
| 40 | */ |
| 41 | double cost(Link link, LinkResourceService resourceService); |
| 42 | |
| 43 | /** |
| 44 | * Validates that the specified path satisfies the constraint. |
| 45 | * |
| 46 | * @param path path to be validated |
| 47 | * @param resourceService resource service for validating availability of |
| 48 | * link resources |
| 49 | * @return cost of link traversal |
| 50 | */ |
| 51 | boolean validate(Path path, LinkResourceService resourceService); |
| 52 | |
| 53 | } |