Search in sources :

Example 41 with RoutingMetadata

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

the class MultiTableServer42IngressRuleGenerator method buildServer42PreIngressCommand.

private FlowSpeakerData buildServer42PreIngressCommand(Switch sw, FlowEndpoint endpoint) {
    FlowSharedSegmentCookie cookie = FlowSharedSegmentCookie.builder(SharedSegmentType.SERVER42_QINQ_OUTER_VLAN).portNumber(switchProperties.getServer42Port()).vlanId(endpoint.getOuterVlanId()).build();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(sw.getFeatures());
    Instructions instructions = Instructions.builder().applyActions(Lists.newArrayList(new PopVlanAction())).writeMetadata(new OfMetadata(metadata.getValue(), metadata.getMask())).goToTable(OfTable.INGRESS).build();
    FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(endpoint.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(cookie).table(OfTable.PRE_INGRESS).priority(SERVER_42_PRE_INGRESS_FLOW_PRIORITY).match(Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(switchProperties.getServer42Port()).build(), FieldMatch.builder().field(Field.VLAN_VID).value(endpoint.getOuterVlanId()).build())).instructions(instructions);
    return builder.build();
}
Also used : OfMetadata(org.openkilda.rulemanager.OfMetadata) FlowSharedSegmentCookie(org.openkilda.model.cookie.FlowSharedSegmentCookie) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) Instructions(org.openkilda.rulemanager.Instructions) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction)

Example 42 with RoutingMetadata

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

the class MultiTableIngressRuleGenerator method buildInstructions.

private Instructions buildInstructions(Switch sw, List<Action> actions) {
    Instructions instructions = Instructions.builder().applyActions(actions).goToTable(OfTable.POST_INGRESS).build();
    addMeterToInstructions(flowPath.getMeterId(), sw, instructions);
    if (flowPath.isOneSwitchFlow()) {
        RoutingMetadata metadata = RoutingMetadata.builder().oneSwitchFlowFlag(true).build(sw.getFeatures());
        instructions.setWriteMetadata(new OfMetadata(metadata.getValue(), metadata.getMask()));
    }
    return instructions;
}
Also used : OfMetadata(org.openkilda.rulemanager.OfMetadata) Instructions(org.openkilda.rulemanager.Instructions) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata)

Aggregations

RoutingMetadata (org.openkilda.rulemanager.utils.RoutingMetadata)42 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)37 Test (org.junit.Test)18 Flow (org.openkilda.model.Flow)16 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)14 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)14 SpeakerData (org.openkilda.rulemanager.SpeakerData)14 Action (org.openkilda.rulemanager.action.Action)14 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)14 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)14 Instructions (org.openkilda.rulemanager.Instructions)13 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)12 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)12 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)12 Cookie (org.openkilda.model.cookie.Cookie)8 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)8 FlowSideAdapter (org.openkilda.adapter.FlowSideAdapter)7 OfMetadata (org.openkilda.rulemanager.OfMetadata)7 FlowSourceAdapter (org.openkilda.adapter.FlowSourceAdapter)6 PortColourCookie (org.openkilda.model.cookie.PortColourCookie)6