Thomas Vachuska | 5dd52f7 | 2014-11-28 19:27:45 -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.constraint; |
Thomas Vachuska | 5dd52f7 | 2014-11-28 19:27:45 -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; |
| 21 | import org.onosproject.net.intent.Constraint; |
Brian O'Connor | 6de2e20 | 2015-05-21 14:30:41 -0700 | [diff] [blame] | 22 | import org.onosproject.net.resource.link.LinkResourceService; |
Thomas Vachuska | 5dd52f7 | 2014-11-28 19:27:45 -0800 | [diff] [blame] | 23 | |
| 24 | import java.util.Objects; |
| 25 | |
| 26 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 27 | |
| 28 | /** |
| 29 | * Constraint that serves as a request for asymmetric bi-directional path. |
| 30 | */ |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 31 | @Beta |
Thomas Vachuska | 5dd52f7 | 2014-11-28 19:27:45 -0800 | [diff] [blame] | 32 | public class AsymmetricPathConstraint implements Constraint { |
| 33 | |
| 34 | @Override |
| 35 | public double cost(Link link, LinkResourceService resourceService) { |
| 36 | return 1; |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public boolean validate(Path path, LinkResourceService resourceService) { |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public int hashCode() { |
| 46 | return Objects.hashCode(true); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public boolean equals(Object obj) { |
| 51 | if (this == obj) { |
| 52 | return true; |
| 53 | } |
| 54 | if (obj == null || getClass() != obj.getClass()) { |
| 55 | return false; |
| 56 | } |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public String toString() { |
| 62 | return toStringHelper(this).toString(); |
| 63 | } |
| 64 | } |