Search in sources :

Example 91 with PiActionParam

use of org.onosproject.net.pi.runtime.PiActionParam in project fabric-tna by stratum.

the class SlicingManagerTest method buildQueuesFlowRuleSlice1RealtimeNotRed.

private FlowRule buildQueuesFlowRuleSlice1RealtimeNotRed() {
    PiCriterion.Builder piCriterionBuilder = PiCriterion.builder().matchExact(P4InfoConstants.HDR_SLICE_TC, sliceTcConcat(SLICE_IDS.get(1).id(), TrafficClass.REAL_TIME.toInt()));
    PiAction.Builder piTableActionBuilder = PiAction.builder().withId(P4InfoConstants.FABRIC_INGRESS_QOS_SET_QUEUE).withParameter(new PiActionParam(P4InfoConstants.QID, QUEUE_ID_REAL_TIME.id()));
    return DefaultFlowRule.builder().forDevice(SlicingManagerTest.DEVICE_ID).forTable(PiTableId.of(FABRIC_INGRESS_QOS_QUEUES.id())).fromApp(APP_ID).withPriority(QUEUES_FLOW_PRIORITY_LOW).withSelector(DefaultTrafficSelector.builder().matchPi(piCriterionBuilder.build()).build()).withTreatment(DefaultTrafficTreatment.builder().piTableAction(piTableActionBuilder.build()).build()).makePermanent().build();
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 92 with PiActionParam

use of org.onosproject.net.pi.runtime.PiActionParam in project fabric-tna by stratum.

the class SlicingManagerTest method buildDefaultTcFlowRuleSlice1BestEffort.

private FlowRule buildDefaultTcFlowRuleSlice1BestEffort() {
    PiCriterion piCriterion = PiCriterion.builder().matchTernary(P4InfoConstants.HDR_SLICE_TC, sliceTcConcat(SLICE_IDS.get(1).id(), 0), 0x3C).matchExact(P4InfoConstants.HDR_TC_UNKNOWN, 1).build();
    PiAction piTableAction = PiAction.builder().withId(P4InfoConstants.FABRIC_INGRESS_QOS_SET_DEFAULT_TC).withParameter(new PiActionParam(P4InfoConstants.TC, QueueId.BEST_EFFORT.id())).build();
    return DefaultFlowRule.builder().forDevice(DEVICE_ID).forTable(FABRIC_INGRESS_QOS_DEFAULT_TC).fromApp(APP_ID).withPriority(DEFAULT_TC_PRIORITY).withSelector(DefaultTrafficSelector.builder().matchPi(piCriterion).build()).withTreatment(DefaultTrafficTreatment.builder().piTableAction(piTableAction).build()).makePermanent().build();
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 93 with PiActionParam

use of org.onosproject.net.pi.runtime.PiActionParam in project fabric-tna by stratum.

the class SlicingManagerTest method buildQueuesFlowRuleSlice1ControlNotGreen.

private FlowRule buildQueuesFlowRuleSlice1ControlNotGreen() {
    PiCriterion.Builder piCriterionBuilder = PiCriterion.builder().matchExact(P4InfoConstants.HDR_SLICE_TC, sliceTcConcat(SLICE_IDS.get(1).id(), TrafficClass.CONTROL.toInt()));
    PiAction.Builder piTableActionBuilder = PiAction.builder().withId(P4InfoConstants.FABRIC_INGRESS_QOS_SET_QUEUE).withParameter(new PiActionParam(P4InfoConstants.QID, QueueId.BEST_EFFORT.id()));
    return DefaultFlowRule.builder().forDevice(SlicingManagerTest.DEVICE_ID).forTable(PiTableId.of(FABRIC_INGRESS_QOS_QUEUES.id())).fromApp(APP_ID).withPriority(QUEUES_FLOW_PRIORITY_LOW).withSelector(DefaultTrafficSelector.builder().matchPi(piCriterionBuilder.build()).build()).withTreatment(DefaultTrafficTreatment.builder().piTableAction(piTableActionBuilder.build()).build()).makePermanent().build();
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 94 with PiActionParam

use of org.onosproject.net.pi.runtime.PiActionParam in project fabric-tna by stratum.

the class SlicingManagerTest method buildQueuesFlowRuleSlice1ControlGreen.

private FlowRule buildQueuesFlowRuleSlice1ControlGreen() {
    PiCriterion.Builder piCriterionBuilder = PiCriterion.builder().matchExact(P4InfoConstants.HDR_SLICE_TC, sliceTcConcat(SLICE_IDS.get(1).id(), TrafficClass.CONTROL.toInt())).matchTernary(HDR_COLOR, COLOR_GREEN, 1 << HDR_COLOR_BITWIDTH - 1);
    PiAction.Builder piTableActionBuilder = PiAction.builder().withId(P4InfoConstants.FABRIC_INGRESS_QOS_SET_QUEUE).withParameter(new PiActionParam(P4InfoConstants.QID, QUEUE_ID_CONTROL.id()));
    return DefaultFlowRule.builder().forDevice(SlicingManagerTest.DEVICE_ID).forTable(PiTableId.of(FABRIC_INGRESS_QOS_QUEUES.id())).fromApp(APP_ID).withPriority(QUEUES_FLOW_PRIORITY_HIGH).withSelector(DefaultTrafficSelector.builder().matchPi(piCriterionBuilder.build()).build()).withTreatment(DefaultTrafficTreatment.builder().piTableAction(piTableActionBuilder.build()).build()).makePermanent().build();
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 95 with PiActionParam

use of org.onosproject.net.pi.runtime.PiActionParam in project fabric-tna by stratum.

the class FabricTreatmentInterpreter method mapNextHashedOrSimpleTreatment.

private static PiAction mapNextHashedOrSimpleTreatment(TrafficTreatment treatment, PiTableId tableId, boolean simple) throws PiInterpreterException {
    // Provide mapping for output_hashed and routing_hashed; multicast_hashed
    // can only be invoked with PiAction, hence no mapping. outPort required for
    // all actions. Presence of other instructions will determine which action to map to.
    final PortNumber outPort = ((OutputInstruction) instructionOrFail(treatment, OUTPUT, tableId)).port();
    final ModEtherInstruction ethDst = (ModEtherInstruction) l2Instruction(treatment, ETH_DST);
    final ModEtherInstruction ethSrc = (ModEtherInstruction) l2Instruction(treatment, ETH_SRC);
    final PiAction.Builder actionBuilder = PiAction.builder().withParameter(new PiActionParam(P4InfoConstants.PORT_NUM, outPort.toLong()));
    if (ethDst != null && ethSrc != null) {
        actionBuilder.withParameter(new PiActionParam(P4InfoConstants.SMAC, ethSrc.mac().toBytes()));
        actionBuilder.withParameter(new PiActionParam(P4InfoConstants.DMAC, ethDst.mac().toBytes()));
        // routing_hashed
        return actionBuilder.withId(P4InfoConstants.FABRIC_INGRESS_NEXT_ROUTING_HASHED).build();
    } else {
        // output_hashed
        return actionBuilder.withId(P4InfoConstants.FABRIC_INGRESS_NEXT_OUTPUT_HASHED).build();
    }
}
Also used : OutputInstruction(org.onosproject.net.flow.instructions.Instructions.OutputInstruction) ModEtherInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction) PortNumber(org.onosproject.net.PortNumber) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) PiAction(org.onosproject.net.pi.runtime.PiAction)

Aggregations

PiActionParam (org.onosproject.net.pi.runtime.PiActionParam)102 PiAction (org.onosproject.net.pi.runtime.PiAction)90 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)50 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)50 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)39 TrafficSelector (org.onosproject.net.flow.TrafficSelector)39 PiCriterion (org.onosproject.net.flow.criteria.PiCriterion)39 Test (org.junit.Test)30 FlowRule (org.onosproject.net.flow.FlowRule)27 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)21 GroupDescription (org.onosproject.net.group.GroupDescription)11 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)10 DefaultNextObjective (org.onosproject.net.flowobjective.DefaultNextObjective)8 NextObjective (org.onosproject.net.flowobjective.NextObjective)8 PortNumber (org.onosproject.net.PortNumber)7 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)7 GroupBucket (org.onosproject.net.group.GroupBucket)7 GroupBuckets (org.onosproject.net.group.GroupBuckets)7 PiActionProfileGroupId (org.onosproject.net.pi.runtime.PiActionProfileGroupId)7 PiGroupKey (org.onosproject.net.pi.runtime.PiGroupKey)6