Package org.onosproject.net.pi.model
Interface PiPipelineInterpreter
-
- All Superinterfaces:
Behaviour
,HandlerBehaviour
@Beta public interface PiPipelineInterpreter extends HandlerBehaviour
An interpreter of a PI pipeline model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PiPipelineInterpreter.PiInterpreterException
Signals that an error was encountered while executing the interpreter.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.Optional<PiAction>
getOriginalDefaultAction(PiTableId tableId)
If the given table allows for mutable default actions, this method returns an action instance to be used when ONOS tries to remove a different default action previously set.java.util.Optional<PiMatchFieldId>
mapCriterionType(Criterion.Type type)
Returns a PI match field ID that is equivalent to the given criterion type, if present.java.util.Optional<PiTableId>
mapFlowRuleTableId(int flowRuleTableId)
Returns a PI table ID equivalent to the given numeric table ID (as inFlowRule.tableId()
).InboundPacket
mapInboundPacket(PiPacketOperation packetOperation, DeviceId deviceId)
Returns an inbound packet equivalent to the given PI packet-in operation for the given device.default java.util.Optional<java.lang.Integer>
mapLogicalPortNumber(PortNumber port)
Maps the given logical port number to the data plane port ID (integer) identifying the same port for this pipeconf, if such mapping is possible.java.util.Collection<PiPacketOperation>
mapOutboundPacket(OutboundPacket packet)
Returns a collection of PI packet operations equivalent to the given outbound packet instance.PiAction
mapTreatment(TrafficTreatment treatment, PiTableId piTableId)
Returns an action of a PI pipeline that is functionally equivalent to the given traffic treatment for the given table.-
Methods inherited from interface org.onosproject.net.driver.HandlerBehaviour
handler, setHandler
-
-
-
-
Method Detail
-
mapCriterionType
java.util.Optional<PiMatchFieldId> mapCriterionType(Criterion.Type type)
Returns a PI match field ID that is equivalent to the given criterion type, if present. If not present, it means that the given criterion type is not supported by this interpreter.- Parameters:
type
- criterion type- Returns:
- optional match field ID
-
mapFlowRuleTableId
java.util.Optional<PiTableId> mapFlowRuleTableId(int flowRuleTableId)
Returns a PI table ID equivalent to the given numeric table ID (as inFlowRule.tableId()
). If not present, it means that the given integer table ID cannot be mapped to any table of the pipeline model.- Parameters:
flowRuleTableId
- a numeric table ID- Returns:
- PI table ID
-
mapTreatment
PiAction mapTreatment(TrafficTreatment treatment, PiTableId piTableId) throws PiPipelineInterpreter.PiInterpreterException
Returns an action of a PI pipeline that is functionally equivalent to the given traffic treatment for the given table.- Parameters:
treatment
- traffic treatmentpiTableId
- PI table ID- Returns:
- action object
- Throws:
PiPipelineInterpreter.PiInterpreterException
- if the treatment cannot be mapped to any PI action
-
mapOutboundPacket
java.util.Collection<PiPacketOperation> mapOutboundPacket(OutboundPacket packet) throws PiPipelineInterpreter.PiInterpreterException
Returns a collection of PI packet operations equivalent to the given outbound packet instance.- Parameters:
packet
- outbound packet- Returns:
- collection of PI packet operations
- Throws:
PiPipelineInterpreter.PiInterpreterException
- if the packet treatments cannot be executed by this pipeline
-
mapInboundPacket
InboundPacket mapInboundPacket(PiPacketOperation packetOperation, DeviceId deviceId) throws PiPipelineInterpreter.PiInterpreterException
Returns an inbound packet equivalent to the given PI packet-in operation for the given device.- Parameters:
packetOperation
- packet operationdeviceId
- ID of the device that originated the packet-in- Returns:
- inbound packet
- Throws:
PiPipelineInterpreter.PiInterpreterException
- if the packet operation cannot be mapped to an inbound packet
-
mapLogicalPortNumber
default java.util.Optional<java.lang.Integer> mapLogicalPortNumber(PortNumber port)
Maps the given logical port number to the data plane port ID (integer) identifying the same port for this pipeconf, if such mapping is possible.- Parameters:
port
- port number- Returns:
- optional integer
-
getOriginalDefaultAction
default java.util.Optional<PiAction> getOriginalDefaultAction(PiTableId tableId)
If the given table allows for mutable default actions, this method returns an action instance to be used when ONOS tries to remove a different default action previously set.- Parameters:
tableId
- table ID- Returns:
- optional default action
-
-