Search in sources :

Example 6 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class IngressFlowModFactory method makeDoubleVlanServer42IngressFlowMessage.

/**
 * Make rule to match server 42 packets by inner VLAN tag and forward in in ISL.
 */
public OFFlowMod makeDoubleVlanServer42IngressFlowMessage() {
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = buildServer42IngressMetadata();
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), SERVER_42_INGRESS_DOUBLE_VLAN_FLOW_PRIORITY_OFFSET).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(getCommand().getRulesContext().getServer42Port())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
    return makeServer42IngressFlowMessage(builder, FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) Builder(org.projectfloodlight.openflow.protocol.OFFlowMod.Builder) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 7 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class OneSwitchFlowInstallFlowModFactory method makeMetadataInstructions.

@Override
protected List<OFInstruction> makeMetadataInstructions() {
    RoutingMetadata metadata = RoutingMetadata.builder().oneSwitchFlowFlag(true).build(switchFeatures);
    OFInstructionWriteMetadata writeMetadata = of.instructions().buildWriteMetadata().setMetadata(metadata.getValue()).setMetadataMask(metadata.getMask()).build();
    return Lists.newArrayList(writeMetadata);
}
Also used : OFInstructionWriteMetadata(org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata)

Example 8 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class SwitchManager method installServer42OuterVlanMatchSharedFlow.

@Override
public void installServer42OuterVlanMatchSharedFlow(DatapathId dpid, FlowSharedSegmentCookie cookie) throws SwitchOperationException {
    IOFSwitch sw = lookupSwitch(dpid);
    OFFactory of = sw.getOFFactory();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(cookie.getVlanId()).build(featureDetectorService.detectSwitch(sw));
    ImmutableList<OFInstruction> instructions = ImmutableList.of(of.instructions().applyActions(ImmutableList.of(of.actions().popVlan())), of.instructions().writeMetadata(metadata.getValue(), metadata.getMask()), of.instructions().gotoTable(TableId.of(SwitchManager.INGRESS_TABLE_ID)));
    OFFlowMod flow = prepareFlowModBuilder(of, cookie.getValue(), FLOW_PRIORITY, PRE_INGRESS_TABLE_ID).setCookie(U64.of(cookie.getValue())).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(cookie.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(cookie.getVlanId())).build()).setInstructions(instructions).build();
    pushFlow(sw, "--server 42 shared rule--", flow);
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OFInstruction(org.projectfloodlight.openflow.protocol.instruction.OFInstruction) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 9 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata 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 10 with RoutingMetadata

use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.

the class LldpPostIngressFlowGenerator method getLldpFlowMod.

@Override
OFFlowMod getLldpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
    OFFactory ofFactory = sw.getOFFactory();
    RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(true), sw);
    Match match = ofFactory.buildMatch().setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build();
    actionList.add(actionSendToController(sw.getOFFactory()));
    OFInstructionApplyActions actions = ofFactory.instructions().applyActions(actionList).createBuilder().build();
    return prepareFlowModBuilder(ofFactory, LLDP_POST_INGRESS_COOKIE, LLDP_POST_INGRESS_PRIORITY, POST_INGRESS_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) Match(org.projectfloodlight.openflow.protocol.match.Match)

Aggregations

RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)29 FlowEndpoint (org.openkilda.model.FlowEndpoint)13 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)12 Match (org.projectfloodlight.openflow.protocol.match.Match)10 OFInstructionApplyActions (org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions)8 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)7 EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)6 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)6 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)4 IngressFlowSegmentInstallCommand (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand)4 Builder (org.projectfloodlight.openflow.protocol.OFFlowMod.Builder)4 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)3 OFInstructionWriteMetadata (org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata)3 OneSwitchFlowInstallCommand (org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand)2 RoutingMetadataBuilder (org.openkilda.floodlight.utils.metadata.RoutingMetadata.RoutingMetadataBuilder)2 SwitchFeature (org.openkilda.model.SwitchFeature)2 OFInstruction (org.projectfloodlight.openflow.protocol.instruction.OFInstruction)2 OFInstructionGotoTable (org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable)2 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)2 Test (org.junit.Test)1