Search in sources :

Example 1 with Builder

use of org.projectfloodlight.openflow.protocol.OFFlowMod.Builder in project open-kilda by telstra.

the class IngressFlowModFactory method makeDoubleVlanForwardMessage.

/**
 * Make rule to match inner VLAN tag and forward in in ISL (or out port in case one-switch flow).
 */
public OFFlowMod makeDoubleVlanForwardMessage(EffectiveIds effectiveIds) {
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(switchFeatures);
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), 10).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
    return makeForwardMessage(builder, effectiveIds, 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 2 with Builder

use of org.projectfloodlight.openflow.protocol.OFFlowMod.Builder in project open-kilda by telstra.

the class IngressFlowModFactory method makeSingleVlanServer42IngressFlowMessage.

/**
 * Make rule to forward server 42 traffic matched by outer VLAN tag and forward in in ISL.
 */
public OFFlowMod makeSingleVlanServer42IngressFlowMessage() {
    RoutingMetadata metadata = buildServer42IngressMetadata();
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID)).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(command.getRulesContext().getServer42Port())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
    return makeServer42IngressFlowMessage(builder, Collections.emptyList());
}
Also used : RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) Builder(org.projectfloodlight.openflow.protocol.OFFlowMod.Builder) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 3 with Builder

use of org.projectfloodlight.openflow.protocol.OFFlowMod.Builder 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 4 with Builder

use of org.projectfloodlight.openflow.protocol.OFFlowMod.Builder in project open-kilda by telstra.

the class IngressFlowModFactory method makeOuterOnlyVlanServer42IngressFlowMessage.

/**
 * Make server 42 ingress rule to match RTT packets by port+vlan and route it into ISL/egress end.
 */
public OFFlowMod makeOuterOnlyVlanServer42IngressFlowMessage(int server42UpdPortOffset) {
    Match match = makeServer42IngressFlowMatch(OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), command.getEndpoint().getOuterVlanId()), server42UpdPortOffset);
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID)).setMatch(match);
    return makeServer42IngressFlowMessage(builder, FlowEndpoint.makeVlanStack(command.getEndpoint().getOuterVlanId()));
}
Also used : Builder(org.projectfloodlight.openflow.protocol.OFFlowMod.Builder) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Match(org.projectfloodlight.openflow.protocol.match.Match) OFVlanVidMatch(org.projectfloodlight.openflow.types.OFVlanVidMatch)

Example 5 with Builder

use of org.projectfloodlight.openflow.protocol.OFFlowMod.Builder in project open-kilda by telstra.

the class IngressFlowModFactory method makeOuterOnlyVlanForwardMessage.

/**
 * Make rule to match traffic by port+vlan and route it into ISL/egress end.
 */
public OFFlowMod makeOuterOnlyVlanForwardMessage(EffectiveIds effectiveIds) {
    FlowEndpoint endpoint = command.getEndpoint();
    OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID)).setMatch(OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getOuterVlanId()).setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).build());
    return makeForwardMessage(builder, effectiveIds, FlowEndpoint.makeVlanStack(endpoint.getOuterVlanId()));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) Builder(org.projectfloodlight.openflow.protocol.OFFlowMod.Builder) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Aggregations

OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)7 Builder (org.projectfloodlight.openflow.protocol.OFFlowMod.Builder)7 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)4 FlowEndpoint (org.openkilda.model.FlowEndpoint)4 Match (org.projectfloodlight.openflow.protocol.match.Match)2 OFVlanVidMatch (org.projectfloodlight.openflow.types.OFVlanVidMatch)2