Search in sources :

Example 26 with FlowSpeakerData

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

the class SingleTableIngressRuleGeneratorTest method buildCommandsVlanEncapsulationSingleVlanTest.

@Test
public void buildCommandsVlanEncapsulationSingleVlanTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
    SingleTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
    assertEquals(2, commands.size());
    FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
    MeterSpeakerData meterCommand = (MeterSpeakerData) commands.get(1);
    assertEquals(newArrayList(meterCommand.getUuid()), new ArrayList<>(ingressCommand.getDependsOn()));
    Set<FieldMatch> expectedIngressMatch = 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());
    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.FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, METER_ID);
    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) Flow(org.openkilda.model.Flow) 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 27 with FlowSpeakerData

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

the class SingleTableIngressRuleGeneratorTest method oneSwitchFlowFullPortRuleTest.

@Test
public void oneSwitchFlowFullPortRuleTest() {
    Flow flow = buildFlow(ONE_SWITCH_PATH, 0, OUTER_VLAN_ID_2);
    SingleTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
    assertEquals(1, commands.size());
    FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
    Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build());
    List<Action> expectedIngressActions = newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
    assertIngressCommand(ingressCommand, Priority.DEFAULT_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, null);
}
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) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 28 with FlowSpeakerData

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

the class EgressMirrorRuleGeneratorTest method buildVxlanMultiTableOuterVlanEgressMirrorRuleTest.

@Test
public void buildVxlanMultiTableOuterVlanEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(true);
    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.EGRESS, 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)

Example 29 with FlowSpeakerData

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

the class EgressMirrorRuleGeneratorTest method buildVlanSingleTableFullPortEgressMirrorRuleTest.

@Test
public void buildVlanSingleTableFullPortEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(false);
    Flow flow = buildFlow(path, 0, 0);
    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(new PopVlanAction(), new GroupAction(GROUP_ID));
    assertEgressCommand(egressCommand, OfTable.INPUT, 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) 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) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) Test(org.junit.Test)

Example 30 with FlowSpeakerData

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

the class EgressMirrorRuleGeneratorTest method buildVxlanSingleTableFullPortEgressMirrorRuleTest.

@Test
public void buildVxlanSingleTableFullPortEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(false);
    Flow flow = buildFlow(path, 0, 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 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) 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

FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)106 SpeakerData (org.openkilda.rulemanager.SpeakerData)88 Test (org.junit.Test)83 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)58 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)55 Action (org.openkilda.rulemanager.action.Action)54 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)49 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)42 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)38 Flow (org.openkilda.model.Flow)35 Instructions (org.openkilda.rulemanager.Instructions)35 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)35 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)35 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)33 GroupAction (org.openkilda.rulemanager.action.GroupAction)23 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)22 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)18 Cookie (org.openkilda.model.cookie.Cookie)15 FlowPath (org.openkilda.model.FlowPath)14 Switch (org.openkilda.model.Switch)14