blob: 26ba61bf509c9b5af26c24ce68561fa39d0b5650 [file] [log] [blame]
Thomas Vachuska5dd52f72014-11-28 19:27:45 -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.constraint;
Thomas Vachuska5dd52f72014-11-28 19:27:45 -080017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.Link;
19import org.onosproject.net.Path;
20import org.onosproject.net.intent.Constraint;
21import org.onosproject.net.resource.LinkResourceService;
Thomas Vachuska5dd52f72014-11-28 19:27:45 -080022
23import java.util.Objects;
24
25import static com.google.common.base.MoreObjects.toStringHelper;
26
27/**
28 * Constraint that serves as a request for asymmetric bi-directional path.
29 */
30public class AsymmetricPathConstraint implements Constraint {
31
32 @Override
33 public double cost(Link link, LinkResourceService resourceService) {
34 return 1;
35 }
36
37 @Override
38 public boolean validate(Path path, LinkResourceService resourceService) {
39 return true;
40 }
41
42 @Override
43 public int hashCode() {
44 return Objects.hashCode(true);
45 }
46
47 @Override
48 public boolean equals(Object obj) {
49 if (this == obj) {
50 return true;
51 }
52 if (obj == null || getClass() != obj.getClass()) {
53 return false;
54 }
55 return true;
56 }
57
58 @Override
59 public String toString() {
60 return toStringHelper(this).toString();
61 }
62}