@Test public void testDeserialize() { LLDPOrganizationalTLV tlv = new LLDPOrganizationalTLV(); tlv.deserialize(ByteBuffer.wrap(expected)); assertThat(tlv.getType(), is((byte)127)); assertThat(tlv.getLength(), is((short)13)); assertThat(tlv.getOUI(), is(new byte[] {0x0, 0x26, (byte) 0xe1})); assertThat(tlv.getSubType(), is((byte)12)); assertThat(tlv.getInfoString(), is("ExtraInfo".getBytes(Charset.forName("UTF-8")))); }
@Override public LLDPTLV deserialize(ByteBuffer bb) { super.deserialize(bb); ByteBuffer optionalField = ByteBuffer.wrap(value); byte[] oui = new byte[OUI_LENGTH]; optionalField.get(oui); setOUI(oui); setSubType(optionalField.get()); byte[] infoString = new byte[getLength() - OUI_LENGTH - SUBTYPE_LENGTH]; optionalField.get(infoString); setInfoString(infoString); return this; }
LLDPOrganizationalTLV extends LLDPTLV { @Override public LLDPTLV deserialize(ByteBuffer bb) { super.deserialize(bb); ByteBuffer optionalField = ByteBuffer.wrap(value); byte[] oui = new byte[OUI_LENGTH]; optionalField.get(oui); setOUI(oui); setSubType(optionalField.get()); byte[] infoString = new byte[getLength() - OUI_LENGTH - SUBTYPE_LENGTH]; optionalField.get(infoString); setInfoString(infoString); return this; } }
LLDPOrganizationalTLV extends LLDPTLV { @Override public LLDPTLV deserialize(ByteBuffer bb) { super.deserialize(bb); ByteBuffer optionalField = ByteBuffer.wrap(value); byte[] oui = new byte[OUI_LENGTH]; optionalField.get(oui); setOUI(oui); setSubType(optionalField.get()); byte[] infoString = new byte[getLength() - OUI_LENGTH - SUBTYPE_LENGTH]; optionalField.get(infoString); setInfoString(infoString); return this; } LLDPOrganizationalTLV(); }
LLDPOrganizationalTLV extends LLDPTLV { @Override public LLDPTLV deserialize(ByteBuffer bb) { super.deserialize(bb); ByteBuffer optionalField = ByteBuffer.wrap(value); byte[] oui = new byte[OUI_LENGTH]; optionalField.get(oui); setOUI(oui); setSubType(optionalField.get()); byte[] infoString = new byte[getLength() - OUI_LENGTH - SUBTYPE_LENGTH]; optionalField.get(infoString); setInfoString(infoString); return this; } LLDPOrganizationalTLV(); LLDPOrganizationalTLV setOUI(byte[] oui); byte[] getOUI(); LLDPOrganizationalTLV setSubType(byte subType); byte getSubType(); LLDPOrganizationalTLV setInfoString(byte[] infoString); LLDPOrganizationalTLV setInfoString(String infoString); byte[] getInfoString(); @Override byte[] serialize(); @Override LLDPTLV deserialize(ByteBuffer bb); @Override int hashCode(); @Override boolean equals(Object obj); }
LLDPOrganizationalTLV extends LLDPTLV { @Override public LLDPTLV deserialize(ByteBuffer bb) { super.deserialize(bb); ByteBuffer optionalField = ByteBuffer.wrap(value); byte[] oui = new byte[OUI_LENGTH]; optionalField.get(oui); setOUI(oui); setSubType(optionalField.get()); byte[] infoString = new byte[getLength() - OUI_LENGTH - SUBTYPE_LENGTH]; optionalField.get(infoString); setInfoString(infoString); return this; } LLDPOrganizationalTLV(); LLDPOrganizationalTLV setOUI(byte[] oui); byte[] getOUI(); LLDPOrganizationalTLV setSubType(byte subType); byte getSubType(); LLDPOrganizationalTLV setInfoString(byte[] infoString); LLDPOrganizationalTLV setInfoString(String infoString); byte[] getInfoString(); @Override byte[] serialize(); @Override LLDPTLV deserialize(ByteBuffer bb); @Override int hashCode(); @Override boolean equals(Object obj); static final int OUI_LENGTH; static final int SUBTYPE_LENGTH; static final byte ORGANIZATIONAL_TLV_TYPE; static final int MAX_INFOSTRING_LENGTH; }