Search in sources :

Example 1 with PopVxlanAction

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

the class OfInstructionsConverterTest method buildActions.

private static List<Action> buildActions() {
    List<Action> actions = new ArrayList<>();
    actions.add(new GroupAction(new GroupId(3)));
    actions.add(new PortOutAction(new PortNumber(SpecialPortType.CONTROLLER)));
    actions.add(new PopVlanAction());
    actions.add(new PushVlanAction());
    actions.add(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW));
    actions.add(new PopVxlanAction(ActionType.POP_VXLAN_OVS));
    actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_NOVIFLOW).srcMacAddress(buildMacAddress("00:00:00:00:00:0b")).dstMacAddress(buildMacAddress("00:00:00:00:00:16")).srcIpv4Address(buildIPv4Address("0.0.0.33")).dstIpv4Address(buildIPv4Address("0.0.0.44")).udpSrc(55).vni(66).build());
    actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_OVS).srcMacAddress(buildMacAddress("00:00:00:00:00:6f")).dstMacAddress(buildMacAddress("00:00:00:00:00:de")).srcIpv4Address(buildIPv4Address("0.0.1.77")).dstIpv4Address(buildIPv4Address("0.0.1.188")).udpSrc(555).vni(666).build());
    actions.add(SetFieldAction.builder().field(Field.UDP_DST).value(7).build());
    actions.add(CopyFieldAction.builder().numberOfBits(1).srcOffset(2).dstOffset(3).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
    actions.add(SwapFieldAction.builder().type(ActionType.NOVI_SWAP_FIELD).numberOfBits(11).srcOffset(22).dstOffset(33).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
    actions.add(SwapFieldAction.builder().type(ActionType.KILDA_SWAP_FIELD).numberOfBits(111).srcOffset(222).dstOffset(333).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
    return actions;
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) SwapFieldAction(org.openkilda.rulemanager.action.SwapFieldAction) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) ArrayList(java.util.ArrayList) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) GroupId(org.openkilda.model.GroupId) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction)

Example 2 with PopVxlanAction

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

the class Server42FlowRttOutputVxlanRuleGeneratorTest method server42FlowRttOutputVxlanRuleGeneratorNoviflowTest.

@Test
public void server42FlowRttOutputVxlanRuleGeneratorNoviflowTest() {
    Switch sw = buildSwitch("OF_13", Sets.newHashSet(NOVIFLOW_COPY_FIELD, NOVIFLOW_PUSH_POP_VXLAN));
    testOutputRule(sw, new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW), true);
}
Also used : Utils.buildSwitch(org.openkilda.rulemanager.Utils.buildSwitch) Switch(org.openkilda.model.Switch) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) Test(org.junit.Test)

Example 3 with PopVxlanAction

use of org.openkilda.rulemanager.action.PopVxlanAction 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 4 with PopVxlanAction

use of org.openkilda.rulemanager.action.PopVxlanAction 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)

Example 5 with PopVxlanAction

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

the class EgressMirrorRuleGeneratorTest method buildVxlanMultiTableFullPortEgressMirrorRuleTest.

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

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