Search in sources :

Example 11 with PiLpmFieldMatch

use of org.onosproject.net.pi.runtime.PiLpmFieldMatch in project up4 by omec-project.

the class Up4TranslatorUtil method getFieldPrefix.

static Ip4Prefix getFieldPrefix(PiTableEntry entry, PiMatchFieldId fieldId) {
    Optional<PiFieldMatch> optField = entry.matchKey().fieldMatch(fieldId);
    if (optField.isEmpty()) {
        return null;
    }
    PiLpmFieldMatch field = (PiLpmFieldMatch) optField.get();
    Ip4Address address = Ip4Address.valueOf(field.value().asArray());
    return Ip4Prefix.valueOf(address, field.prefixLength());
}
Also used : Ip4Address(org.onlab.packet.Ip4Address) PiFieldMatch(org.onosproject.net.pi.runtime.PiFieldMatch) PiLpmFieldMatch(org.onosproject.net.pi.runtime.PiLpmFieldMatch)

Aggregations

PiLpmFieldMatch (org.onosproject.net.pi.runtime.PiLpmFieldMatch)11 PiExactFieldMatch (org.onosproject.net.pi.runtime.PiExactFieldMatch)6 PiFieldMatch (org.onosproject.net.pi.runtime.PiFieldMatch)6 PiTernaryFieldMatch (org.onosproject.net.pi.runtime.PiTernaryFieldMatch)6 PiOptionalFieldMatch (org.onosproject.net.pi.runtime.PiOptionalFieldMatch)5 ImmutableByteSequence (org.onlab.util.ImmutableByteSequence)4 PiRangeFieldMatch (org.onosproject.net.pi.runtime.PiRangeFieldMatch)4 Test (org.junit.Test)3 ByteString (com.google.protobuf.ByteString)2 Ip4Address (org.onlab.packet.Ip4Address)2 ByteSequenceTrimException (org.onlab.util.ImmutableByteSequence.ByteSequenceTrimException)2 P4InfoOuterClass (p4.config.v1.P4InfoOuterClass)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Ip4Prefix (org.onlab.packet.Ip4Prefix)1 IpPrefix (org.onlab.packet.IpPrefix)1 UpfApplication (org.onosproject.net.behaviour.upf.UpfApplication)1 UpfGtpTunnelPeer (org.onosproject.net.behaviour.upf.UpfGtpTunnelPeer)1 UpfInterface (org.onosproject.net.behaviour.upf.UpfInterface)1 UpfSessionDownlink (org.onosproject.net.behaviour.upf.UpfSessionDownlink)1 UpfSessionUplink (org.onosproject.net.behaviour.upf.UpfSessionUplink)1