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();
}
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();
}
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();
}
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();
}
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();
}
}
Aggregations