Search in sources :

Example 16 with PopVlanAction

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

the class IngressMirrorRuleGeneratorTest method buildIngressActionsVxlanEncapsulationDoubleVlanTest.

@Test
public void buildIngressActionsVxlanEncapsulationDoubleVlanTest() {
    Flow flow = buildFlow(MULTI_TABLE_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
    IngressMirrorRuleGenerator generator = buildGenerator(MULTI_TABLE_PATH, flow, VXLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
    List<Action> expectedActions = newArrayList(new PopVlanAction(), new GroupAction(GROUP_ID));
    assertEquals(expectedActions, transformActions);
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) 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 17 with PopVlanAction

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

the class IngressMirrorRuleGeneratorTest method buildIngressActionsOneSwitchDoubleVlanInFullPortOutTest.

@Test
public void buildIngressActionsOneSwitchDoubleVlanInFullPortOutTest() {
    Flow flow = buildFlow(MULTI_TABLE_ONE_SWITCH_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1, 0, 0);
    IngressMirrorRuleGenerator generator = buildGenerator(MULTI_TABLE_ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
    List<Action> expectedActions = newArrayList(new PopVlanAction(), new GroupAction(GROUP_ID));
    assertEquals(expectedActions, transformActions);
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) 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 18 with PopVlanAction

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

the class IngressMirrorRuleGeneratorTest method buildSingleTableIngressActionsVlanEncapsulationSingleVlanTest.

@Test
public void buildSingleTableIngressActionsVlanEncapsulationSingleVlanTest() {
    Flow flow = buildFlow(SINGLE_TABLE_PATH, OUTER_VLAN_ID_1, 0);
    IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_TABLE_PATH, flow, VLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
    List<Action> expectedActions = newArrayList(new PopVlanAction(), new GroupAction(GROUP_ID));
    assertEquals(expectedActions, transformActions);
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) 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 19 with PopVlanAction

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

the class MultiTableIngressRuleGenerator method buildFlowPreIngressCommand.

private FlowSpeakerData buildFlowPreIngressCommand(Switch sw, FlowEndpoint endpoint) {
    FlowSharedSegmentCookie cookie = FlowSharedSegmentCookie.builder(SharedSegmentType.QINQ_OUTER_VLAN).portNumber(endpoint.getPortNumber()).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(Constants.Priority.FLOW_PRIORITY).match(buildPreIngressMatch(endpoint)).instructions(instructions);
    // todo add RESET_COUNTERS flag
    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 20 with PopVlanAction

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

the class MultiTableIngressRuleGeneratorTest method buildTransformActionsOneSwitchDoubleVlanInFullPortOutTest.

@Test
public void buildTransformActionsOneSwitchDoubleVlanInFullPortOutTest() {
    Flow flow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1, 0, 0);
    MultiTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildTransformActions(INNER_VLAN_ID_1, FEATURES);
    List<Action> expectedActions = newArrayList(new PopVlanAction());
    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)

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