Package org.onosproject.net.flow
Class DefaultTrafficTreatment.Builder
- java.lang.Object
-
- org.onosproject.net.flow.DefaultTrafficTreatment.Builder
-
- All Implemented Interfaces:
TrafficTreatment.Builder
- Enclosing class:
- DefaultTrafficTreatment
public static final class DefaultTrafficTreatment.Builder extends java.lang.Object implements TrafficTreatment.Builder
Builds a list of treatments following the following order. Modifications -> Group -> Output (including drop)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultTrafficTreatment.Builder
add(Instruction instruction)
Adds an instruction to the builder.TrafficTreatment.Builder
addTreatment(TrafficTreatment treatment)
Add all instructions from another treatment.TrafficTreatment
build()
Builds an immutable traffic treatment descriptor.DefaultTrafficTreatment.Builder
copyTtlIn()
Copy the TTL to inner protocol layer.DefaultTrafficTreatment.Builder
copyTtlOut()
Copy the TTL to outer protocol layer.DefaultTrafficTreatment.Builder
decMplsTtl()
Decrement MPLS TTL.DefaultTrafficTreatment.Builder
decNwTtl()
Decrement the TTL in IP header by one.DefaultTrafficTreatment.Builder
deferred()
Any instructions followed by this method call will be deferred.DefaultTrafficTreatment.Builder
drop()
Add a NOACTION when DROP instruction is explicitly specified.TrafficTreatment.Builder
extension(ExtensionTreatment extension, DeviceId deviceId)
Uses an extension treatment.DefaultTrafficTreatment.Builder
group(GroupId groupId)
Sets the group ID.DefaultTrafficTreatment.Builder
immediate()
Any instructions followed by this method call will be immediate.TrafficTreatment.Builder
meter(MeterId meterId)
Sets a meter to be used by this flow.DefaultTrafficTreatment.Builder
notWipeDeferred()
the instruction to clear not wipe the deferred instructions set.DefaultTrafficTreatment.Builder
piTableAction(PiTableAction piTableAction)
Sets the protocol independent table action.DefaultTrafficTreatment.Builder
popMpls()
Pops MPLS ether type.DefaultTrafficTreatment.Builder
popMpls(EthType etherType)
Pops MPLS ether type and set the new ethertype.DefaultTrafficTreatment.Builder
popVlan()
Pops outermost VLAN tag.DefaultTrafficTreatment.Builder
punt()
Adds a punt-to-controller instruction.DefaultTrafficTreatment.Builder
pushMpls()
Push MPLS ether type.DefaultTrafficTreatment.Builder
pushVlan()
Pushes a new VLAN tag.DefaultTrafficTreatment.Builder
pushVlan(EthType ethType)
Pushes a new VLAN tag using the supplied Ethernet type.DefaultTrafficTreatment.Builder
setArpOp(short op)
Sets the arp operation.DefaultTrafficTreatment.Builder
setArpSha(MacAddress addr)
Sets the arp src mac address.DefaultTrafficTreatment.Builder
setArpSpa(IpAddress addr)
Sets the arp src ip address.DefaultTrafficTreatment.Builder
setEthDst(MacAddress addr)
Sets the dst l2 address.DefaultTrafficTreatment.Builder
setEthSrc(MacAddress addr)
Sets the src l2 address.TrafficTreatment.Builder
setIpDscp(byte dscpValue)
Sets the IP DSCP field.DefaultTrafficTreatment.Builder
setIpDst(IpAddress addr)
Sets the dst l3 address.DefaultTrafficTreatment.Builder
setIpSrc(IpAddress addr)
Sets the src l3 address.DefaultTrafficTreatment.Builder
setMpls(MplsLabel mplsLabel)
Sets the mpls label.DefaultTrafficTreatment.Builder
setMplsBos(boolean mplsBos)
Sets the mpls bottom-of-stack indicator bit.DefaultTrafficTreatment.Builder
setOutput(PortNumber number)
Set the output port.DefaultTrafficTreatment.Builder
setQueue(long queueId)
Sets the Queue ID.DefaultTrafficTreatment.Builder
setQueue(long queueId, PortNumber port)
Sets the Queue ID for a specific port.TrafficTreatment.Builder
setTcpDst(TpPort port)
Sets the dst TCP port.TrafficTreatment.Builder
setTcpSrc(TpPort port)
Sets the src TCP port.DefaultTrafficTreatment.Builder
setTunnelId(long tunnelId)
Sets the tunnel id.TrafficTreatment.Builder
setUdpDst(TpPort port)
Sets the dst UDP port.TrafficTreatment.Builder
setUdpSrc(TpPort port)
Sets the src UDP port.DefaultTrafficTreatment.Builder
setVlanId(VlanId id)
Sets the vlan id.DefaultTrafficTreatment.Builder
setVlanPcp(java.lang.Byte pcp)
Sets the vlan priority.TrafficTreatment.Builder
statTrigger(java.util.Map<StatTriggerField,java.lang.Long> statTriggerFieldMap, StatTriggerFlag statTriggerFlag)
Add stat trigger instruction.DefaultTrafficTreatment.Builder
transition(java.lang.Integer tableId)
Sets the next table id to transition to.DefaultTrafficTreatment.Builder
wipeDeferred()
Instructs the device to clear the deferred instructions set.DefaultTrafficTreatment.Builder
writeMetadata(long metadata, long metadataMask)
Writes metadata to associate with a packet.
-
-
-
Method Detail
-
add
public DefaultTrafficTreatment.Builder add(Instruction instruction)
Description copied from interface:TrafficTreatment.Builder
Adds an instruction to the builder.- Specified by:
add
in interfaceTrafficTreatment.Builder
- Parameters:
instruction
- an instruction- Returns:
- a treatment builder
-
drop
public DefaultTrafficTreatment.Builder drop()
Add a NOACTION when DROP instruction is explicitly specified.- Specified by:
drop
in interfaceTrafficTreatment.Builder
- Returns:
- the traffic treatment builder
-
punt
public DefaultTrafficTreatment.Builder punt()
Description copied from interface:TrafficTreatment.Builder
Adds a punt-to-controller instruction.- Specified by:
punt
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
setOutput
public DefaultTrafficTreatment.Builder setOutput(PortNumber number)
Description copied from interface:TrafficTreatment.Builder
Set the output port.- Specified by:
setOutput
in interfaceTrafficTreatment.Builder
- Parameters:
number
- the out port- Returns:
- a treatment builder
-
setEthSrc
public DefaultTrafficTreatment.Builder setEthSrc(MacAddress addr)
Description copied from interface:TrafficTreatment.Builder
Sets the src l2 address.- Specified by:
setEthSrc
in interfaceTrafficTreatment.Builder
- Parameters:
addr
- a macaddress- Returns:
- a treatment builder
-
setEthDst
public DefaultTrafficTreatment.Builder setEthDst(MacAddress addr)
Description copied from interface:TrafficTreatment.Builder
Sets the dst l2 address.- Specified by:
setEthDst
in interfaceTrafficTreatment.Builder
- Parameters:
addr
- a macaddress- Returns:
- a treatment builder
-
setVlanId
public DefaultTrafficTreatment.Builder setVlanId(VlanId id)
Description copied from interface:TrafficTreatment.Builder
Sets the vlan id.- Specified by:
setVlanId
in interfaceTrafficTreatment.Builder
- Parameters:
id
- a vlanid- Returns:
- a treatment builder
-
setVlanPcp
public DefaultTrafficTreatment.Builder setVlanPcp(java.lang.Byte pcp)
Description copied from interface:TrafficTreatment.Builder
Sets the vlan priority.- Specified by:
setVlanPcp
in interfaceTrafficTreatment.Builder
- Parameters:
pcp
- a vlan priority- Returns:
- a treatment builder
-
setIpSrc
public DefaultTrafficTreatment.Builder setIpSrc(IpAddress addr)
Description copied from interface:TrafficTreatment.Builder
Sets the src l3 address.- Specified by:
setIpSrc
in interfaceTrafficTreatment.Builder
- Parameters:
addr
- an ip- Returns:
- a treatment builder
-
setIpDst
public DefaultTrafficTreatment.Builder setIpDst(IpAddress addr)
Description copied from interface:TrafficTreatment.Builder
Sets the dst l3 address.- Specified by:
setIpDst
in interfaceTrafficTreatment.Builder
- Parameters:
addr
- an ip- Returns:
- a treatment builder
-
decNwTtl
public DefaultTrafficTreatment.Builder decNwTtl()
Description copied from interface:TrafficTreatment.Builder
Decrement the TTL in IP header by one.- Specified by:
decNwTtl
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
copyTtlIn
public DefaultTrafficTreatment.Builder copyTtlIn()
Description copied from interface:TrafficTreatment.Builder
Copy the TTL to inner protocol layer.- Specified by:
copyTtlIn
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
copyTtlOut
public DefaultTrafficTreatment.Builder copyTtlOut()
Description copied from interface:TrafficTreatment.Builder
Copy the TTL to outer protocol layer.- Specified by:
copyTtlOut
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
pushMpls
public DefaultTrafficTreatment.Builder pushMpls()
Description copied from interface:TrafficTreatment.Builder
Push MPLS ether type.- Specified by:
pushMpls
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
popMpls
public DefaultTrafficTreatment.Builder popMpls()
Description copied from interface:TrafficTreatment.Builder
Pops MPLS ether type.- Specified by:
popMpls
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
popMpls
public DefaultTrafficTreatment.Builder popMpls(EthType etherType)
Description copied from interface:TrafficTreatment.Builder
Pops MPLS ether type and set the new ethertype.- Specified by:
popMpls
in interfaceTrafficTreatment.Builder
- Parameters:
etherType
- an ether type- Returns:
- a treatment builder
-
setMpls
public DefaultTrafficTreatment.Builder setMpls(MplsLabel mplsLabel)
Description copied from interface:TrafficTreatment.Builder
Sets the mpls label.- Specified by:
setMpls
in interfaceTrafficTreatment.Builder
- Parameters:
mplsLabel
- MPLS label- Returns:
- a treatment builder
-
setMplsBos
public DefaultTrafficTreatment.Builder setMplsBos(boolean mplsBos)
Description copied from interface:TrafficTreatment.Builder
Sets the mpls bottom-of-stack indicator bit.- Specified by:
setMplsBos
in interfaceTrafficTreatment.Builder
- Parameters:
mplsBos
- boolean to set BOS=1 (true) or BOS=0 (false)- Returns:
- a treatment builder.
-
decMplsTtl
public DefaultTrafficTreatment.Builder decMplsTtl()
Description copied from interface:TrafficTreatment.Builder
Decrement MPLS TTL.- Specified by:
decMplsTtl
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
group
public DefaultTrafficTreatment.Builder group(GroupId groupId)
Description copied from interface:TrafficTreatment.Builder
Sets the group ID.- Specified by:
group
in interfaceTrafficTreatment.Builder
- Parameters:
groupId
- group ID- Returns:
- a treatment builder
-
setQueue
public DefaultTrafficTreatment.Builder setQueue(long queueId)
Description copied from interface:TrafficTreatment.Builder
Sets the Queue ID.- Specified by:
setQueue
in interfaceTrafficTreatment.Builder
- Parameters:
queueId
- a queue ID- Returns:
- a treatment builder
-
setQueue
public DefaultTrafficTreatment.Builder setQueue(long queueId, PortNumber port)
Description copied from interface:TrafficTreatment.Builder
Sets the Queue ID for a specific port.- Specified by:
setQueue
in interfaceTrafficTreatment.Builder
- Parameters:
queueId
- a queue IDport
- a port number- Returns:
- a treatment builder
-
meter
public TrafficTreatment.Builder meter(MeterId meterId)
Description copied from interface:TrafficTreatment.Builder
Sets a meter to be used by this flow.- Specified by:
meter
in interfaceTrafficTreatment.Builder
- Parameters:
meterId
- a meter id- Returns:
- a treatment builder
-
popVlan
public DefaultTrafficTreatment.Builder popVlan()
Description copied from interface:TrafficTreatment.Builder
Pops outermost VLAN tag.- Specified by:
popVlan
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
pushVlan
public DefaultTrafficTreatment.Builder pushVlan()
Description copied from interface:TrafficTreatment.Builder
Pushes a new VLAN tag.- Specified by:
pushVlan
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
pushVlan
public DefaultTrafficTreatment.Builder pushVlan(EthType ethType)
Description copied from interface:TrafficTreatment.Builder
Pushes a new VLAN tag using the supplied Ethernet type.- Specified by:
pushVlan
in interfaceTrafficTreatment.Builder
- Parameters:
ethType
- ethernet type- Returns:
- a treatment builder
-
transition
public DefaultTrafficTreatment.Builder transition(java.lang.Integer tableId)
Description copied from interface:TrafficTreatment.Builder
Sets the next table id to transition to.- Specified by:
transition
in interfaceTrafficTreatment.Builder
- Parameters:
tableId
- the table table- Returns:
- a treatement builder
-
immediate
public DefaultTrafficTreatment.Builder immediate()
Description copied from interface:TrafficTreatment.Builder
Any instructions followed by this method call will be immediate.- Specified by:
immediate
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
deferred
public DefaultTrafficTreatment.Builder deferred()
Description copied from interface:TrafficTreatment.Builder
Any instructions followed by this method call will be deferred.- Specified by:
deferred
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
wipeDeferred
public DefaultTrafficTreatment.Builder wipeDeferred()
Description copied from interface:TrafficTreatment.Builder
Instructs the device to clear the deferred instructions set.- Specified by:
wipeDeferred
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
notWipeDeferred
public DefaultTrafficTreatment.Builder notWipeDeferred()
Description copied from interface:TrafficTreatment.Builder
the instruction to clear not wipe the deferred instructions set.- Specified by:
notWipeDeferred
in interfaceTrafficTreatment.Builder
- Returns:
- a treatment builder
-
writeMetadata
public DefaultTrafficTreatment.Builder writeMetadata(long metadata, long metadataMask)
Description copied from interface:TrafficTreatment.Builder
Writes metadata to associate with a packet.new_metadata = (old_metadata & ̃mask) | (value & mask)
- Specified by:
writeMetadata
in interfaceTrafficTreatment.Builder
- Parameters:
metadata
- the metadata to writemetadataMask
- the masked bits for the value- Returns:
- a treatment builder
-
setTunnelId
public DefaultTrafficTreatment.Builder setTunnelId(long tunnelId)
Description copied from interface:TrafficTreatment.Builder
Sets the tunnel id.- Specified by:
setTunnelId
in interfaceTrafficTreatment.Builder
- Parameters:
tunnelId
- a tunnel id- Returns:
- a treatment builder
-
setTcpSrc
public TrafficTreatment.Builder setTcpSrc(TpPort port)
Description copied from interface:TrafficTreatment.Builder
Sets the src TCP port.- Specified by:
setTcpSrc
in interfaceTrafficTreatment.Builder
- Parameters:
port
- a port number- Returns:
- a treatment builder
-
setTcpDst
public TrafficTreatment.Builder setTcpDst(TpPort port)
Description copied from interface:TrafficTreatment.Builder
Sets the dst TCP port.- Specified by:
setTcpDst
in interfaceTrafficTreatment.Builder
- Parameters:
port
- a port number- Returns:
- a treatment builder
-
setUdpSrc
public TrafficTreatment.Builder setUdpSrc(TpPort port)
Description copied from interface:TrafficTreatment.Builder
Sets the src UDP port.- Specified by:
setUdpSrc
in interfaceTrafficTreatment.Builder
- Parameters:
port
- a port number- Returns:
- a treatment builder
-
setUdpDst
public TrafficTreatment.Builder setUdpDst(TpPort port)
Description copied from interface:TrafficTreatment.Builder
Sets the dst UDP port.- Specified by:
setUdpDst
in interfaceTrafficTreatment.Builder
- Parameters:
port
- a port number- Returns:
- a treatment builder
-
setArpSpa
public DefaultTrafficTreatment.Builder setArpSpa(IpAddress addr)
Description copied from interface:TrafficTreatment.Builder
Sets the arp src ip address.- Specified by:
setArpSpa
in interfaceTrafficTreatment.Builder
- Parameters:
addr
- an ip- Returns:
- a treatment builder
-
setArpSha
public DefaultTrafficTreatment.Builder setArpSha(MacAddress addr)
Description copied from interface:TrafficTreatment.Builder
Sets the arp src mac address.- Specified by:
setArpSha
in interfaceTrafficTreatment.Builder
- Parameters:
addr
- a macaddress- Returns:
- a treatment builder
-
setArpOp
public DefaultTrafficTreatment.Builder setArpOp(short op)
Description copied from interface:TrafficTreatment.Builder
Sets the arp operation.- Specified by:
setArpOp
in interfaceTrafficTreatment.Builder
- Parameters:
op
- the value of arp operation.- Returns:
- a treatment builder.
-
piTableAction
public DefaultTrafficTreatment.Builder piTableAction(PiTableAction piTableAction)
Description copied from interface:TrafficTreatment.Builder
Sets the protocol independent table action.- Specified by:
piTableAction
in interfaceTrafficTreatment.Builder
- Parameters:
piTableAction
- protocol-independent table action- Returns:
- a treatment builder.
-
setIpDscp
public TrafficTreatment.Builder setIpDscp(byte dscpValue)
Description copied from interface:TrafficTreatment.Builder
Sets the IP DSCP field.- Specified by:
setIpDscp
in interfaceTrafficTreatment.Builder
- Parameters:
dscpValue
- the DSCP value- Returns:
- a treatment builder.
-
extension
public TrafficTreatment.Builder extension(ExtensionTreatment extension, DeviceId deviceId)
Description copied from interface:TrafficTreatment.Builder
Uses an extension treatment.- Specified by:
extension
in interfaceTrafficTreatment.Builder
- Parameters:
extension
- extension treatmentdeviceId
- device ID- Returns:
- a treatment builder
-
statTrigger
public TrafficTreatment.Builder statTrigger(java.util.Map<StatTriggerField,java.lang.Long> statTriggerFieldMap, StatTriggerFlag statTriggerFlag)
Description copied from interface:TrafficTreatment.Builder
Add stat trigger instruction.- Specified by:
statTrigger
in interfaceTrafficTreatment.Builder
- Parameters:
statTriggerFieldMap
- defines stat trigger constraintsstatTriggerFlag
- describes which circumstances that start will be triggered- Returns:
- a treatment builder
-
addTreatment
public TrafficTreatment.Builder addTreatment(TrafficTreatment treatment)
Description copied from interface:TrafficTreatment.Builder
Add all instructions from another treatment.- Specified by:
addTreatment
in interfaceTrafficTreatment.Builder
- Parameters:
treatment
- another treatment- Returns:
- a treatment builder
-
build
public TrafficTreatment build()
Description copied from interface:TrafficTreatment.Builder
Builds an immutable traffic treatment descriptor.If the treatment is empty when build() is called, it will add a default drop rule automatically. For a treatment that is actually empty, use
DefaultTrafficTreatment.emptyTreatment()
.- Specified by:
build
in interfaceTrafficTreatment.Builder
- Returns:
- traffic treatment
-
-