Search in sources :

Example 21 with SpeakerData

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

the class FlowLoopIngressRuleGeneratorTest method buildMultiTableSingleVlanRuleTest.

@Test
public void buildMultiTableSingleVlanRuleTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_1, 0, OUTER_VLAN_2, INNER_VLAN_2);
    List<SpeakerData> commands = buildGenerator(flow, true).generateCommands(SWITCH_1);
    assertIngressCommands(commands, OfTable.INGRESS, Priority.LOOP_FLOW_PRIORITY, newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), buildMetadataMatch(OUTER_VLAN_1)), newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_1).build(), new PortOutAction(new PortNumber(SpecialPortType.IN_PORT))));
}
Also used : PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 22 with SpeakerData

use of org.openkilda.rulemanager.SpeakerData 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 23 with SpeakerData

use of org.openkilda.rulemanager.SpeakerData 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 24 with SpeakerData

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

the class FlowLoopIngressRuleGeneratorTest method buildSingleTableDefaultFlowRuleTest.

@Test
public void buildSingleTableDefaultFlowRuleTest() {
    Flow flow = buildFlow(PATH, 0, 0, 0, 0);
    List<SpeakerData> commands = buildGenerator(flow, false).generateCommands(SWITCH_1);
    assertIngressCommands(commands, OfTable.INPUT, Priority.LOOP_DEFAULT_FLOW_PRIORITY, newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build()), newArrayList(new PortOutAction(new PortNumber(SpecialPortType.IN_PORT))));
}
Also used : PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 25 with SpeakerData

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

the class FlowLoopIngressRuleGeneratorTest method buildMultiTableDoubleVlanRuleTest.

@Test
public void buildMultiTableDoubleVlanRuleTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_1, INNER_VLAN_1, 0, 0);
    List<SpeakerData> commands = buildGenerator(flow, true).generateCommands(SWITCH_1);
    assertIngressCommands(commands, OfTable.INGRESS, Priority.LOOP_DOUBLE_VLAN_FLOW_PRIORITY, newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(INNER_VLAN_1).build(), buildMetadataMatch(OUTER_VLAN_1)), newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_1).build(), new PortOutAction(new PortNumber(SpecialPortType.IN_PORT))));
}
Also used : PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Aggregations

SpeakerData (org.openkilda.rulemanager.SpeakerData)119 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)115 Test (org.junit.Test)96 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)71 Action (org.openkilda.rulemanager.action.Action)65 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)60 Flow (org.openkilda.model.Flow)54 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)52 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)49 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)48 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)47 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)38 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)30 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)30 Instructions (org.openkilda.rulemanager.Instructions)28 FlowPath (org.openkilda.model.FlowPath)27 GroupAction (org.openkilda.rulemanager.action.GroupAction)22 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)21 Switch (org.openkilda.model.Switch)19 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)19