Class Instructions


  • public final class Instructions
    extends Object
    Factory class for creating various traffic treatment instructions.
    • 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
      • setQueue

        public static Instructions.SetQueueInstruction setQueue​(long queueId,
                                                                PortNumber port)
        Creates a set-queue instruction.
        Parameters:
        queueId - Queue Id
        port - 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​(org.onlab.packet.MacAddress addr)
        Creates a l2 src modification.
        Parameters:
        addr - the mac address to modify to
        Returns:
        a l2 modification
      • modL2Dst

        public static L2ModificationInstruction modL2Dst​(org.onlab.packet.MacAddress addr)
        Creates a L2 dst modification.
        Parameters:
        addr - the mac address to modify to
        Returns:
        a L2 modification
      • modVlanId

        public static L2ModificationInstruction modVlanId​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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 write
        metadataMask - 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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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​(org.onlab.packet.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