Search in sources :

Example 16 with PopVxlanAction

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

the class UnicastVerificationVxlanRuleGeneratorTest method shouldBuildCorrectRuleWithMeterForOf15.

@Test
public void shouldBuildCorrectRuleWithMeterForOf15() {
    sw = buildSwitch("OF_15", Sets.newHashSet(NOVIFLOW_PUSH_POP_VXLAN, METERS, PKTPS_FLAG));
    List<SpeakerData> commands = generator.generateCommands(sw);
    assertEquals(2, commands.size());
    commands.forEach(c -> assertEquals(sw.getSwitchId(), c.getSwitchId()));
    commands.forEach(c -> assertEquals(sw.getOfVersion(), c.getOfVersion().toString()));
    FlowSpeakerData flowCommandData = getCommand(FlowSpeakerData.class, commands);
    MeterSpeakerData meterCommandData = getCommand(MeterSpeakerData.class, commands);
    assertEquals(1, flowCommandData.getDependsOn().size());
    assertTrue(flowCommandData.getDependsOn().contains(meterCommandData.getUuid()));
    // Check flow command
    checkFlowCommandBaseProperties(flowCommandData);
    checkMatch(flowCommandData.getMatch());
    // Check flow command has correct instructions for OF 1.5
    Instructions instructions = flowCommandData.getInstructions();
    assertEquals(4, instructions.getApplyActions().size());
    Action first = instructions.getApplyActions().get(0);
    assertTrue(first instanceof PopVxlanAction);
    PopVxlanAction popVxlanAction = (PopVxlanAction) first;
    assertEquals(ActionType.POP_VXLAN_NOVIFLOW, popVxlanAction.getType());
    Action second = instructions.getApplyActions().get(1);
    assertTrue(second instanceof PortOutAction);
    PortOutAction sendToControllerAction = (PortOutAction) second;
    assertEquals(SpecialPortType.CONTROLLER, sendToControllerAction.getPortNumber().getPortType());
    Action third = instructions.getApplyActions().get(3);
    assertTrue(third instanceof MeterAction);
    MeterAction meterAction = (MeterAction) third;
    assertEquals(meterCommandData.getMeterId(), meterAction.getMeterId());
    assertNull(instructions.getWriteActions());
    assertNull(instructions.getGoToMeter());
    assertNull(instructions.getGoToTable());
    // Check meter command
    checkMeterCommand(meterCommandData);
}
Also used : MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) MeterAction(org.openkilda.rulemanager.action.MeterAction) Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) MeterAction(org.openkilda.rulemanager.action.MeterAction) Instructions(org.openkilda.rulemanager.Instructions) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Test(org.junit.Test)

Example 17 with PopVxlanAction

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

the class ArpPostIngressVxlanRuleGeneratorTest method checkInstructions.

@Override
protected void checkInstructions(Instructions instructions, MeterId meterId) {
    assertEquals(2, instructions.getApplyActions().size());
    Action first = instructions.getApplyActions().get(0);
    assertTrue(first instanceof PopVxlanAction);
    PopVxlanAction popVxlanAction = (PopVxlanAction) first;
    assertEquals(ActionType.POP_VXLAN_NOVIFLOW, popVxlanAction.getType());
    Action second = instructions.getApplyActions().get(1);
    assertTrue(second instanceof PortOutAction);
    PortOutAction portOutAction = (PortOutAction) second;
    assertEquals(SpecialPortType.CONTROLLER, portOutAction.getPortNumber().getPortType());
    assertNull(instructions.getWriteActions());
    assertEquals(instructions.getGoToMeter(), meterId);
    assertNull(instructions.getGoToTable());
}
Also used : MeterAction(org.openkilda.rulemanager.action.MeterAction) Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction)

Example 18 with PopVxlanAction

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

the class LldpPostIngressVxlanRuleGeneratorTest method checkInstructions.

@Override
protected void checkInstructions(Instructions instructions, MeterId meterId) {
    assertEquals(2, instructions.getApplyActions().size());
    Action first = instructions.getApplyActions().get(0);
    assertTrue(first instanceof PopVxlanAction);
    PopVxlanAction popVxlanAction = (PopVxlanAction) first;
    assertEquals(ActionType.POP_VXLAN_NOVIFLOW, popVxlanAction.getType());
    Action second = instructions.getApplyActions().get(1);
    assertTrue(second instanceof PortOutAction);
    PortOutAction portOutAction = (PortOutAction) second;
    assertEquals(SpecialPortType.CONTROLLER, portOutAction.getPortNumber().getPortType());
    assertNull(instructions.getWriteActions());
    assertEquals(instructions.getGoToMeter(), meterId);
    assertNull(instructions.getGoToTable());
}
Also used : MeterAction(org.openkilda.rulemanager.action.MeterAction) Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction)

Example 19 with PopVxlanAction

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

the class LldpPostIngressVxlanRuleGeneratorTest method checkInstructionsOf15.

@Override
protected void checkInstructionsOf15(Instructions instructions, MeterId meterId) {
    assertEquals(3, instructions.getApplyActions().size());
    Action first = instructions.getApplyActions().get(0);
    assertTrue(first instanceof PopVxlanAction);
    PopVxlanAction popVxlanAction = (PopVxlanAction) first;
    assertEquals(ActionType.POP_VXLAN_NOVIFLOW, popVxlanAction.getType());
    Action second = instructions.getApplyActions().get(1);
    assertTrue(second instanceof PortOutAction);
    PortOutAction portOutAction = (PortOutAction) second;
    assertEquals(SpecialPortType.CONTROLLER, portOutAction.getPortNumber().getPortType());
    Action third = instructions.getApplyActions().get(2);
    assertTrue(third instanceof MeterAction);
    MeterAction meterAction = (MeterAction) third;
    assertEquals(meterId, meterAction.getMeterId());
    assertNull(instructions.getWriteActions());
    assertNull(instructions.getGoToMeter());
    assertNull(instructions.getGoToTable());
}
Also used : MeterAction(org.openkilda.rulemanager.action.MeterAction) Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) MeterAction(org.openkilda.rulemanager.action.MeterAction)

Example 20 with PopVxlanAction

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

the class Server42FlowRttOutputVxlanRuleGeneratorTest method server42FlowRttOutputVxlanRuleGeneratorOvsTest.

@Test
public void server42FlowRttOutputVxlanRuleGeneratorOvsTest() {
    Switch sw = buildSwitch("OF_13", Sets.newHashSet(KILDA_OVS_PUSH_POP_MATCH_VXLAN));
    testOutputRule(sw, new PopVxlanAction(ActionType.POP_VXLAN_OVS), false);
}
Also used : Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) Switch(org.openkilda.model.Switch) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) Test(org.junit.Test)

Aggregations

PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)27 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)25 Action (org.openkilda.rulemanager.action.Action)24 Test (org.junit.Test)15 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)13 SpeakerData (org.openkilda.rulemanager.SpeakerData)13 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)13 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)13 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)13 Flow (org.openkilda.model.Flow)10 FlowPath (org.openkilda.model.FlowPath)10 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)10 MeterAction (org.openkilda.rulemanager.action.MeterAction)10 GroupAction (org.openkilda.rulemanager.action.GroupAction)8 ArrayList (java.util.ArrayList)6 Instructions (org.openkilda.rulemanager.Instructions)6 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)5 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)3 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)3 GroupId (org.openkilda.model.GroupId)2