use of org.onlab.packet.TpPort in project onos by opennetworkinglab.
the class TinaFlowInfoByteBufferCodec method decode.
@Override
public FlowInfo decode(ByteBuffer byteBuffer) {
byte flowType = byteBuffer.get();
String deviceIdStr = String.format("%016x", byteBuffer.getShort());
DeviceId deviceId = DeviceId.deviceId(OF_PREFIX + deviceIdStr);
int inputInterfaceId = byteBuffer.getInt();
int outputInterfaceId = byteBuffer.getInt();
VlanId vlanId = VlanId.vlanId(byteBuffer.getShort());
IpAddress srcIp = IpAddress.valueOf(Version.INET, getIpv4Octets(byteBuffer));
int srcPrefixLen = byteBuffer.get();
TpPort srcPort = TpPort.tpPort((int) byteBuffer.getShort());
IpAddress dstIp = IpAddress.valueOf(Version.INET, getIpv4Octets(byteBuffer));
int dstPrefixLen = byteBuffer.get();
TpPort dstPort = TpPort.tpPort((int) byteBuffer.getShort());
byte protocol = byteBuffer.get();
MacAddress srcMac = MacAddress.valueOf(getMacByteArray(byteBuffer));
MacAddress dstMac = MacAddress.valueOf(getMacByteArray(byteBuffer));
TinaStatsInfoByteBufferCodec statsInfoByteBufferCodec = new TinaStatsInfoByteBufferCodec();
StatsInfo statsInfo = statsInfoByteBufferCodec.decode(byteBuffer);
return new DefaultFlowInfo.DefaultBuilder().withFlowType(flowType).withDeviceId(deviceId).withInputInterfaceId(inputInterfaceId).withOutputInterfaceId(outputInterfaceId).withVlanId(vlanId).withSrcIp(IpPrefix.valueOf(srcIp, srcPrefixLen)).withSrcPort(srcPort).withDstIp(IpPrefix.valueOf(dstIp, dstPrefixLen)).withDstPort(dstPort).withProtocol(protocol).withSrcMac(srcMac).withDstMac(dstMac).withStatsInfo(statsInfo).build();
}
Aggregations