Search in sources :

Example 11 with Match

use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.

the class SwitchManager method removeTransitIslVxlanRule.

@Override
public long removeTransitIslVxlanRule(DatapathId dpid, int port) throws SwitchOperationException {
    IOFSwitch sw = lookupSwitch(dpid);
    OFFactory ofFactory = sw.getOFFactory();
    OFFlowDelete.Builder builder = ofFactory.buildFlowDelete();
    long cookie = Cookie.encodeIslVxlanTransit(port);
    builder.setCookie(U64.of(cookie));
    builder.setCookieMask(U64.NO_MASK);
    Match match = buildTransitIslVxlanRuleMatch(port, ofFactory);
    builder.setMatch(match);
    builder.setPriority(ISL_TRANSIT_VXLAN_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) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 12 with Match

use of org.projectfloodlight.openflow.protocol.match.Match 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 13 with Match

use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.

the class SwitchManager method removeEgressIslVxlanRule.

@Override
public long removeEgressIslVxlanRule(DatapathId dpid, int port) throws SwitchOperationException {
    IOFSwitch sw = lookupSwitch(dpid);
    OFFactory ofFactory = sw.getOFFactory();
    OFFlowDelete.Builder builder = ofFactory.buildFlowDelete();
    long cookie = Cookie.encodeIslVxlanEgress(port);
    builder.setCookie(U64.of(cookie));
    builder.setCookieMask(U64.NO_MASK);
    Match match = buildEgressIslVxlanRuleMatch(dpid, port, ofFactory);
    builder.setMatch(match);
    builder.setPriority(ISL_EGRESS_VXLAN_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) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 14 with Match

use of org.projectfloodlight.openflow.protocol.match.Match 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)

Example 15 with Match

use of org.projectfloodlight.openflow.protocol.match.Match 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();
}
Also used : OFInstructionGotoTable(org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Aggregations

Match (org.projectfloodlight.openflow.protocol.match.Match)64 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)32 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)28 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)18 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)18 OFInstructionApplyActions (org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions)18 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)10 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)8 OFInstructionGotoTable (org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable)7 ArrayList (java.util.ArrayList)6 OFFlowDelete (org.projectfloodlight.openflow.protocol.OFFlowDelete)6 OFInstruction (org.projectfloodlight.openflow.protocol.instruction.OFInstruction)6 SwitchFeature (org.openkilda.model.SwitchFeature)5 OFFactoryVer13 (org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13)5 HashSet (java.util.HashSet)4 Test (org.junit.Test)4 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)4 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)4 Builder (org.projectfloodlight.openflow.protocol.match.Match.Builder)3 U64 (org.projectfloodlight.openflow.types.U64)3