16 package org.openkilda.floodlight.pathverification;
18 import net.floodlightcontroller.packet.BasePacket;
19 import net.floodlightcontroller.packet.Data;
20 import net.floodlightcontroller.packet.IPacket;
21 import net.floodlightcontroller.packet.LLDPTLV;
22 import org.projectfloodlight.openflow.types.EthType;
24 import java.nio.ByteBuffer;
25 import java.util.ArrayList;
26 import java.util.List;
31 protected LLDPTLV
ttl;
36 this.optionalTLVList =
new ArrayList<LLDPTLV>();
40 this.optionalTLVList =
new ArrayList<LLDPTLV>();
105 int length = 2 + this.chassisId.getLength() + 2 + this.portId.getLength() +
106 2 + this.ttl.getLength() + 2;
107 for (LLDPTLV tlv : this.optionalTLVList) {
109 length += 2 + tlv.getLength();
112 byte[]
data =
new byte[length];
113 ByteBuffer bb = ByteBuffer.wrap(
data);
114 bb.put(this.chassisId.serialize());
115 bb.put(this.portId.serialize());
116 bb.put(this.ttl.serialize());
117 for (LLDPTLV tlv : this.optionalTLVList) {
118 if (tlv != null) bb.put(tlv.serialize());
120 bb.putShort((
short) 0);
126 ByteBuffer bb = ByteBuffer.wrap(
data, offset, length);
129 tlv =
new LLDPTLV().deserialize(bb);
134 switch (tlv.getType()) {
139 this.chassisId = tlv;
148 this.optionalTLVList.add(tlv);
151 }
while (tlv.getType() != 0 && bb.hasRemaining());
160 final int prime = 883;
161 int result = super.hashCode();
177 if (!super.equals(obj))
195 if (other.
ttl != null)
197 }
else if (!
ttl.equals(other.
ttl))
205 str +=
"chassisId=" + ((this.chassisId == null) ?
"null" : this.chassisId.toString());
206 str +=
" portId=" + ((this.portId == null) ?
"null" : this.portId.toString());
207 str +=
" ttl=" + ((this.ttl == null) ?
"null" : this.ttl.toString());
208 str +=
" etherType=" +
ethType.toString();
209 str +=
" optionalTlvList=[";
210 if (this.optionalTLVList != null) {
VerificationPacket setTtl(LLDPTLV ttl)
List< LLDPTLV > optionalTLVList
VerificationPacket setPortId(LLDPTLV portId)
VerificationPacket setChassisId(LLDPTLV chassisId)
VerificationPacket(Data data)
List< LLDPTLV > getOptionalTLVList()
VerificationPacket setOptionalTLVList(List< LLDPTLV > optionalTLVList)
IPacket deserialize(byte[] data, int offset, int length)
boolean equals(Object obj)