import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+
import org.opendaylight.controller.sal.utils.HexEncode;
import org.opendaylight.controller.sal.utils.NetUtils;
public class LLDP extends Packet {
private static final String CHASSISID = "ChassisId";
+ private static final String SYSTEMNAMEID = "SystemNameID";
private static final String PORTID = "PortId";
private static final String TTL = "TTL";
- private static final int LLDPDefaultTlvs = 3;
+ private static final int LLDPDefaultTlvs = 4;
private static LLDPTLV emptyTLV = new LLDPTLV().setLength((short) 0)
.setType((byte) 0);
public static final byte[] LLDPMulticastMac = { 1, (byte) 0x80,
return this;
}
+ /**
+ * @return the SystemName TLV
+ */
+ public LLDPTLV getSystemNameId() {
+ return getTLV(SYSTEMNAMEID);
+ }
+
+ /**
+ * @param LLDPTLV
+ * - the chassisId to set
+ */
+ public LLDP setSystemNameId(LLDPTLV systemNameId) {
+ tlvList.put(getType(SYSTEMNAMEID), systemNameId);
+ return this;
+ }
+
/**
* @return LLDPTLV - the portId TLV
*/
while (lldpSize > 0) {
LLDPTLV tlv = new LLDPTLV();
tlv.deserialize(data, lldpOffset, lldpSize);
+ if (tlv.getType() == 0 && tlv.getLength() == 0) {
+ break;
+ }
int tlvSize = tlv.getTLVSize(); // Size of current TLV in bits
lldpOffset += tlvSize;
lldpSize -= tlvSize;
/**
* Returns the size of LLDP packet in bytes
- *
+ *
* @return int - LLDP Packet size in bytes
*/
private int getLLDPPacketLength() {