Search in sources :

Example 6 with PiCriterion

use of org.onosproject.net.flow.criteria.PiCriterion in project TFG by mattinelorza.

the class Ipv6SimpleRoutingComponent method setSwitchId.

private void setSwitchId(DeviceId deviceId, int sw_id) {
    log.info("Setting sw_id {}", sw_id);
    final String tableId = "IngressPipeImpl.sw_id_table";
    final int ETHERTYPE_IPV4 = 0x0800;
    final int MASK = 0xFFFF;
    final PiCriterion match = PiCriterion.builder().matchTernary(PiMatchFieldId.of("hdr.ethernet.ether_type"), ETHERTYPE_IPV4, MASK).build();
    final PiAction action = PiAction.builder().withId(PiActionId.of("IngressPipeImpl.set_sw_id")).withParameter(new PiActionParam(PiActionParamId.of("sw_id"), sw_id)).build();
    FlowRule flowRuleSwID = Utils.buildFlowRule(deviceId, appId, tableId, match, action);
    flowRuleService.applyFlowRules(flowRuleSwID);
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) FlowRule(org.onosproject.net.flow.FlowRule) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 7 with PiCriterion

use of org.onosproject.net.flow.criteria.PiCriterion in project onos by opennetworkinglab.

the class IntProgrammableImpl method populateInstTableEntry.

private void populateInstTableEntry(PiTableId tableId, PiMatchFieldId matchFieldId, int matchValue, PiActionId actionId, ApplicationId appId) {
    PiCriterion instCriterion = PiCriterion.builder().matchExact(matchFieldId, matchValue).build();
    TrafficSelector instSelector = DefaultTrafficSelector.builder().matchPi(instCriterion).build();
    PiAction instAction = PiAction.builder().withId(actionId).build();
    TrafficTreatment instTreatment = DefaultTrafficTreatment.builder().piTableAction(instAction).build();
    FlowRule instFlowRule = DefaultFlowRule.builder().withSelector(instSelector).withTreatment(instTreatment).withPriority(DEFAULT_PRIORITY).makePermanent().forDevice(deviceId).forTable(tableId).fromApp(appId).build();
    flowRuleService.applyFlowRules(instFlowRule);
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 8 with PiCriterion

use of org.onosproject.net.flow.criteria.PiCriterion in project onos by opennetworkinglab.

the class NextObjectiveTranslator method egressVlan.

private void egressVlan(PortNumber outPort, NextObjective obj, Instruction popVlanInst, ObjectiveTranslation.Builder resultBuilder) throws FabricPipelinerException {
    final VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) criterion(obj.meta(), Criterion.Type.VLAN_VID);
    final PiCriterion egressVlanTableMatch = PiCriterion.builder().matchExact(FabricConstants.HDR_EG_PORT, outPort.toLong()).build();
    final TrafficSelector selector = DefaultTrafficSelector.builder().matchPi(egressVlanTableMatch).matchVlanId(vlanIdCriterion.vlanId()).build();
    final TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
    if (popVlanInst == null) {
        treatmentBuilder.pushVlan();
    } else {
        treatmentBuilder.popVlan();
    }
    resultBuilder.addFlowRule(flowRule(obj, FabricConstants.FABRIC_EGRESS_EGRESS_NEXT_EGRESS_VLAN, selector, treatmentBuilder.build()));
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion)

Example 9 with PiCriterion

use of org.onosproject.net.flow.criteria.PiCriterion in project onos by opennetworkinglab.

the class FabricIntProgrammable method setSourcePort.

@Override
public boolean setSourcePort(PortNumber port) {
    if (!setupBehaviour()) {
        return false;
    }
    PiCriterion ingressCriterion = PiCriterion.builder().matchExact(FabricConstants.HDR_IG_PORT, port.toLong()).build();
    TrafficSelector srcSelector = DefaultTrafficSelector.builder().matchPi(ingressCriterion).build();
    PiAction setSourceAct = PiAction.builder().withId(FabricConstants.FABRIC_INGRESS_PROCESS_SET_SOURCE_SINK_INT_SET_SOURCE).build();
    TrafficTreatment srcTreatment = DefaultTrafficTreatment.builder().piTableAction(setSourceAct).build();
    FlowRule srcFlowRule = DefaultFlowRule.builder().withSelector(srcSelector).withTreatment(srcTreatment).fromApp(appId).withPriority(DEFAULT_PRIORITY).makePermanent().forDevice(deviceId).forTable(FabricConstants.FABRIC_INGRESS_PROCESS_SET_SOURCE_SINK_TB_SET_SOURCE).build();
    flowRuleService.applyFlowRules(srcFlowRule);
    return true;
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) PiAction(org.onosproject.net.pi.runtime.PiAction)

Example 10 with PiCriterion

use of org.onosproject.net.flow.criteria.PiCriterion in project onos by opennetworkinglab.

the class FabricBngProgrammable method setupPuntToCpu.

/**
 * Set the punt to CPU rules of the BNG from a specific Application ID.
 *
 * @param appId Application ID asking to recive BNG control plane packets.
 */
private void setupPuntToCpu(ApplicationId appId) {
    for (Criterion c : PuntCpuCriterionFactory.getAllPuntCriterion()) {
        FlowRule flPuntCpu = buildTPppoeCpFlowRule((PiCriterion) c, appId);
        flowRuleService.applyFlowRules(flPuntCpu);
    }
}
Also used : PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule)

Aggregations

PiCriterion (org.onosproject.net.flow.criteria.PiCriterion)69 PiAction (org.onosproject.net.pi.runtime.PiAction)45 PiActionParam (org.onosproject.net.pi.runtime.PiActionParam)31 TrafficSelector (org.onosproject.net.flow.TrafficSelector)29 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)28 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)27 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)26 FlowRule (org.onosproject.net.flow.FlowRule)25 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)16 PiTableAction (org.onosproject.net.pi.runtime.PiTableAction)13 Test (org.junit.Test)8 UpfProgrammableException (org.onosproject.net.behaviour.upf.UpfProgrammableException)8 DefaultNextObjective (org.onosproject.net.flowobjective.DefaultNextObjective)8 NextObjective (org.onosproject.net.flowobjective.NextObjective)8 PiActionId (org.onosproject.net.pi.model.PiActionId)7 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)6 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)6 GroupBucket (org.onosproject.net.group.GroupBucket)6 GroupBuckets (org.onosproject.net.group.GroupBuckets)6 GroupDescription (org.onosproject.net.group.GroupDescription)6