Search in sources :

Example 1 with OFInstructionGotoTable

use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.

the class IngressFlowModFactoryTest method verifyGoToTableInstruction.

// --- verify methods
protected void verifyGoToTableInstruction(OFFlowMod message) {
    OFInstructionGotoTable match = null;
    for (OFInstruction instruction : message.getInstructions()) {
        if (instruction instanceof OFInstructionGotoTable) {
            match = (OFInstructionGotoTable) instruction;
            break;
        }
    }
    if (expectPostIngressTableRedirect()) {
        Assert.assertNotNull(match);
        Assert.assertEquals(TableId.of(SwitchManager.POST_INGRESS_TABLE_ID), match.getTableId());
    } else {
        Assert.assertNull(match);
    }
}
Also used : OFInstruction(org.projectfloodlight.openflow.protocol.instruction.OFInstruction) OFInstructionGotoTable(org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable)

Example 2 with OFInstructionGotoTable

use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.

the class SwitchManager method buildEgressIslVxlanRule.

private OFFlowMod buildEgressIslVxlanRule(OFFactory ofFactory, DatapathId dpid, int port) {
    Match match = buildEgressIslVxlanRuleMatch(dpid, port, ofFactory);
    OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(EGRESS_TABLE_ID));
    return prepareFlowModBuilder(ofFactory, Cookie.encodeIslVxlanEgress(port), ISL_EGRESS_VXLAN_RULE_PRIORITY_MULTITABLE, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable)).build();
}
Also used : OFInstructionGotoTable(org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 3 with OFInstructionGotoTable

use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.

the class SwitchManager method removeServer42FlowRttInputFlow.

@Override
public Long removeServer42FlowRttInputFlow(DatapathId dpid, int port) throws SwitchOperationException {
    long cookie = Cookie.encodeServer42FlowRttInput(port);
    IOFSwitch sw = lookupSwitch(dpid);
    OFFactory ofFactory = sw.getOFFactory();
    OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
    OFFlowDelete.Builder builder = ofFactory.buildFlowDelete();
    builder.setCookie(U64.of(cookie));
    builder.setCookieMask(U64.NO_MASK);
    builder.setInstructions(ImmutableList.of(goToTable));
    builder.setPriority(SERVER_42_FLOW_RTT_INPUT_PRIORITY);
    removeFlowByOfFlowDelete(dpid, INPUT_TABLE_ID, builder.build());
    return cookie;
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OFFlowDelete(org.projectfloodlight.openflow.protocol.OFFlowDelete) OFInstructionGotoTable(org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory)

Example 4 with OFInstructionGotoTable

use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.

the class SwitchManager method buildTransitIslVxlanRule.

private OFFlowMod buildTransitIslVxlanRule(OFFactory ofFactory, int port) {
    Match match = buildTransitIslVxlanRuleMatch(port, ofFactory);
    OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(TRANSIT_TABLE_ID));
    return prepareFlowModBuilder(ofFactory, Cookie.encodeIslVxlanTransit(port), ISL_TRANSIT_VXLAN_RULE_PRIORITY_MULTITABLE, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable)).build();
}
Also used : OFInstructionGotoTable(org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 5 with OFInstructionGotoTable

use of org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable in project open-kilda by telstra.

the class SwitchManager method buildArpInputCustomerFlow.

@Override
public OFFlowMod buildArpInputCustomerFlow(DatapathId dpid, int port) throws SwitchNotFoundException {
    IOFSwitch sw = lookupSwitch(dpid);
    OFFactory ofFactory = sw.getOFFactory();
    Match match = ofFactory.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(port)).setExact(MatchField.ETH_TYPE, EthType.ARP).build();
    RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().arpFlag(true), sw);
    OFInstructionWriteMetadata writeMetadata = ofFactory.instructions().buildWriteMetadata().setMetadata(metadata.getValue()).setMetadataMask(metadata.getMask()).build();
    OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
    return prepareFlowModBuilder(ofFactory, Cookie.encodeArpInputCustomer(port), ARP_INPUT_CUSTOMER_PRIORITY, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable, writeMetadata)).build();
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OFInstructionGotoTable(org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFInstructionWriteMetadata(org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Aggregations

OFInstructionGotoTable (org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable)14 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)8 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)7 Match (org.projectfloodlight.openflow.protocol.match.Match)7 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)7 OFFlowDelete (org.projectfloodlight.openflow.protocol.OFFlowDelete)4 OFInstruction (org.projectfloodlight.openflow.protocol.instruction.OFInstruction)3 OFInstructionWriteMetadata (org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata)3 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)2 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)2 OFInstructionApplyActions (org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions)2 OFInstructionMeter (org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Set (java.util.Set)1 FlowInstructions (org.openkilda.messaging.info.rule.FlowInstructions)1 MeterId (org.openkilda.model.MeterId)1 InstructionsBuilder (org.openkilda.rulemanager.Instructions.InstructionsBuilder)1 OfMetadata (org.openkilda.rulemanager.OfMetadata)1 Action (org.openkilda.rulemanager.action.Action)1