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