Search in sources :

Example 26 with PopVlanAction

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

the class IngressMirrorRuleGeneratorTest method buildSingleTableIngressActionsVxlanEncapsulationSingleVlanTest.

@Test
public void buildSingleTableIngressActionsVxlanEncapsulationSingleVlanTest() {
    Flow flow = buildFlow(SINGLE_TABLE_PATH, OUTER_VLAN_ID_1, 0);
    IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_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 27 with PopVlanAction

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

the class IngressMirrorRuleGeneratorTest method buildCommandsVxlanEncapsulationDoubleVlanTest.

@Test
public void buildCommandsVxlanEncapsulationDoubleVlanTest() {
    Flow flow = buildFlow(MULTI_TABLE_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
    IngressMirrorRuleGenerator generator = buildGenerator(MULTI_TABLE_PATH, flow, VXLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
    assertEquals(2, commands.size());
    FlowSpeakerData ingressCommand = getCommand(FlowSpeakerData.class, commands);
    GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
    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(new PopVlanAction(), new GroupAction(GROUP_ID));
    assertIngressCommand(ingressCommand, Priority.MIRROR_DOUBLE_VLAN_FLOW_PRIORITY, INGRESS, expectedIngressMatch, expectedIngressActions, METER_ID, groupCommand.getUuid());
    Set<Action> expectedFlowBucketActions = newHashSet(buildPushVxlan(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
    assertGroupCommand(groupCommand, expectedFlowBucketActions);
}
Also used : 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) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) Test(org.junit.Test)

Example 28 with PopVlanAction

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

the class IngressMirrorRuleGeneratorTest method buildIngressActionsVlanEncapsulationDoubleVlanTest.

@Test
public void buildIngressActionsVlanEncapsulationDoubleVlanTest() {
    Flow flow = buildFlow(MULTI_TABLE_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
    IngressMirrorRuleGenerator generator = buildGenerator(MULTI_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 29 with PopVlanAction

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

the class RuleManagerHelperTest method buildAllActions.

private List<Action> buildAllActions() {
    List<Action> actions = new ArrayList<>();
    actions.add(new GroupAction(GROUP_ID_1));
    actions.add(new MeterAction(METER_ID_1));
    actions.add(new PopVlanAction());
    actions.add(new PopVxlanAction(ActionType.POP_VXLAN_OVS));
    actions.add(new PortOutAction(PORT_NUMBER));
    actions.add(new PushVlanAction());
    actions.add(SetFieldAction.builder().field(Field.VLAN_VID).value(VLAN_ID).build());
    actions.add(CopyFieldAction.builder().srcOffset(0).dstOffset(0).numberOfBits(NUMBER_OF_BITS).oxmSrcHeader(OpenFlowOxms.NOVIFLOW_TX_TIMESTAMP).oxmDstHeader(OpenFlowOxms.NOVIFLOW_PACKET_OFFSET).build());
    actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_NOVIFLOW).vni(VNI).srcMacAddress(SRC_MAC_ADDRESS).dstMacAddress(DST_MAC_ADDRESS).srcIpv4Address(SRC_IPV4_ADDRESS).dstIpv4Address(DST_IPV4_ADDRESS).udpSrc(UDP_SRC).build());
    return actions;
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) MeterAction(org.openkilda.rulemanager.action.MeterAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) MeterAction(org.openkilda.rulemanager.action.MeterAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction)

Example 30 with PopVlanAction

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

the class SingleTableIngressRuleGeneratorTest method buildTransformActionsOneSwitchSingleVlanInFullPortOutTest.

@Test
public void buildTransformActionsOneSwitchSingleVlanInFullPortOutTest() {
    Flow flow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_1, 0);
    SingleTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildTransformActions(OUTER_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