use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class ArpPostIngressVxlanRuleGeneratorTest 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());
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class UnicastVerificationVxlanRuleGeneratorTest method shouldBuildCorrectRuleWithoutMeterForOf13.
@Test
public void shouldBuildCorrectRuleWithoutMeterForOf13() {
sw = buildSwitch("OF_13", Sets.newHashSet(NOVIFLOW_PUSH_POP_VXLAN, PKTPS_FLAG));
List<SpeakerData> commands = generator.generateCommands(sw);
assertEquals(1, 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);
assertTrue(flowCommandData.getDependsOn().isEmpty());
// Check flow command
checkFlowCommandBaseProperties(flowCommandData);
checkMatch(flowCommandData.getMatch());
// Check instructions without meter
Instructions instructions = flowCommandData.getInstructions();
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 sendToControllerAction = (PortOutAction) second;
assertEquals(SpecialPortType.CONTROLLER, sendToControllerAction.getPortNumber().getPortType());
assertNull(instructions.getWriteActions());
assertNull(instructions.getGoToMeter());
assertNull(instructions.getGoToTable());
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildSingleTableIngressActionsVxlanEncapsulationFullPortTest.
@Test
public void buildSingleTableIngressActionsVxlanEncapsulationFullPortTest() {
Flow flow = buildFlow(SINGLE_TABLE_PATH, 0, 0);
IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_TABLE_PATH, flow, VXLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
List<Action> expectedActions = newArrayList(new GroupAction(GROUP_ID));
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildSingleTableIngressActionsVlanEncapsulationSingleVlanTest.
@Test
public void buildSingleTableIngressActionsVlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(SINGLE_TABLE_PATH, OUTER_VLAN_ID_1, 0);
IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_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);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildIngressActionsOneSwitchFullPortInFullPortOutTest.
@Test
public void buildIngressActionsOneSwitchFullPortInFullPortOutTest() {
Flow flow = buildFlow(MULTI_TABLE_ONE_SWITCH_PATH, 0, 0, 0, 0);
IngressMirrorRuleGenerator generator = buildGenerator(MULTI_TABLE_ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
List<Action> expectedActions = newArrayList(new GroupAction(GROUP_ID));
assertEquals(expectedActions, transformActions);
}
Aggregations