java.lang.Object
org.opendaylight.openflowplugin.libraries.liblldp.Packet
org.opendaylight.openflowplugin.libraries.liblldp.LLDPTLV

public class LLDPTLV extends Packet
Class that represents the LLDPTLV objects.
  • Field Details

    • fieldValues

      protected Map<String,byte[]> fieldValues
  • Constructor Details

    • LLDPTLV

      public LLDPTLV()
      Default constructor that creates and sets the hash map values and sets the payload to null.
    • LLDPTLV

      public LLDPTLV(LLDPTLV other)
      Constructor that writes the passed LLDPTLV values to the hdrFieldsMap.
  • Method Details

    • getLength

      public int getLength()
      Returns the length of TLV.
    • getType

      public byte getType()
      Returns the type of TLV.
    • getValue

      public byte[] getValue()
      Returns the value field of TLV.
    • setType

      public LLDPTLV setType(byte type)
      Sets the type.
      Parameters:
      type - the type to set
      Returns:
      LLDPTLV
    • setLength

      public LLDPTLV setLength(short length)
      Sets the length.
      Parameters:
      length - the length to set
      Returns:
      LLDPTLV
    • setValue

      public LLDPTLV setValue(byte[] value)
      Sets the value.
      Parameters:
      value - the value to set
      Returns:
      LLDPTLV
    • setHeaderField

      public void setHeaderField(String headerField, byte[] readValue)
      Overrides:
      setHeaderField in class Packet
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Packet
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Packet
    • getfieldnumBits

      public int getfieldnumBits(String fieldName)
      Description copied from class: Packet
      This method fetches the number of bits for header field specified by 'fieldname'. The numBits are present in the hdrFieldCoordMap of the respective packet class
      Overrides:
      getfieldnumBits in class Packet
      Returns:
      Integer - number of bits of the requested field
    • getTLVSize

      public int getTLVSize()
      Returns the size in bits of the whole TLV.
      Returns:
      int - size in bits of full TLV
    • createSystemNameTLVValue

      public static byte[] createSystemNameTLVValue(String nodeId)
      Creates the SystemName TLV value.
      Parameters:
      nodeId - node identifier string
      Returns:
      the SystemName TLV value in byte array
    • createChassisIDTLVValue

      public static byte[] createChassisIDTLVValue(String nodeId)
      Creates the ChassisID TLV value including the subtype and ChassisID string.
      Parameters:
      nodeId - node identifier string
      Returns:
      the ChassisID TLV value in byte array
    • createPortIDTLVValue

      public static byte[] createPortIDTLVValue(String portId)
      Creates the PortID TLV value including the subtype and PortID string.
      Parameters:
      portId - port identifier string
      Returns:
      the PortID TLV value in byte array
    • createCustomTLVValue

      public static byte[] createCustomTLVValue(String customString)
      Creates the custom TLV value including OUI, subtype and custom string.
      Parameters:
      customString - port identifier string
      Returns:
      the custom TLV value in byte array
      See Also:
    • createCustomTLVValue

      public static byte[] createCustomTLVValue(byte[] subtype, byte[] customByteArray)
      Creates the custom TLV value including OUI, subtype and custom string.
      Parameters:
      subtype - openflow subtype
      customByteArray - port identifier string
      Returns:
      the custom TLV value in byte array
    • createSecSubTypeCustomTLVValue

      public static byte[] createSecSubTypeCustomTLVValue(byte[] customValue)
      Creates a custom TLV value including OUI of sub type custom sec and custom bytes value.
      Parameters:
      customValue - the custom value
      Returns:
      the custom TLV value in byte array
    • getHexStringValue

      public static String getHexStringValue(byte[] tlvValue, int tlvLen)
      Retrieves the string from TLV value and returns it in HexString format.
      Parameters:
      tlvValue - the TLV value
      tlvLen - the TLV length
      Returns:
      the HexString
    • getStringValue

      public static String getStringValue(byte[] tlvValue, int tlvLen)
      Retrieves the string from TLV value.
      Parameters:
      tlvValue - the TLV value
      tlvLen - the TLV length
      Returns:
      the string
    • getCustomString

      public static String getCustomString(byte[] customTlvValue, int customTlvLen)
      Retrieves the custom string from the Custom TLV value which includes OUI, subtype and custom string.
      Parameters:
      customTlvValue - the custom TLV value
      customTlvLen - the custom TLV length
      Returns:
      the custom string
    • extractCustomOUI

      public static int extractCustomOUI(LLDPTLV lldptlv)
    • extractCustomSubtype

      public static byte extractCustomSubtype(LLDPTLV lldptlv)
    • createPortSubTypeCustomTLVKey

      public static CustomTLVKey createPortSubTypeCustomTLVKey()
    • createSecSubTypeCustomTLVKey

      public static CustomTLVKey createSecSubTypeCustomTLVKey()