Class Instructions
- java.lang.Object
-
- org.onosproject.net.flow.instructions.Instructions
-
public final class Instructions extends Object
Factory class for creating various traffic treatment instructions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Instructions.ExtensionInstructionWrapper
Extension instruction.static class
Instructions.GroupInstruction
Group Instruction.static class
Instructions.MetadataInstruction
Metadata instruction.static class
Instructions.MeterInstruction
A meter instruction.static class
Instructions.NoActionInstruction
No Action instruction.static class
Instructions.OutputInstruction
Output Instruction.static class
Instructions.SetQueueInstruction
Set-Queue Instruction.static class
Instructions.StatTriggerInstruction
static class
Instructions.TableTypeTransition
Transition instruction.static class
Instructions.TruncateInstruction
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static L3ModificationInstruction
copyTtlIn()
Creates a L3 copy TTL to inner header modification.static L3ModificationInstruction
copyTtlOut()
Creates a L3 copy TTL to outer header modification.static Instructions.GroupInstruction
createGroup(GroupId groupId)
Creates a group instruction.static Instructions.NoActionInstruction
createNoAction()
Creates a no action instruction.static Instructions.OutputInstruction
createOutput(PortNumber number)
Creates an output instruction using the specified port number.static L2ModificationInstruction
decMplsTtl()
Creates a MPLS decrement TTL modification.static L3ModificationInstruction
decNwTtl()
Creates a L3 decrement TTL modification.static Instructions.ExtensionInstructionWrapper
extension(ExtensionTreatment extension, DeviceId deviceId)
Creates an extension instruction.static Instructions.MeterInstruction
meterTraffic(MeterId meterId)
Creates a meter instruction.static L3ModificationInstruction
modArpSha(MacAddress addr)
Creates a l3 ARP Ether src modification.static L3ModificationInstruction
modArpSpa(IpAddress addr)
Creates a L3 ARP IP src modification.static L3ModificationInstruction
modArpTha(MacAddress addr)
Creates a l3 ARP Ether src modification.static L3ModificationInstruction
modArpTpa(IpAddress addr)
Creates a L3 ARP IP src modification.static Instruction
modIpDscp(byte ipDscp)
Creates an IP DSCP modification.static L0ModificationInstruction
modL0Lambda(Lambda lambda)
Creates an L0 modification with the specified OCh signal.static L1ModificationInstruction
modL1OduSignalId(OduSignalId oduSignalId)
Creates an L1 modification with the specified ODU signal Id.static L2ModificationInstruction
modL2Dst(MacAddress addr)
Creates a L2 dst modification.static L2ModificationInstruction
modL2Src(MacAddress addr)
Creates a l2 src modification.static L3ModificationInstruction
modL3ArpOp(short op)
Creates a l3 ARP operation modification.static L3ModificationInstruction
modL3Dst(IpAddress addr)
Creates a L3 IPv4 dst modification.static L3ModificationInstruction
modL3IPv6Dst(IpAddress addr)
Creates a L3 IPv6 dst modification.static L3ModificationInstruction
modL3IPv6FlowLabel(int flowLabel)
Creates a L3 IPv6 Flow Label modification.static L3ModificationInstruction
modL3IPv6Src(IpAddress addr)
Creates a L3 IPv6 src modification.static L3ModificationInstruction
modL3Src(IpAddress addr)
Creates a L3 IPv4 src modification.static L2ModificationInstruction
modMplsBos(boolean mplsBos)
Creates a MPLS BOS bit modification.static L2ModificationInstruction
modMplsLabel(MplsLabel mplsLabel)
Creates a MPLS label modification.static L4ModificationInstruction
modTcpDst(TpPort port)
Creates a TCP dst modification.static L4ModificationInstruction
modTcpSrc(TpPort port)
Creates a TCP src modification.static L2ModificationInstruction
modTunnelId(long tunnelId)
Creates a Tunnel ID modification.static L4ModificationInstruction
modUdpDst(TpPort port)
Creates a UDP dst modification.static L4ModificationInstruction
modUdpSrc(TpPort port)
Creates a UDP src modification.static L2ModificationInstruction
modVlanId(VlanId vlanId)
Creates a VLAN ID modification.static L2ModificationInstruction
modVlanPcp(Byte vlanPcp)
Creates a VLAN PCP modification.static PiInstruction
piTableAction(PiTableAction piTableAction)
Creates a protocol independent instruction.static Instruction
popMpls()
Creates a pop MPLS header instruction.static Instruction
popMpls(EthType etherType)
Creates a pop MPLS header instruction with a particular ethertype.static Instruction
popVlan()
Creates a pop VLAN header instruction.static Instruction
pushMpls()
Creates a push MPLS header instruction.static Instruction
pushVlan()
Creates a push VLAN header instruction.static Instruction
pushVlan(EthType ethType)
Creates a push VLAN header instruction using the supplied Ethernet type.static Instructions.SetQueueInstruction
setQueue(long queueId, PortNumber port)
Creates a set-queue instruction.static Instructions.StatTriggerInstruction
statTrigger(Map<StatTriggerField,Long> statTriggerMap, StatTriggerFlag flag)
Creates a stat trigger instruction.static Instruction
transition(Integer tableId)
Sends the packet to the table id.static Instructions.TruncateInstruction
truncate(int maxLen)
Creates a truncate instruction.static Instruction
writeMetadata(long metadata, long metadataMask)
Writes metadata to associate with a packet.
-
-
-
Method Detail
-
createOutput
public static Instructions.OutputInstruction createOutput(PortNumber number)
Creates an output instruction using the specified port number. This can include logical ports such as CONTROLLER, FLOOD, etc.- Parameters:
number
- port number- Returns:
- output instruction
-
createNoAction
public static Instructions.NoActionInstruction createNoAction()
Creates a no action instruction.- Returns:
- no action instruction
-
createGroup
public static Instructions.GroupInstruction createGroup(GroupId groupId)
Creates a group instruction.- Parameters:
groupId
- Group Id- Returns:
- group instruction
-
setQueue
public static Instructions.SetQueueInstruction setQueue(long queueId, PortNumber port)
Creates a set-queue instruction.- Parameters:
queueId
- Queue Idport
- Port number- Returns:
- set-queue instruction
-
meterTraffic
public static Instructions.MeterInstruction meterTraffic(MeterId meterId)
Creates a meter instruction.- Parameters:
meterId
- Meter Id- Returns:
- meter instruction
-
modL0Lambda
public static L0ModificationInstruction modL0Lambda(Lambda lambda)
Creates an L0 modification with the specified OCh signal.- Parameters:
lambda
- OCh signal- Returns:
- an L0 modification
-
modL1OduSignalId
public static L1ModificationInstruction modL1OduSignalId(OduSignalId oduSignalId)
Creates an L1 modification with the specified ODU signal Id.- Parameters:
oduSignalId
- ODU Signal Id- Returns:
- a L1 modification
-
modL2Src
public static L2ModificationInstruction modL2Src(MacAddress addr)
Creates a l2 src modification.- Parameters:
addr
- the mac address to modify to- Returns:
- a l2 modification
-
modL2Dst
public static L2ModificationInstruction modL2Dst(MacAddress addr)
Creates a L2 dst modification.- Parameters:
addr
- the mac address to modify to- Returns:
- a L2 modification
-
modVlanId
public static L2ModificationInstruction modVlanId(VlanId vlanId)
Creates a VLAN ID modification.- Parameters:
vlanId
- the VLAN ID to modify to- Returns:
- a L2 modification
-
modVlanPcp
public static L2ModificationInstruction modVlanPcp(Byte vlanPcp)
Creates a VLAN PCP modification.- Parameters:
vlanPcp
- the PCP to modify to- Returns:
- a L2 modification
-
modMplsLabel
public static L2ModificationInstruction modMplsLabel(MplsLabel mplsLabel)
Creates a MPLS label modification.- Parameters:
mplsLabel
- MPLS label to set- Returns:
- a L2 Modification
-
modMplsBos
public static L2ModificationInstruction modMplsBos(boolean mplsBos)
Creates a MPLS BOS bit modification.- Parameters:
mplsBos
- MPLS BOS bit to set (true) or unset (false)- Returns:
- a L2 Modification
-
decMplsTtl
public static L2ModificationInstruction decMplsTtl()
Creates a MPLS decrement TTL modification.- Returns:
- a L2 Modification
-
modL3Src
public static L3ModificationInstruction modL3Src(IpAddress addr)
Creates a L3 IPv4 src modification.- Parameters:
addr
- the IPv4 address to modify to- Returns:
- a L3 modification
-
modL3Dst
public static L3ModificationInstruction modL3Dst(IpAddress addr)
Creates a L3 IPv4 dst modification.- Parameters:
addr
- the IPv4 address to modify to- Returns:
- a L3 modification
-
modL3IPv6Src
public static L3ModificationInstruction modL3IPv6Src(IpAddress addr)
Creates a L3 IPv6 src modification.- Parameters:
addr
- the IPv6 address to modify to- Returns:
- a L3 modification
-
modL3IPv6Dst
public static L3ModificationInstruction modL3IPv6Dst(IpAddress addr)
Creates a L3 IPv6 dst modification.- Parameters:
addr
- the IPv6 address to modify to- Returns:
- a L3 modification
-
modL3IPv6FlowLabel
public static L3ModificationInstruction modL3IPv6FlowLabel(int flowLabel)
Creates a L3 IPv6 Flow Label modification.- Parameters:
flowLabel
- the IPv6 flow label to modify to (20 bits)- Returns:
- a L3 modification
-
decNwTtl
public static L3ModificationInstruction decNwTtl()
Creates a L3 decrement TTL modification.- Returns:
- a L3 modification
-
copyTtlOut
public static L3ModificationInstruction copyTtlOut()
Creates a L3 copy TTL to outer header modification.- Returns:
- a L3 modification
-
copyTtlIn
public static L3ModificationInstruction copyTtlIn()
Creates a L3 copy TTL to inner header modification.- Returns:
- a L3 modification
-
modArpSpa
public static L3ModificationInstruction modArpSpa(IpAddress addr)
Creates a L3 ARP IP src modification.- Parameters:
addr
- the ip address to modify to- Returns:
- a L3 modification
-
modArpSha
public static L3ModificationInstruction modArpSha(MacAddress addr)
Creates a l3 ARP Ether src modification.- Parameters:
addr
- the mac address to modify to- Returns:
- a l3 modification
-
modArpTpa
public static L3ModificationInstruction modArpTpa(IpAddress addr)
Creates a L3 ARP IP src modification.- Parameters:
addr
- the ip address to modify to- Returns:
- a L3 modification
-
modArpTha
public static L3ModificationInstruction modArpTha(MacAddress addr)
Creates a l3 ARP Ether src modification.- Parameters:
addr
- the mac address to modify to- Returns:
- a l3 modification
-
modL3ArpOp
public static L3ModificationInstruction modL3ArpOp(short op)
Creates a l3 ARP operation modification.- Parameters:
op
- the ARP operation to modify to- Returns:
- a l3 modification
-
pushMpls
public static Instruction pushMpls()
Creates a push MPLS header instruction.- Returns:
- a L2 modification.
-
popMpls
public static Instruction popMpls()
Creates a pop MPLS header instruction.- Returns:
- a L2 modification.
-
popMpls
public static Instruction popMpls(EthType etherType)
Creates a pop MPLS header instruction with a particular ethertype.- Parameters:
etherType
- Ethernet type to set- Returns:
- a L2 modification.
-
popVlan
public static Instruction popVlan()
Creates a pop VLAN header instruction.- Returns:
- a L2 modification
-
pushVlan
public static Instruction pushVlan()
Creates a push VLAN header instruction.- Returns:
- a L2 modification
-
pushVlan
public static Instruction pushVlan(EthType ethType)
Creates a push VLAN header instruction using the supplied Ethernet type.- Parameters:
ethType
- the Ethernet type to use- Returns:
- a L2 modification
-
transition
public static Instruction transition(Integer tableId)
Sends the packet to the table id.- Parameters:
tableId
- flow rule table id- Returns:
- table type transition instruction
-
writeMetadata
public static Instruction writeMetadata(long metadata, long metadataMask)
Writes metadata to associate with a packet.- Parameters:
metadata
- the metadata value to writemetadataMask
- the bits to mask for the metadata value- Returns:
- metadata instruction
-
modTunnelId
public static L2ModificationInstruction modTunnelId(long tunnelId)
Creates a Tunnel ID modification.- Parameters:
tunnelId
- the Tunnel ID to modify to- Returns:
- a L2 modification
-
modTcpSrc
public static L4ModificationInstruction modTcpSrc(TpPort port)
Creates a TCP src modification.- Parameters:
port
- the TCP port number to modify to- Returns:
- a L4 modification
-
modTcpDst
public static L4ModificationInstruction modTcpDst(TpPort port)
Creates a TCP dst modification.- Parameters:
port
- the TCP port number to modify to- Returns:
- a L4 modification
-
modUdpSrc
public static L4ModificationInstruction modUdpSrc(TpPort port)
Creates a UDP src modification.- Parameters:
port
- the UDP port number to modify to- Returns:
- a L4 modification
-
modUdpDst
public static L4ModificationInstruction modUdpDst(TpPort port)
Creates a UDP dst modification.- Parameters:
port
- the UDP port number to modify to- Returns:
- a L4 modification
-
piTableAction
public static PiInstruction piTableAction(PiTableAction piTableAction)
Creates a protocol independent instruction.- Parameters:
piTableAction
- protocol independent instruction- Returns:
- extension instruction
-
modIpDscp
public static Instruction modIpDscp(byte ipDscp)
Creates an IP DSCP modification.- Parameters:
ipDscp
- the DSCP value to modify to- Returns:
- a L3 modification
-
extension
public static Instructions.ExtensionInstructionWrapper extension(ExtensionTreatment extension, DeviceId deviceId)
Creates an extension instruction.- Parameters:
extension
- extension instructiondeviceId
- device ID- Returns:
- extension instruction
-
statTrigger
public static Instructions.StatTriggerInstruction statTrigger(Map<StatTriggerField,Long> statTriggerMap, StatTriggerFlag flag)
Creates a stat trigger instruction.- Parameters:
statTriggerMap
- map keeps stat trigger thresholdflag
- stat trigger flag- Returns:
- stat trigger instruction
-
truncate
public static Instructions.TruncateInstruction truncate(int maxLen)
Creates a truncate instruction.- Parameters:
maxLen
- the maximum frame length in bytes, must be a positive integer- Returns:
- truncate instruction
-
-