Class Ofdpa2Pipeline

  • All Implemented Interfaces:
    org.onosproject.net.behaviour.Pipeliner, org.onosproject.net.driver.Behaviour, org.onosproject.net.driver.HandlerBehaviour
    Direct Known Subclasses:
    Ofdpa3Pipeline, OvsOfdpaPipeline

    public class Ofdpa2Pipeline
    extends org.onosproject.net.driver.AbstractHandlerBehaviour
    implements org.onosproject.net.behaviour.Pipeliner
    Driver for Broadcom's OF-DPA v2.0 TTP.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  Ofdpa2Pipeline.RetryFlows
      Utility class that retries sending flows a fixed number of times, even if some of the attempts are successful.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.onlab.util.KryoNamespace appKryo  
      protected org.onosproject.core.CoreService coreService  
      protected org.onosproject.net.DeviceId deviceId  
      protected org.onosproject.net.device.DeviceService deviceService  
      protected org.onosproject.core.ApplicationId driverId  
      protected org.onosproject.net.flowobjective.FlowObjectiveStore flowObjectiveStore  
      protected org.onosproject.net.flow.FlowRuleService flowRuleService  
      protected Ofdpa2GroupHandler groupHandler  
      protected org.onosproject.net.group.GroupService groupService  
      protected java.util.concurrent.atomic.AtomicBoolean ready  
      protected org.onlab.osgi.ServiceDirectory serviceDirectory  
      • Fields inherited from interface org.onosproject.net.behaviour.Pipeliner

        ACCUMULATOR_ENABLED
    • Constructor Summary

      Constructors 
      Constructor Description
      Ofdpa2Pipeline()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanUp()  
      void filter​(org.onosproject.net.flowobjective.FilteringObjective filteringObjective)  
      void forward​(org.onosproject.net.flowobjective.ForwardingObjective fwd)  
      java.util.List<java.lang.String> getNextMappings​(org.onosproject.net.behaviour.NextGroup nextGroup)  
      void init​(org.onosproject.net.DeviceId deviceId, org.onosproject.net.behaviour.PipelinerContext context)  
      protected void initDriverId()  
      protected void initGroupHander​(org.onosproject.net.behaviour.PipelinerContext context)  
      protected void initializePipeline()  
      boolean isReady()  
      protected boolean matchInPortTmacTable()
      Determines whether in-port should be matched on in TMAC table rules.
      void next​(org.onosproject.net.flowobjective.NextObjective nextObjective)  
      protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEgress​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
      In the OF-DPA 2.0 pipeline, egress forwarding objectives go to the egress tables.
      protected java.util.List<java.util.List<org.onosproject.net.flow.FlowRule>> processEthDstFilter​(org.onosproject.net.flow.criteria.PortCriterion portCriterion, org.onosproject.net.flow.criteria.EthCriterion ethCriterion, org.onosproject.net.flow.criteria.VlanIdCriterion vidCriterion, org.onlab.packet.VlanId assignedVlan, org.onlab.packet.MacAddress unicastMac, org.onosproject.core.ApplicationId applicationId)
      Allows routed packets with correct destination MAC to be directed to unicast routing table, multicast routing table or MPLS forwarding table.
      protected java.util.List<java.util.List<org.onosproject.net.flow.FlowRule>> processEthDstOnlyFilter​(org.onosproject.net.flow.criteria.EthCriterion ethCriterion, org.onosproject.core.ApplicationId applicationId)  
      protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEthDstSpecific​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
      Handles forwarding rules to the L2 bridging table.
      protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEthTypeSpecific​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
      Handles forwarding rules to the IP and MPLS tables.
      protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEthTypeSpecificInternal​(org.onosproject.net.flowobjective.ForwardingObjective fwd, boolean allowDefaultRoute, int mplsNextTable)
      Internal implementation of processEthTypeSpecific.
      protected void processFilter​(org.onosproject.net.flowobjective.FilteringObjective filt, boolean install, org.onosproject.core.ApplicationId applicationId)
      As per OFDPA 2.0 TTP, filtering of VLAN ids and MAC addresses (for routing) configured on switch ports happen in different tables.
      protected java.util.Collection<org.onosproject.net.flow.FlowRule> processVersatile​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
      In the OF-DPA 2.0 pipeline, versatile forwarding objectives go to the ACL table.
      protected java.util.List<java.util.List<org.onosproject.net.flow.FlowRule>> processVlanIdFilter​(org.onosproject.net.flow.criteria.PortCriterion portCriterion, org.onosproject.net.flow.criteria.VlanIdCriterion vidCriterion, org.onlab.packet.VlanId assignedVlan, org.onosproject.core.ApplicationId applicationId, boolean install)
      Internal implementation of processVlanIdFilter.
      protected boolean requireEthType()
      Determines whether this pipeline requires one additional flow matching on ethType 0x86dd in ACL table.
      boolean requireMplsBosMatch()
      Determines whether this pipeline requires MPLS BOS match.
      boolean requireMplsPop()
      Determines whether this pipeline requires MPLS POP instruction.
      boolean requireMplsTtlModification()
      Determines whether this pipeline requires MPLS TTL decrement and copy.
      protected boolean requirePuntTable()  
      protected boolean requireUnicastBeforeMulticast()
      Determines whether this driver requires unicast flow to be installed before multicast flow in TMAC table.
      protected boolean requireVlanExtensions()
      Determines whether this pipeline requires OFDPA match and set VLAN extensions.
      protected boolean shouldRetry()
      Determines whether this driver should continue to retry flows that point to empty groups.
      protected boolean supportIpv6L4Dst()
      Determines whether matching L4 destination port on IPv6 packets is supported in ACL table.
      protected boolean supportsUnicastBlackHole()
      Determines whether this driver supports installing a clearDeferred action on table 30.
      protected org.onosproject.net.flow.TrafficTreatment.Builder versatileTreatmentBuilder​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
      Helper function to create traffic treatment builder for versatile forwarding objectives.
      • Methods inherited from class org.onosproject.net.driver.AbstractHandlerBehaviour

        handler, setHandler
      • Methods inherited from class org.onosproject.net.driver.AbstractBehaviour

        data, setData
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.onosproject.net.driver.Behaviour

        data, setData
      • Methods inherited from interface org.onosproject.net.driver.HandlerBehaviour

        handler, setHandler
    • Field Detail

      • serviceDirectory

        protected org.onlab.osgi.ServiceDirectory serviceDirectory
      • flowRuleService

        protected org.onosproject.net.flow.FlowRuleService flowRuleService
      • coreService

        protected org.onosproject.core.CoreService coreService
      • groupService

        protected org.onosproject.net.group.GroupService groupService
      • flowObjectiveStore

        protected org.onosproject.net.flowobjective.FlowObjectiveStore flowObjectiveStore
      • deviceId

        protected org.onosproject.net.DeviceId deviceId
      • driverId

        protected org.onosproject.core.ApplicationId driverId
      • deviceService

        protected org.onosproject.net.device.DeviceService deviceService
      • appKryo

        protected static org.onlab.util.KryoNamespace appKryo
      • ready

        protected java.util.concurrent.atomic.AtomicBoolean ready
    • Constructor Detail

      • Ofdpa2Pipeline

        public Ofdpa2Pipeline()
    • Method Detail

      • init

        public void init​(org.onosproject.net.DeviceId deviceId,
                         org.onosproject.net.behaviour.PipelinerContext context)
        Specified by:
        init in interface org.onosproject.net.behaviour.Pipeliner
      • isReady

        public boolean isReady()
        Specified by:
        isReady in interface org.onosproject.net.behaviour.Pipeliner
      • cleanUp

        public void cleanUp()
        Specified by:
        cleanUp in interface org.onosproject.net.behaviour.Pipeliner
      • initDriverId

        protected void initDriverId()
      • initGroupHander

        protected void initGroupHander​(org.onosproject.net.behaviour.PipelinerContext context)
      • initializePipeline

        protected void initializePipeline()
      • requireMplsPop

        public boolean requireMplsPop()
        Determines whether this pipeline requires MPLS POP instruction.
        Returns:
        true to use MPLS POP instruction
      • requireEthType

        protected boolean requireEthType()
        Determines whether this pipeline requires one additional flow matching on ethType 0x86dd in ACL table.
        Returns:
        true to create one additional flow matching on ethType 0x86dd in ACL table
      • requireMplsBosMatch

        public boolean requireMplsBosMatch()
        Determines whether this pipeline requires MPLS BOS match.
        Returns:
        true to use MPLS BOS match
      • requireMplsTtlModification

        public boolean requireMplsTtlModification()
        Determines whether this pipeline requires MPLS TTL decrement and copy.
        Returns:
        true to use MPLS TTL decrement and copy
      • requireVlanExtensions

        protected boolean requireVlanExtensions()
        Determines whether this pipeline requires OFDPA match and set VLAN extensions.
        Returns:
        true to use the extensions
      • matchInPortTmacTable

        protected boolean matchInPortTmacTable()
        Determines whether in-port should be matched on in TMAC table rules.
        Returns:
        true if match on in-port should be programmed
      • supportIpv6L4Dst

        protected boolean supportIpv6L4Dst()
        Determines whether matching L4 destination port on IPv6 packets is supported in ACL table.
        Returns:
        true if matching L4 destination port on IPv6 packets is supported in ACL table.
      • shouldRetry

        protected boolean shouldRetry()
        Determines whether this driver should continue to retry flows that point to empty groups. See CORD-554.
        Returns:
        true if the driver should retry flows
      • requireUnicastBeforeMulticast

        protected boolean requireUnicastBeforeMulticast()
        Determines whether this driver requires unicast flow to be installed before multicast flow in TMAC table.
        Returns:
        true if required
      • supportsUnicastBlackHole

        protected boolean supportsUnicastBlackHole()
        Determines whether this driver supports installing a clearDeferred action on table 30.
        Returns:
        true if required
      • requirePuntTable

        protected boolean requirePuntTable()
      • filter

        public void filter​(org.onosproject.net.flowobjective.FilteringObjective filteringObjective)
        Specified by:
        filter in interface org.onosproject.net.behaviour.Pipeliner
      • forward

        public void forward​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
        Specified by:
        forward in interface org.onosproject.net.behaviour.Pipeliner
      • next

        public void next​(org.onosproject.net.flowobjective.NextObjective nextObjective)
        Specified by:
        next in interface org.onosproject.net.behaviour.Pipeliner
      • processFilter

        protected void processFilter​(org.onosproject.net.flowobjective.FilteringObjective filt,
                                     boolean install,
                                     org.onosproject.core.ApplicationId applicationId)
        As per OFDPA 2.0 TTP, filtering of VLAN ids and MAC addresses (for routing) configured on switch ports happen in different tables.
        Parameters:
        filt - the filtering objective
        install - indicates whether to add or remove the objective
        applicationId - the application that sent this objective
      • processVlanIdFilter

        protected java.util.List<java.util.List<org.onosproject.net.flow.FlowRule>> processVlanIdFilter​(org.onosproject.net.flow.criteria.PortCriterion portCriterion,
                                                                                                        org.onosproject.net.flow.criteria.VlanIdCriterion vidCriterion,
                                                                                                        org.onlab.packet.VlanId assignedVlan,
                                                                                                        org.onosproject.core.ApplicationId applicationId,
                                                                                                        boolean install)
        Internal implementation of processVlanIdFilter.

        The is_present bit in set_vlan_vid action is required to be 0 in OFDPA i12. Since it is non-OF spec, we need an extension treatment for that. The useVlanExtension must be set to false for OFDPA i12.

        NOTE: Separate VLAN filtering rules and assignment rules into different stages in order to guarantee that filtering rules always go first, as required by OFDPA.

        Parameters:
        portCriterion - port on device for which this filter is programmed
        vidCriterion - vlan assigned to port, or NONE for untagged
        assignedVlan - assigned vlan-id for untagged packets
        applicationId - for application programming this filter
        install - indicates whether to add or remove the objective
        Returns:
        stages of flow rules for port-vlan filters
      • processEthDstFilter

        protected java.util.List<java.util.List<org.onosproject.net.flow.FlowRule>> processEthDstFilter​(org.onosproject.net.flow.criteria.PortCriterion portCriterion,
                                                                                                        org.onosproject.net.flow.criteria.EthCriterion ethCriterion,
                                                                                                        org.onosproject.net.flow.criteria.VlanIdCriterion vidCriterion,
                                                                                                        org.onlab.packet.VlanId assignedVlan,
                                                                                                        org.onlab.packet.MacAddress unicastMac,
                                                                                                        org.onosproject.core.ApplicationId applicationId)
        Allows routed packets with correct destination MAC to be directed to unicast routing table, multicast routing table or MPLS forwarding table.
        Parameters:
        portCriterion - port on device for which this filter is programmed
        ethCriterion - dstMac of device for which is filter is programmed
        vidCriterion - vlan assigned to port, or NONE for untagged
        assignedVlan - assigned vlan-id for untagged packets
        unicastMac - some switches require a unicast TMAC flow to be programmed before multicast TMAC flow. This MAC address will be used for the unicast TMAC flow. This is unused if the filtering objective is a unicast.
        applicationId - for application programming this filter
        Returns:
        stages of flow rules for port-vlan filters
      • processEthDstOnlyFilter

        protected java.util.List<java.util.List<org.onosproject.net.flow.FlowRule>> processEthDstOnlyFilter​(org.onosproject.net.flow.criteria.EthCriterion ethCriterion,
                                                                                                            org.onosproject.core.ApplicationId applicationId)
      • processEgress

        protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEgress​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
        In the OF-DPA 2.0 pipeline, egress forwarding objectives go to the egress tables.
        Parameters:
        fwd - the forwarding objective of type 'egress'
        Returns:
        a collection of flow rules to be sent to the switch. An empty collection may be returned if there is a problem in processing the flow rule
      • processVersatile

        protected java.util.Collection<org.onosproject.net.flow.FlowRule> processVersatile​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
        In the OF-DPA 2.0 pipeline, versatile forwarding objectives go to the ACL table.
        Parameters:
        fwd - the forwarding objective of type 'versatile'
        Returns:
        a collection of flow rules to be sent to the switch. An empty collection may be returned if there is a problem in processing the flow rule
      • versatileTreatmentBuilder

        protected org.onosproject.net.flow.TrafficTreatment.Builder versatileTreatmentBuilder​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
        Helper function to create traffic treatment builder for versatile forwarding objectives.
        Parameters:
        fwd - original forwarding objective
        Returns:
        treatment builder for the flow rule, or null if there is an error.
      • processEthTypeSpecific

        protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEthTypeSpecific​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
        Handles forwarding rules to the IP and MPLS tables.
        Parameters:
        fwd - the forwarding objective
        Returns:
        A collection of flow rules, or an empty set
      • processEthTypeSpecificInternal

        protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEthTypeSpecificInternal​(org.onosproject.net.flowobjective.ForwardingObjective fwd,
                                                                                                         boolean allowDefaultRoute,
                                                                                                         int mplsNextTable)
        Internal implementation of processEthTypeSpecific.

        Wildcarded IPv4_DST is not supported in OFDPA i12. Therefore, we break the rule into 0.0.0.0/1 and 128.0.0.0/1. The allowDefaultRoute must be set to false for OFDPA i12.

        Parameters:
        fwd - the forwarding objective
        allowDefaultRoute - allow wildcarded IPv4_DST or not
        mplsNextTable - next MPLS table
        Returns:
        A collection of flow rules, or an empty set
      • processEthDstSpecific

        protected java.util.Collection<org.onosproject.net.flow.FlowRule> processEthDstSpecific​(org.onosproject.net.flowobjective.ForwardingObjective fwd)
        Handles forwarding rules to the L2 bridging table. Flow actions are not allowed in the bridging table - instead we use L2 Interface group or L2 flood group
        Parameters:
        fwd - the forwarding objective
        Returns:
        A collection of flow rules, or an empty set
      • getNextMappings

        public java.util.List<java.lang.String> getNextMappings​(org.onosproject.net.behaviour.NextGroup nextGroup)
        Specified by:
        getNextMappings in interface org.onosproject.net.behaviour.Pipeliner