2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.protocol.pcep.tlv;
11 import org.opendaylight.protocol.pcep.PCEPTlv;
14 * Structure of No Path Vector TLV. Extended to conform RFC5557.
16 * @see <a href="http://tools.ietf.org/html/rfc5440#section-7.5">NO-PATH Object
17 * [RFC5440]</a> - defined in text
18 * @see <a href="http://tools.ietf.org/html/rfc5557#section-5.7">NO-PATH
19 * Indicator [RFC5557]</a>
21 public class NoPathVectorTlv implements PCEPTlv {
23 private static final long serialVersionUID = -4993945476359800826L;
25 private final boolean pceUnavailable;
27 private final boolean unknownDest;
29 private final boolean unknownSrc;
31 private final boolean noGCOSolution;
33 private final boolean noGCOMigrationPath;
35 private final boolean reachablityProblem;
38 * Constructs new No Path Vector Tlv.
40 * @param pceUnavailable
46 * @param noGCOSolution
48 * @param noGCOMigrationPath
51 public NoPathVectorTlv(boolean pceUnavailable, boolean unknownDest, boolean unknownSrc, boolean noGCOSolution, boolean noGCOMigrationPath,
52 boolean reachabilityProblem) {
54 this.pceUnavailable = pceUnavailable;
55 this.unknownDest = unknownDest;
56 this.unknownSrc = unknownSrc;
57 this.noGCOSolution = noGCOSolution;
58 this.noGCOMigrationPath = noGCOMigrationPath;
59 this.reachablityProblem = reachabilityProblem;
63 * Returns true if PCE currently unavailable
67 public boolean isPceUnavailable() {
68 return this.pceUnavailable;
72 * Returns true if unknown destination
76 public boolean isUnknownDest() {
77 return this.unknownDest;
81 * Returns true if unknown source
85 public boolean isUnknownSrc() {
86 return this.unknownSrc;
90 * If returns true the PCE indicates that no migration path was found.
94 public boolean isNoGCOSolution() {
95 return this.noGCOSolution;
99 * If returns true the PCE indicates no feasible solution was found that
100 * meets all the constraints associated with global concurrent path
101 * optimization in the PCRep message
105 public boolean isNoGCOMigrationPath() {
106 return this.noGCOMigrationPath;
110 * @return the reachablityProblem
112 public boolean isReachablityProblem() {
113 return this.reachablityProblem;
117 public int hashCode() {
118 final int prime = 31;
120 result = prime * result + (this.noGCOMigrationPath ? 1231 : 1237);
121 result = prime * result + (this.noGCOSolution ? 1231 : 1237);
122 result = prime * result + (this.pceUnavailable ? 1231 : 1237);
123 result = prime * result + (this.reachablityProblem ? 1231 : 1237);
124 result = prime * result + (this.unknownDest ? 1231 : 1237);
125 result = prime * result + (this.unknownSrc ? 1231 : 1237);
130 public boolean equals(Object obj) {
135 if (this.getClass() != obj.getClass())
137 final NoPathVectorTlv other = (NoPathVectorTlv) obj;
138 if (this.noGCOMigrationPath != other.noGCOMigrationPath)
140 if (this.noGCOSolution != other.noGCOSolution)
142 if (this.pceUnavailable != other.pceUnavailable)
144 if (this.reachablityProblem != other.reachablityProblem)
146 if (this.unknownDest != other.unknownDest)
148 if (this.unknownSrc != other.unknownSrc)
154 public String toString() {
155 final StringBuilder builder = new StringBuilder();
156 builder.append("NoPathVectorTlv [pceUnavailable=");
157 builder.append(this.pceUnavailable);
158 builder.append(", unknownDest=");
159 builder.append(this.unknownDest);
160 builder.append(", unknownSrc=");
161 builder.append(this.unknownSrc);
162 builder.append(", noGCOSolution=");
163 builder.append(this.noGCOSolution);
164 builder.append(", noGCOMigrationPath=");
165 builder.append(this.noGCOMigrationPath);
166 builder.append(", reachablityProblem=");
167 builder.append(this.reachablityProblem);
169 return builder.toString();