use of org.openkilda.rulemanager.action.PopVxlanAction 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;
}
use of org.openkilda.rulemanager.action.PopVxlanAction in project open-kilda by telstra.
the class UnicastVerificationVxlanRuleGeneratorTest method shouldBuildCorrectRuleWithMeterForOf13WithOvsVxlan.
@Test
public void shouldBuildCorrectRuleWithMeterForOf13WithOvsVxlan() {
sw = buildSwitch("OF_13", Sets.newHashSet(KILDA_OVS_PUSH_POP_MATCH_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());
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_OVS, 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());
assertEquals(instructions.getGoToMeter(), meterCommandData.getMeterId());
assertNull(instructions.getGoToTable());
// Check meter command
checkMeterCommand(meterCommandData);
}
use of org.openkilda.rulemanager.action.PopVxlanAction in project open-kilda by telstra.
the class UnicastVerificationVxlanRuleGeneratorTest method checkInstructions.
private void checkInstructions(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 sendToControllerAction = (PortOutAction) second;
assertEquals(SpecialPortType.CONTROLLER, sendToControllerAction.getPortNumber().getPortType());
assertNull(instructions.getWriteActions());
assertEquals(instructions.getGoToMeter(), meterId);
assertNull(instructions.getGoToTable());
}
use of org.openkilda.rulemanager.action.PopVxlanAction 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);
}
use of org.openkilda.rulemanager.action.PopVxlanAction in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVxlanMultiTableOuterInnerVlanEgressMirrorRuleTest.
@Test
public void buildVxlanMultiTableOuterInnerVlanEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(true);
Flow flow = buildFlow(path, OUTER_VLAN_ID, INNER_VLAN_ID);
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(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, VXLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
Aggregations