Search in sources :

Example 11 with OFInstructionGotoTable

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

the class SwitchManager method buildLldpInputCustomerFlow.

@Override
public OFFlowMod buildLldpInputCustomerFlow(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.LLDP).build();
    RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(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.encodeLldpInputCustomer(port), LLDP_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)

Example 12 with OFInstructionGotoTable

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

the class SwitchManager method removeArpInputCustomerFlow.

@Override
public Long removeArpInputCustomerFlow(DatapathId dpid, int port) throws SwitchOperationException {
    long cookie = Cookie.encodeArpInputCustomer(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.setMatch(buildInPortMatch(port, ofFactory));
    builder.setInstructions(ImmutableList.of(goToTable));
    builder.setPriority(ARP_INPUT_CUSTOMER_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 13 with OFInstructionGotoTable

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

the class SwitchManager method removeIntermediateIngressRule.

@Override
public long removeIntermediateIngressRule(DatapathId dpid, int port) throws SwitchOperationException {
    IOFSwitch sw = lookupSwitch(dpid);
    OFFactory ofFactory = sw.getOFFactory();
    OFFlowDelete.Builder builder = ofFactory.buildFlowDelete();
    long cookie = Cookie.encodeIngressRulePassThrough(port);
    builder.setCookie(U64.of(cookie));
    builder.setCookieMask(U64.NO_MASK);
    Match match = buildInPortMatch(port, ofFactory);
    builder.setMatch(match);
    OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
    builder.setInstructions(ImmutableList.of(goToTable));
    builder.setPriority(INGRESS_CUSTOMER_PORT_RULE_PRIORITY_MULTITABLE);
    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) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 14 with OFInstructionGotoTable

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

the class SwitchManager method removeLldpInputCustomerFlow.

@Override
public long removeLldpInputCustomerFlow(DatapathId dpid, int port) throws SwitchOperationException {
    long cookie = Cookie.encodeLldpInputCustomer(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.setMatch(buildInPortMatch(port, ofFactory));
    builder.setInstructions(ImmutableList.of(goToTable));
    builder.setPriority(LLDP_INPUT_CUSTOMER_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)

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