use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.
the class SwitchManager method buildEgressIslVlanRule.
private OFFlowMod buildEgressIslVlanRule(OFFactory ofFactory, int port) {
Match match = buildInPortMatch(port, ofFactory);
OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(EGRESS_TABLE_ID));
return prepareFlowModBuilder(ofFactory, Cookie.encodeIslVlanEgress(port), ISL_EGRESS_VLAN_RULE_PRIORITY_MULTITABLE, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable)).build();
}
use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.
the class TablePassThroughDefaultFlowGenerator method generateFlow.
@Override
public SwitchFlowTuple generateFlow(IOFSwitch sw) {
OFFactory ofFactory = sw.getOFFactory();
OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(goToTableId));
OFFlowMod flowMod = prepareFlowModBuilder(ofFactory, cookie, FlowModUtils.PRIORITY_MIN + 1, tableId).setInstructions(ImmutableList.of(goToTable)).build();
return SwitchFlowTuple.builder().sw(sw).flow(flowMod).build();
}
use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.
the class OfInstructionsConverter method convertToRuleManagerInstructions.
/**
* Convert instructions.
*/
public Instructions convertToRuleManagerInstructions(List<OFInstruction> ofInstructions) {
InstructionsBuilder builder = Instructions.builder();
for (OFInstruction ofInstruction : ofInstructions) {
if (ofInstruction instanceof OFInstructionApplyActions) {
List<OFAction> ofActions = ((OFInstructionApplyActions) ofInstruction).getActions();
List<Action> actions = ofActions.stream().map(this::convertToRuleManagerAction).collect(Collectors.toList());
builder.applyActions(actions);
} else if (ofInstruction instanceof OFInstructionWriteActions) {
List<OFAction> ofActions = ((OFInstructionWriteActions) ofInstruction).getActions();
Set<Action> actions = ofActions.stream().map(this::convertToRuleManagerAction).collect(Collectors.toSet());
builder.writeActions(actions);
} else if (ofInstruction instanceof OFInstructionMeter) {
final long meterId = ((OFInstructionMeter) ofInstruction).getMeterId();
builder.goToMeter(new MeterId(meterId));
} else if (ofInstruction instanceof OFInstructionGotoTable) {
final short tableId = ((OFInstructionGotoTable) ofInstruction).getTableId().getValue();
builder.goToTable(OfTable.fromInt(tableId));
} else if (ofInstruction instanceof OFInstructionWriteMetadata) {
final long metadata = ((OFInstructionWriteMetadata) ofInstruction).getMetadata().getValue();
final long metadataMask = ((OFInstructionWriteMetadata) ofInstruction).getMetadataMask().getValue();
builder.writeMetadata(new OfMetadata(metadata, metadataMask));
}
}
return builder.build();
}
use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.
the class OfFlowStatsMapper method toFlowInstructions.
/**
* Convert list of {@link OFInstruction} to {@link FlowInstructions}.
* @param instructions list of instructions to be converted.
* @return result of transformation {@link FlowInstructions}.
*/
public FlowInstructions toFlowInstructions(final List<OFInstruction> instructions) {
FlowInstructions.FlowInstructionsBuilder flowInstructions = FlowInstructions.builder();
for (OFInstruction entry : instructions) {
if (entry instanceof OFInstructionApplyActions) {
List<OFAction> actions = ((OFInstructionApplyActions) entry).getActions();
flowInstructions.applyActions(toFlowApplyActions(actions));
} else if (entry instanceof OFInstructionMeter) {
flowInstructions.goToMeter(((OFInstructionMeter) entry).getMeterId());
} else if (entry instanceof OFInstructionGotoTable) {
flowInstructions.goToTable(((OFInstructionGotoTable) entry).getTableId().getValue());
}
// add handling for other instructions here
}
return flowInstructions.build();
}
use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.
the class SwitchManager method buildIntermediateIngressRule.
@Override
public OFFlowMod buildIntermediateIngressRule(DatapathId dpid, int port) throws SwitchNotFoundException {
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
Match match = buildInPortMatch(port, ofFactory);
OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
return prepareFlowModBuilder(ofFactory, Cookie.encodeIngressRulePassThrough(port), INGRESS_CUSTOMER_PORT_RULE_PRIORITY_MULTITABLE, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable)).build();
}
Aggregations