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 java.util.Arrays;
13 import org.opendaylight.protocol.pcep.PCEPTlv;
16 * Structure of LSP Update Error TLV.
19 * href="http://tools.ietf.org/html/draft-crabbe-pce-stateful-pce-02#section-7.2.3">LSP
20 * Update Error Code TLV</a>
22 public class LSPUpdateErrorTlv implements PCEPTlv {
23 private static final long serialVersionUID = -6919035417806059716L;
24 private final byte[] errorCode;
27 * Constructs new LSP Update Error Tlv.
30 * byte[]. Size has to be 4 bytes.
32 public LSPUpdateErrorTlv(byte[] errorCode) {
33 if (errorCode.length != 4)
34 throw new IllegalArgumentException("Update error code has wrong size.");
35 this.errorCode = errorCode;
41 * @return error code as byte[]
43 public byte[] getErrorCode() {
44 return this.errorCode;
48 public int hashCode() {
51 result = prime * result + Arrays.hashCode(this.errorCode);
56 public boolean equals(Object obj) {
61 if (this.getClass() != obj.getClass())
63 final LSPUpdateErrorTlv other = (LSPUpdateErrorTlv) obj;
64 if (!Arrays.equals(this.errorCode, other.errorCode))
70 public String toString() {
71 final StringBuilder builder = new StringBuilder();
72 builder.append("LSPUpdateErrorTlv [errorCode=");
73 builder.append(Arrays.toString(this.errorCode));
75 return builder.toString();