Merge "Randomize port to allow concurrent execution"
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / concepts / LSPSymbolicName.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.pcep.concepts;
9
10 import org.opendaylight.protocol.concepts.AbstractIdentifier;
11 import org.opendaylight.protocol.util.ByteArray;
12 import com.google.common.base.Objects.ToStringHelper;
13
14 /**
15  * @see <a
16  *      href="http://tools.ietf.org/html/draft-crabbe-pce-stateful-pce-02#section-7.2.1">The
17  *      LSP Symbolic Name TLV</a>
18  */
19 public final class LSPSymbolicName extends AbstractIdentifier<LSPSymbolicName> {
20
21         private static final long serialVersionUID = -5649378295100912021L;
22
23         private final byte[] symbolicName;
24
25         /**
26          * Creates LSPSymbolicName using byte array as value.
27          *
28          * @param symbolicName
29          *            value of the LSPSymbolicName TLV
30          */
31         public LSPSymbolicName(final byte[] symbolicName) {
32                 this.symbolicName = symbolicName;
33         }
34
35         /**
36          * Gets Symbolic Name in raw byte array representation.
37          *
38          * @return byte array representation of Symbolic Name. May be null.
39          */
40         public byte[] getSymbolicName() {
41                 return this.symbolicName;
42         }
43
44         @Override
45         protected byte[] getBytes() {
46                 return this.symbolicName;
47         }
48
49         @Override
50         protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
51                 return toStringHelper.add("symbolicName", ByteArray.toHexString(symbolicName, "."));
52         }
53 }