blob: ee28f6eae9f902dad0396bb2ce2d435dbe631733 [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'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.Link;
19import org.onosproject.net.Path;
Brian O'Connor6de2e202015-05-21 14:30:41 -070020import org.onosproject.net.resource.link.LinkResourceService;
Thomas Vachuskaedc944c2014-11-04 15:42:25 -080021
22/**
23 * Representation of a connectivity constraint capable of evaluating a link
24 * and determining the cost of traversing that link in the context of this
25 * constraint.
26 */
27public interface Constraint {
28
29 // TODO: Consider separating cost vs viability.
30
31 /**
32 * Evaluates the specified link and provides the cost for its traversal.
33 *
34 * @param link link to be evaluated
35 * @param resourceService resource service for validating availability of
36 * link resources
37 * @return cost of link traversal
38 */
39 double cost(Link link, LinkResourceService resourceService);
40
41 /**
42 * Validates that the specified path satisfies the constraint.
43 *
44 * @param path path to be validated
45 * @param resourceService resource service for validating availability of
46 * link resources
47 * @return cost of link traversal
48 */
49 boolean validate(Path path, LinkResourceService resourceService);
50
51}