Class LLDPTLV
- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LLDPTLV.TLVType
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,byte[]>
fieldValues
-
Fields inherited from class org.opendaylight.openflowplugin.libraries.liblldp.Packet
corrupted, hdrFieldCoordMap, hdrFieldsMap, parent, payload, payloadFactory, rawPayload, writeAccess
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]
createChassisIDTLVValue(String nodeId)
Creates the ChassisID TLV value including the subtype and ChassisID string.static byte[]
createCustomTLVValue(byte[] subtype, byte[] customByteArray)
Creates the custom TLV value including OUI, subtype and custom string.static byte[]
createCustomTLVValue(String customString)
Creates the custom TLV value including OUI, subtype and custom string.static byte[]
createPortIDTLVValue(String portId)
Creates the PortID TLV value including the subtype and PortID string.static CustomTLVKey
createPortSubTypeCustomTLVKey()
static CustomTLVKey
createSecSubTypeCustomTLVKey()
static byte[]
createSecSubTypeCustomTLVValue(byte[] customValue)
Creates a custom TLV value including OUI of sub type custom sec and custom bytes value.static byte[]
createSystemNameTLVValue(String nodeId)
Creates the SystemName TLV value.boolean
equals(Object obj)
static int
extractCustomOUI(LLDPTLV lldptlv)
static byte
extractCustomSubtype(LLDPTLV lldptlv)
static String
getCustomString(byte[] customTlvValue, int customTlvLen)
Retrieves the custom string from the Custom TLV value which includes OUI, subtype and custom string.int
getfieldnumBits(String fieldName)
This method fetches the number of bits for header field specified by 'fieldname'.static String
getHexStringValue(byte[] tlvValue, int tlvLen)
Retrieves the string from TLV value and returns it in HexString format.int
getLength()
Returns the length of TLV.static String
getStringValue(byte[] tlvValue, int tlvLen)
Retrieves the string from TLV value.int
getTLVSize()
Returns the size in bits of the whole TLV.byte
getType()
Returns the type of TLV.byte[]
getValue()
Returns the value field of TLV.int
hashCode()
void
setHeaderField(String headerField, byte[] readValue)
LLDPTLV
setLength(short length)
Sets the length.LLDPTLV
setType(byte type)
Sets the type.LLDPTLV
setValue(byte[] value)
Sets the value.-
Methods inherited from class org.opendaylight.openflowplugin.libraries.liblldp.Packet
deserialize, getfieldOffset, getHeaderSize, getParent, getPayload, getRawPayload, isCorrupted, postDeserializeCustomOperation, postSerializeCustomOperation, serialize, setParent, setPayload, setRawPayload, toString
-
-
-
-
Constructor Detail
-
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 Detail
-
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 classPacket
-
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 classPacket
- 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(byte[],byte[])
-
createCustomTLVValue
public static byte[] createCustomTLVValue(byte[] subtype, byte[] customByteArray)
Creates the custom TLV value including OUI, subtype and custom string.- Parameters:
subtype
- openflow subtypecustomByteArray
- 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 valuetlvLen
- 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 valuetlvLen
- 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 valuecustomTlvLen
- 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()
-
-