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
8 package org.opendaylight.protocol.pcep.concepts;
10 import org.opendaylight.protocol.concepts.AbstractIdentifier;
11 import org.opendaylight.protocol.util.ByteArray;
12 import com.google.common.base.Objects.ToStringHelper;
15 * A 16-bit identifier used in the SENDER_TEMPLATE and the FILTER_SPEC that can
16 * be changed to allow a sender to share resources with itself.
18 public final class LSPIdentifier extends AbstractIdentifier<LSPIdentifier> {
20 private static final long serialVersionUID = 1337756730239265010L;
22 private final byte[] lspId;
25 * Creates LSPIdentifier using byte array as value.
28 * value of the LSPIdentifier TLV. Must be exactly 2 bytes long.
30 public LSPIdentifier(final byte[] lspId) {
31 if (lspId.length != 2)
32 throw new IllegalArgumentException("Invalid LSP identifier");
37 * Gets LSP Id in raw byte array representation.
39 * @return byte array representation of LSP ID. May be null.
41 public byte[] getLspId() {
46 protected byte[] getBytes() {
51 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
52 return toStringHelper.add("lspId", ByteArray.toHexString(lspId, "."));