public class FieldFactory extends AbstractFactory
MatchField
instances.
Used by the MatchFactory
in its loftier goal of creating
Match structures.
Also used to create basic fields for
Set-Field actions
.
To create basic match fields, one of the overloaded
createBasicField(pv, fieldType, ...)
methods can be invoked.
The following list documents the mapping of field types to payload types:
IN_PORT
- BigPortNumber
(not maskable)IN_PHY_PORT
-
BigPortNumber
(not maskable)METADATA
- longETH_DST
- MacAddress
ETH_SRC
- MacAddress
ETH_TYPE
- EthernetType
(not maskable)VLAN_VID
- VlanId
(not maskable)VLAN_PCP
- int
(u3, not maskable)IP_DSCP
- int
(u6, not maskable)IP_ECN
-
int (u2, not maskable)IP_PROTO
- IpProtocol
(not maskable)IPV4_SRC
- IpAddress
IPV4_DST
- IpAddress
TCP_SRC
- PortNumber
(not maskable)TCP_DST
- PortNumber
(not maskable)UDP_SRC
- PortNumber
(not maskable)UDP_DST
- PortNumber
(not maskable)SCTP_SRC
- PortNumber
(not maskable)SCTP_DST
- PortNumber
(not maskable)ICMPV4_TYPE
-
ICMPv4Type
(not maskable)ICMPV4_CODE
- int
(u8, not maskable)ARP_OP
- int
(u16, not maskable)ARP_SPA
- IpAddress
ARP_TPA
- IpAddress
ARP_SHA
- MacAddress
ARP_THA
- MacAddress
IPV6_SRC
- IpAddress
IPV6_DST
- IpAddress
IPV6_FLABEL
- int
(u20)ICMPV6_TYPE
-
ICMPv6Type
(not maskable)ICMPV6_CODE
- int
(u8, not maskable)IPV6_ND_TARGET
-
IpAddress
(not maskable)IPV6_ND_SLL
-
MacAddress
(not maskable)IPV6_ND_TLL
-
MacAddress
(not maskable)MPLS_LABEL
- int
(u20, not maskable)MPLS_TC
- int
(u3, not maskable)MPLS_BOS
- int
(u1, not maskable)PBB_ISID
- int (u24)TUNNEL_ID
- longIPV6_EXTHDR
-
Set<IPv6ExtHdr
>Modifier and Type | Method and Description |
---|---|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
BigPortNumber port)
Creates a basic match field for a big-port-number-based match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
EthernetType ethType)
Creates a basic match field for an ETH_TYPE match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
ICMPv4Type icmpv4Type)
Creates a basic match field for an ICMPv4 Type match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
ICMPv6Type icmpv6Type)
Creates a basic match field for an ICMPv6 Type match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
int value)
Creates a basic match field for an int-payload-based match field,
without a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
int value,
int mask)
Creates a basic match field for an int-payload-based match field,
with a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
IpAddress ip)
Creates a basic match field for an ip-address-based match field
without a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
IpAddress ip,
IpAddress mask)
Creates a basic match field for an ip-address-based match field
with a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
IpProtocol ipp)
Creates a basic match field for an IP Protocol match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
long value)
Creates a basic match field for a long-payload-based match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
long value,
long mask)
Creates a basic match field for a long-payload-based match field,
with a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
MacAddress mac)
Creates a basic match field for a mac-address-based match field
without a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
MacAddress mac,
MacAddress mask)
Creates a basic match field for a mac-address-based match field
with a mask.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
Map<IPv6ExtHdr,Boolean> flags)
Creates a basic match field for an IPV6_EXTHDR match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
PortNumber port)
Creates a basic match field for a port-number-based match field.
|
static MFieldBasic |
createBasicField(ProtocolVersion pv,
OxmBasicFieldType ft,
VlanId vlanId)
Creates a basic match field for a VLAN_VID.
|
static MFieldExperimenter |
createExperimenterField(ProtocolVersion pv,
int rawFieldType,
ExperimenterId eid,
byte[] payload)
Creates an experimenter match field.
|
static MFieldExperimenter |
createExperimenterField(ProtocolVersion pv,
int rawFieldType,
int experId,
byte[] payload)
Creates an experimenter match field.
|
static List<MatchField> |
createFieldHeaders(ProtocolVersion pv,
Map<OxmBasicFieldType,Boolean> map)
Creates minimal match field headers to be used in encoding a table
features OXM property.
|
static MFieldMinimal |
createMinimalField(ProtocolVersion pv,
OxmClass clazz,
int rawFieldType,
byte[] payload)
Creates a minimal match field for a known OXM Class.
|
static MFieldMinimal |
createMinimalField(ProtocolVersion pv,
OxmClass clazz,
int rawClazz,
int rawFieldType,
byte[] payload)
Creates a minimal match field for an unknown OXM Class.
|
static void |
encodeField(MatchField mf,
OfPacketWriter pkt)
Encodes a single OXM TLV match field, writing it into the supplied
buffer.
|
static void |
encodeFieldExperList(List<MFieldExperimenter> fields,
OfPacketWriter pkt)
Encodes a list of experimenter match fields, writing them into the
supplied buffer.
|
static void |
encodeFieldList(List<MatchField> fields,
OfPacketWriter pkt)
Encodes a list of match fields, writing them into the supplied buffer.
|
static MatchField |
parseField(OfPacketReader pkt,
ProtocolVersion pv)
Parses a single OXM TLV match field from the supplied buffer.
|
static List<MatchField> |
parseFieldHeaders(int targetRi,
OfPacketReader pkt,
ProtocolVersion pv)
Parses a list of match field header structures from the supplied
buffer.
|
protected String |
tag()
Returns an identifying tag for the field factory.
|
mpe, mpe, mpe, mpe
protected String tag()
tag
in class AbstractFactory
public static MatchField parseField(OfPacketReader pkt, ProtocolVersion pv) throws MessageParseException
PacketBuffer
to be advanced by the length of the field.pkt
- the data bufferpv
- the protocol versionMessageParseException
- if unable to parse the fieldpublic static List<MatchField> parseFieldHeaders(int targetRi, OfPacketReader pkt, ProtocolVersion pv) throws MessageParseException
MFieldBasicHeader
instances
or MFieldExperimenter
instances.targetRi
- the target reader indexpkt
- the data bufferpv
- the protocol versionMessageParseException
- if there is an issue parsing the structureTableFeatureFactory
,
TableFeaturePropOxm
public static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, BigPortNumber port)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typeport
- the port numberVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, MacAddress mac, MacAddress mask)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typemac
- the MAC addressmask
- the MAC address mask (may be null)VersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, MacAddress mac)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typemac
- the MAC addressVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, IpAddress ip, IpAddress mask)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typeip
- the IP addressmask
- the IP address mask (may be null)VersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriate
or IP address family is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, IpAddress ip)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typeip
- the IP addressVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriate
or IP address family is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, PortNumber port)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typeport
- the port numberVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, ICMPv4Type icmpv4Type)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field type (ICMPV4_TYPE)icmpv4Type
- the ICMPv4 TypeVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, ICMPv6Type icmpv6Type)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field type (ICMPV6_TYPE)icmpv6Type
- the ICMPv6 TypeVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, int value, int mask)
Supported basic field types for this method are:
ARP_OP
(u16, not maskable)IPV6_FLABEL
(u20)MPLS_LABEL
(u20, not maskable)PBB_ISID
(u24)VLAN_PCP
(u3, not maskable)IP_DSCP
(u6, not maskable)IP_ECN
(u2, not maskable)ICMPV4_CODE
(u8, not maskable)ICMPV6_CODE
(u8, not maskable)MPLS_TC
(u3, not maskable)MPLS_BOS
(u1, not maskable)pv
- the protocol versionft
- the field typevalue
- the valuemask
- the value mask (or 0 for no mask)VersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriate or
the value is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, int value)
Supported basic field types for this method are:
ARP_OP
(u16)IPV6_FLABEL
(u20)MPLS_LABEL
(u20)PBB_ISID
(u24)VLAN_PCP
(u3)IP_DSCP
(u6)IP_ECN
(u2)ICMPV4_CODE
(u8)ICMPV6_CODE
(u8)MPLS_TC
(u3)MPLS_BOS
(u1)pv
- the protocol versionft
- the field typevalue
- the valueVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriate or
the value is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, EthernetType ethType)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typeethType
- the Ethernet TypeVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, VlanId vlanId)
VlanId.NONE
and VlanId.PRESENT
can be used
to specify the absence or presence (without specifying the value)
of a VLAN tag.
Supported basic field types for this method are:
pv
- the protocol versionft
- the field type (VLAN_VID)vlanId
- the VLAN vid to matchVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, IpProtocol ipp)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field type (IP_PROTO)ipp
- the IP protocolVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, long value, long mask)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typevalue
- the valuemask
- the value maskVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriate
or the value is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, long value)
Supported basic field types for this method are:
pv
- the protocol versionft
- the field typevalue
- the valueVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriate
or the value is not appropriatepublic static MFieldBasic createBasicField(ProtocolVersion pv, OxmBasicFieldType ft, Map<IPv6ExtHdr,Boolean> flags)
Supported basic field types for this method are:
The provided map specifies those extension header flags that should
be matched on. If the value is true
, the header flag must be
present; if the value is false
, the header flag must be absent.
Those flags not included in the map are "don't care" values.
pv
- the protocol versionft
- the field type (IPV6_EXTHDR)flags
- the map of IPv6 Extension Header flags to matchVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if field type is not appropriatepublic static MFieldExperimenter createExperimenterField(ProtocolVersion pv, int rawFieldType, int experId, byte[] payload)
pv
- the protocol versionrawFieldType
- the experimenter-defined field typeexperId
- the encoded experimenter IDpayload
- the experimenter-defined payloadVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if rawFieldType is not U7public static MFieldExperimenter createExperimenterField(ProtocolVersion pv, int rawFieldType, ExperimenterId eid, byte[] payload)
pv
- the protocol versionrawFieldType
- the experimenter-defined field typeeid
- the experimenter IDpayload
- the experimenter-defined payloadVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if rawFieldType is not U7public static MFieldMinimal createMinimalField(ProtocolVersion pv, OxmClass clazz, int rawFieldType, byte[] payload)
createMinimalField(ProtocolVersion, OxmClass, int, int, byte[])
instead.pv
- the protocol versionclazz
- the OXM classrawFieldType
- the elsewhere-defined field typepayload
- the elsewhere-defined payloadVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if clazz is UNKNOWN or if
rawFieldType is not U7public static MFieldMinimal createMinimalField(ProtocolVersion pv, OxmClass clazz, int rawClazz, int rawFieldType, byte[] payload)
createMinimalField(ProtocolVersion, OxmClass, int, byte[])
instead.pv
- the protocol versionclazz
- the OXM class (UNKNOWN)rawClazz
- the elsewhere-defined OXM classrawFieldType
- the elsewhere-defined field typepayload
- the elsewhere-defined payloadVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullIllegalArgumentException
- if clazz is not UNKNOWN or if
rawClazz is not U16, or if rawFieldType is not U7.public static List<MatchField> createFieldHeaders(ProtocolVersion pv, Map<OxmBasicFieldType,Boolean> map)
pv
- the protocol versionmap
- the map of fields to createVersionNotSupportedException
- if the version is not supportedNullPointerException
- if any required parameter is nullpublic static void encodeField(MatchField mf, OfPacketWriter pkt)
PacketBuffer
to be advanced by the length of the field.mf
- the match field to encodepkt
- the buffer into which the match field is to be writtenpublic static void encodeFieldList(List<MatchField> fields, OfPacketWriter pkt)
PacketBuffer
to be advanced by the length of the written fields.fields
- the list of fieldspkt
- the buffer into which the fields are to be writtenpublic static void encodeFieldExperList(List<MFieldExperimenter> fields, OfPacketWriter pkt)
PacketBuffer
to be advanced by the length of the
written fields.fields
- the experimenter fieldspkt
- the buffer into which the fields are to be writtenCopyright © 2015. All Rights Reserved.