Search in sources :

Example 31 with PopVlanAction

use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.

the class SingleTableIngressRuleGeneratorTest method buildTransformActionsVxlanEncapsulationSingleVlanTest.

@Test
public void buildTransformActionsVxlanEncapsulationSingleVlanTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
    SingleTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildTransformActions(OUTER_VLAN_ID_1, FEATURES);
    List<Action> expectedActions = newArrayList(new PopVlanAction(), buildPushVxlan());
    assertEquals(expectedActions, transformActions);
}
Also used : SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) Test(org.junit.Test)

Example 32 with PopVlanAction

use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.

the class SingleTableIngressYRuleGeneratorTest method buildTransformActionsVxlanEncapsulationSingleVlanTest.

@Test
public void buildTransformActionsVxlanEncapsulationSingleVlanTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
    SingleTableIngressYRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildTransformActions(OUTER_VLAN_ID_1, FEATURES);
    List<Action> expectedActions = newArrayList(new PopVlanAction(), buildPushVxlan());
    assertEquals(expectedActions, transformActions);
}
Also used : SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) Test(org.junit.Test)

Example 33 with PopVlanAction

use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.

the class EgressRuleGeneratorTest method buildVlanSingleTableFullPortEgressRuleTest.

@Test
public void buildVlanSingleTableFullPortEgressRuleTest() {
    FlowPath path = buildPath(false);
    Flow flow = buildFlow(path, 0, 0);
    EgressRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
    ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PopVlanAction(), new PortOutAction(new PortNumber(PORT_NUMBER_4)));
    assertEgressCommands(commands, OfTable.INPUT, VLAN_ENCAPSULATION, expectedApplyActions);
}
Also used : Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FlowPath(org.openkilda.model.FlowPath) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) Test(org.junit.Test)

Example 34 with PopVlanAction

use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.

the class MultiTableIngressRuleGeneratorTest method buildCommandsVlanEncapsulationDoubleVlanTest.

@Test
public void buildCommandsVlanEncapsulationDoubleVlanTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
    MultiTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
    assertEquals(4, commands.size());
    FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
    FlowSpeakerData preIngressCommand = (FlowSpeakerData) commands.get(1);
    FlowSpeakerData inputCustomerCommand = (FlowSpeakerData) commands.get(2);
    MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(3);
    assertEquals(newArrayList(meterCommand.getUuid()), new ArrayList<>(ingressCommand.getDependsOn()));
    Set<FieldMatch> expectedPreIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_1).build());
    FlowSharedSegmentCookie preIngressCookie = FlowSharedSegmentCookie.builder(SharedSegmentType.QINQ_OUTER_VLAN).portNumber(PORT_NUMBER_1).vlanId(OUTER_VLAN_ID_1).build();
    RoutingMetadata preIngressMetadata = RoutingMetadata.builder().outerVlanId(OUTER_VLAN_ID_1).build(SWITCH_1.getFeatures());
    assertPreIngressCommand(preIngressCommand, preIngressCookie, Priority.FLOW_PRIORITY, expectedPreIngressMatch, newArrayList(new PopVlanAction()), mapMetadata(preIngressMetadata));
    assertInputCustomerCommand(inputCustomerCommand, new PortColourCookie(MULTI_TABLE_INGRESS_RULES, PORT_NUMBER_1), Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build()));
    RoutingMetadata ingressMetadata = RoutingMetadata.builder().outerVlanId(OUTER_VLAN_ID_1).build(SWITCH_1.getFeatures());
    Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(INNER_VLAN_ID_1).build(), FieldMatch.builder().field(Field.METADATA).value(ingressMetadata.getValue()).mask(ingressMetadata.getMask()).build());
    List<Action> expectedIngressActions = newArrayList(SetFieldAction.builder().field(Field.VLAN_VID).value(TRANSIT_VLAN_ID).build(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
    assertIngressCommand(ingressCommand, Priority.DOUBLE_VLAN_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, METER_ID, null);
    assertMeterCommand(meterCommand);
}
Also used : SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) FlowSharedSegmentCookie(org.openkilda.model.cookie.FlowSharedSegmentCookie) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) PortColourCookie(org.openkilda.model.cookie.PortColourCookie) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Test(org.junit.Test)

Example 35 with PopVlanAction

use of org.openkilda.rulemanager.action.PopVlanAction 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)

Aggregations

PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)35 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)33 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)33 Action (org.openkilda.rulemanager.action.Action)32 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)32 Test (org.junit.Test)29 Flow (org.openkilda.model.Flow)29 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)28 GroupAction (org.openkilda.rulemanager.action.GroupAction)14 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)11 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)11 SpeakerData (org.openkilda.rulemanager.SpeakerData)11 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)7 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)7 RoutingMetadata (org.openkilda.rulemanager.utils.RoutingMetadata)7 CopyFieldAction (org.openkilda.rulemanager.action.noviflow.CopyFieldAction)5 FlowPath (org.openkilda.model.FlowPath)4 FlowSharedSegmentCookie (org.openkilda.model.cookie.FlowSharedSegmentCookie)4 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)4 ArrayList (java.util.ArrayList)3