X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fcommons%2Fliblldp%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fliblldp%2FLLDP.java;h=1b76c9980576aee902e795c084f22f199383deb5;hp=85b2cbf82ecbf88123b0a351caf55328a4007d50;hb=af14e8a5cc7d3654785ffb8cf192eaeea8ba2fae;hpb=2d82dd8cc1845228818c121070548d4784cc65b7 diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java index 85b2cbf82e..1b76c99805 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java @@ -23,7 +23,7 @@ public class LLDP extends Packet { private static final String PORTID = "PortId"; private static final String TTL = "TTL"; private static final int LLDPDefaultTlvs = 3; - private static LLDPTLV emptyTLV = new LLDPTLV().setLength((short) 0).setType((byte) 0); + private static final LLDPTLV emptyTLV = new LLDPTLV().setLength((short) 0).setType((byte) 0); public static final byte[] LLDPMulticastMac = { 1, (byte) 0x80, (byte) 0xc2, 0, 0, (byte) 0xe }; private Map mandatoryTLVs; @@ -41,7 +41,7 @@ public class LLDP extends Packet { /** * Constructor that creates the tlvList LinkedHashMap and sets the write access for the same */ - public LLDP(boolean writeAccess) { + public LLDP(final boolean writeAccess) { super(writeAccess); init(); } @@ -57,7 +57,7 @@ public class LLDP extends Packet { * - description of the type of TLV * @return byte - type of TLV */ - private byte getType(String typeDesc) { + private byte getType(final String typeDesc) { if (typeDesc.equals(CHASSISID)) { return LLDPTLV.TLVType.ChassisID.getValue(); } else if (typeDesc.equals(PORTID)) { @@ -71,7 +71,7 @@ public class LLDP extends Packet { } } - private LLDPTLV getFromTLVs(Byte type) { + private LLDPTLV getFromTLVs(final Byte type) { LLDPTLV tlv = null; tlv = mandatoryTLVs.get(type); if (tlv == null) { @@ -90,26 +90,25 @@ public class LLDP extends Packet { } /** - * @param String + * @param type * - description of the type of TLV * @return LLDPTLV - full TLV */ - public LLDPTLV getTLV(String type) { + public LLDPTLV getTLV(final String type) { return getFromTLVs(getType(type)); } - public LLDPTLV getCustomTLV(CustomTLVKey key) { + public LLDPTLV getCustomTLV(final CustomTLVKey key) { return customTLVs.get(key); } /** - * @param String + * @param type * - description of the type of TLV - * @param LLDPTLV + * @param tlv * - tlv to set - * @return void */ - public void setTLV(String type, LLDPTLV tlv) { + public void setTLV(final String type, final LLDPTLV tlv) { putToTLVs(getType(type), tlv); } @@ -121,10 +120,10 @@ public class LLDP extends Packet { } /** - * @param LLDPTLV + * @param chassisId * - the chassisId to set */ - public LLDP setChassisId(LLDPTLV chassisId) { + public LLDP setChassisId(final LLDPTLV chassisId) { setTLV(CHASSISID, chassisId); return this; } @@ -137,10 +136,10 @@ public class LLDP extends Packet { } /** - * @param LLDPTLV - * - the chassisId to set + * @param systemNameId + * - the systemNameId to set */ - public LLDP setSystemNameId(LLDPTLV systemNameId) { + public LLDP setSystemNameId(final LLDPTLV systemNameId) { setTLV(SYSTEMNAMEID, systemNameId); return this; } @@ -153,11 +152,11 @@ public class LLDP extends Packet { } /** - * @param LLDPTLV + * @param portId * - the portId to set * @return LLDP */ - public LLDP setPortId(LLDPTLV portId) { + public LLDP setPortId(final LLDPTLV portId) { setTLV(PORTID, portId); return this; } @@ -170,11 +169,11 @@ public class LLDP extends Packet { } /** - * @param LLDPTLV + * @param ttl * - the ttl to set * @return LLDP */ - public LLDP setTtl(LLDPTLV ttl) { + public LLDP setTtl(final LLDPTLV ttl) { setTLV(TTL, ttl); return this; } @@ -198,7 +197,7 @@ public class LLDP extends Packet { * the optionalTLVList to set * @return LLDP */ - public LLDP setOptionalTLVList(List optionalTLVList) { + public LLDP setOptionalTLVList(final List optionalTLVList) { for (LLDPTLV tlv : optionalTLVList) { optionalTLVs.put(tlv.getType(), tlv); } @@ -206,7 +205,7 @@ public class LLDP extends Packet { } /** - * @param customTLVList + * @param customTLV * the list of custom TLVs to set * @return this LLDP */ @@ -219,7 +218,7 @@ public class LLDP extends Packet { } @Override - public Packet deserialize(byte[] data, int bitOffset, int size) throws PacketException { + public Packet deserialize(final byte[] data, final int bitOffset, final int size) throws PacketException { int lldpOffset = bitOffset; // LLDP start int lldpSize = size; // LLDP size @@ -258,7 +257,7 @@ public class LLDP extends Packet { int numBits = tlv.getTLVSize(); try { BitBufferHelper.setBytes(serializedBytes, tlv.serialize(), startOffset, numBits); - } catch (BufferException e) { + } catch (final BufferException e) { throw new PacketException(e.getMessage()); } startOffset += numBits; @@ -267,7 +266,7 @@ public class LLDP extends Packet { try { BitBufferHelper.setBytes(serializedBytes, LLDP.emptyTLV.serialize(), startOffset, LLDP.emptyTLV.getTLVSize()); - } catch (BufferException e) { + } catch (final BufferException e) { throw new PacketException(e.getMessage()); }