blob: 03acf17c9380518ba698f37a666f18b78a4699db [file] [log] [blame]
Thomas Vachuskaedc944c2014-11-04 15:42:25 -08001/*
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'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent;
Thomas Vachuskaedc944c2014-11-04 15:42:25 -080017
Brian O'Connor9476fa12015-06-25 15:17:17 -040018import com.google.common.annotations.Beta;
Brian O'Connorabafb502014-12-02 22:26:20 -080019import org.onosproject.net.Link;
20import org.onosproject.net.Path;
Brian O'Connor6de2e202015-05-21 14:30:41 -070021import org.onosproject.net.resource.link.LinkResourceService;
Thomas Vachuskaedc944c2014-11-04 15:42:25 -080022
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'Connor9476fa12015-06-25 15:17:17 -040028@Beta
Thomas Vachuskaedc944c2014-11-04 15:42:25 -080029public 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}