@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (!super.equals(obj))
+ }
+ if (!super.equals(obj)) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
LLDPTLV other = (LLDPTLV) obj;
if (fieldValues == null) {
- if (other.fieldValues != null)
+ if (other.fieldValues != null) {
return false;
- } else if (!fieldValues.equals(other.fieldValues))
+ }
+ } else if (!fieldValues.equals(other.fieldValues)) {
return false;
+ }
return true;
}
getfieldnumBits(VALUE)); // variable
}
+ /**
+ * Creates the SystemName TLV value
+ *
+ * @param nodeId
+ * node identifier string
+ * @return the SystemName TLV value in byte array
+ */
+ static public byte[] createSystemNameTLVValue(String nodeId) {
+ byte[] nid = nodeId.getBytes();
+ return nid;
+ }
+
/**
* Creates the ChassisID TLV value including the subtype and ChassisID
* string
* @return the string
*/
static public String getStringValue(byte[] tlvValue, int tlvLen) {
+ byte[] pidSubType = new byte[portIDSubType.length];
byte[] pidBytes = new byte[tlvLen - portIDSubType.length];
+ System.arraycopy(tlvValue, 0, pidSubType, 0,
+ pidSubType.length);
System.arraycopy(tlvValue, portIDSubType.length, pidBytes, 0,
pidBytes.length);
- return (new String(pidBytes, Charset.defaultCharset()));
+ if (pidSubType[0] == (byte) 0x3) {
+ return HexEncode.bytesToHexStringFormat(pidBytes);
+ } else {
+ return (new String(pidBytes, Charset.defaultCharset()));
+ }
}
/**