Search in sources :

Example 11 with TpPort

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();
}
Also used : StatsInfo(org.onosproject.openstacktelemetry.api.StatsInfo) DeviceId(org.onosproject.net.DeviceId) IpAddress(org.onlab.packet.IpAddress) TpPort(org.onlab.packet.TpPort) MacAddress(org.onlab.packet.MacAddress) VlanId(org.onlab.packet.VlanId)

Aggregations

TpPort (org.onlab.packet.TpPort)11 IpAddress (org.onlab.packet.IpAddress)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 NumericNode (com.fasterxml.jackson.databind.node.NumericNode)3 TextNode (com.fasterxml.jackson.databind.node.TextNode)3 Test (org.junit.Test)3 DeviceId (org.onosproject.net.DeviceId)3 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Tools.delay (org.onlab.util.Tools.delay)2 AnnotationKeys (org.onosproject.net.AnnotationKeys)2 DeviceService (org.onosproject.net.device.DeviceService)2 AbstractHandlerBehaviour (org.onosproject.net.driver.AbstractHandlerBehaviour)2 DriverHandler (org.onosproject.net.driver.DriverHandler)2 TrafficSelector (org.onosproject.net.flow.TrafficSelector)2 PiExactFieldMatch (org.onosproject.net.pi.runtime.PiExactFieldMatch)2 PiTernaryFieldMatch (org.onosproject.net.pi.runtime.PiTernaryFieldMatch)2 OvsdbBridge (org.onosproject.ovsdb.controller.OvsdbBridge)2