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