Search in sources :

Example 41 with GroupAction

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

the class IngressMirrorRuleGeneratorTest method buildSingleTableIngressActionsVlanEncapsulationFullPortTest.

@Test
public void buildSingleTableIngressActionsVlanEncapsulationFullPortTest() {
    Flow flow = buildFlow(SINGLE_TABLE_PATH, 0, 0);
    IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_TABLE_PATH, flow, VLAN_ENCAPSULATION);
    List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
    List<Action> expectedActions = newArrayList(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) Test(org.junit.Test)

Example 42 with GroupAction

use of org.openkilda.rulemanager.action.GroupAction 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 43 with GroupAction

use of org.openkilda.rulemanager.action.GroupAction 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 44 with GroupAction

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

the class EgressMirrorRuleGeneratorTest method buildVlanMultiTableDoubleVlanEgressMirrorRuleTest.

@Test
public void buildVlanMultiTableDoubleVlanEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(true);
    Flow flow = buildFlow(path, OUTER_VLAN_ID, INNER_VLAN_ID);
    EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
    assertEquals(2, commands.size());
    FlowSpeakerData egressCommand = getCommand(FlowSpeakerData.class, commands);
    GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
    ArrayList<Action> expectedApplyActions = Lists.newArrayList(SetFieldAction.builder().field(Field.VLAN_VID).value(INNER_VLAN_ID).build(), new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID).build(), new GroupAction(GROUP_ID));
    assertEgressCommand(egressCommand, OfTable.EGRESS, VLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
    assertGroupCommand(groupCommand);
}
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) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) FlowPath(org.openkilda.model.FlowPath) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 45 with GroupAction

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

the class EgressMirrorRuleGeneratorTest method buildVxlanSingleTableOuterVlanEgressMirrorRuleTest.

@Test
public void buildVxlanSingleTableOuterVlanEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(false);
    Flow flow = buildFlow(path, OUTER_VLAN_ID, 0);
    EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VXLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
    assertEquals(2, commands.size());
    FlowSpeakerData egressCommand = getCommand(FlowSpeakerData.class, commands);
    GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
    ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW), new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID).build(), new GroupAction(GROUP_ID));
    assertEgressCommand(egressCommand, OfTable.INPUT, VXLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
    assertGroupCommand(groupCommand);
}
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) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) FlowPath(org.openkilda.model.FlowPath) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Aggregations

GroupAction (org.openkilda.rulemanager.action.GroupAction)49 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)48 Action (org.openkilda.rulemanager.action.Action)46 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)45 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)44 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)44 Test (org.junit.Test)41 Flow (org.openkilda.model.Flow)41 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)31 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)18 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)18 SpeakerData (org.openkilda.rulemanager.SpeakerData)18 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)16 FlowPath (org.openkilda.model.FlowPath)13 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)7 ArrayList (java.util.ArrayList)4 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)4 MeterAction (org.openkilda.rulemanager.action.MeterAction)3 CopyFieldAction (org.openkilda.rulemanager.action.noviflow.CopyFieldAction)3 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2