Search in sources :

Example 96 with SpeakerData

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

the class MultiTableIngressYRuleGeneratorTest method buildCommandsWithoutMeter.

@Test
public void buildCommandsWithoutMeter() {
    Flow oneSwitchFlow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_2, 0);
    Set<FlowSideAdapter> overlapping = Sets.newHashSet(FlowSideAdapter.makeIngressAdapter(oneSwitchFlow, ONE_SWITCH_PATH));
    Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
    MultiTableIngressYRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION, overlapping, false);
    List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
    assertEquals(1, commands.size());
    FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
    assertEquals(newArrayList(SHARED_METER_UUID), new ArrayList<>(ingressCommand.getDependsOn()));
    RoutingMetadata ingressMetadata = RoutingMetadata.builder().outerVlanId(OUTER_VLAN_ID_1).build(SWITCH_1.getFeatures());
    Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(INNER_VLAN_ID_1).build(), FieldMatch.builder().field(Field.METADATA).value(ingressMetadata.getValue()).mask(ingressMetadata.getMask()).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.Y_FLOW_DOUBLE_VLAN_PRIORITY, expectedIngressMatch, expectedIngressActions, SHARED_METER_ID, 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) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata) Flow(org.openkilda.model.Flow) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) FlowSideAdapter(org.openkilda.adapter.FlowSideAdapter) 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 97 with SpeakerData

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

the class EgressMirrorRuleGeneratorTest method buildVlanMultiTableDoubleVlanEgressMirrorRuleTest.

@Test
public void buildVlanMultiTableDoubleVlanEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(true);
    Flow flow = buildFlow(path, OUTER_VLAN_ID, INNER_VLAN_ID);
    EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VLAN_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(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, VLAN_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) 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 98 with SpeakerData

use of org.openkilda.rulemanager.SpeakerData 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);
}
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 99 with SpeakerData

use of org.openkilda.rulemanager.SpeakerData 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);
}
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 100 with SpeakerData

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

the class EgressMirrorRuleGeneratorTest method buildVlanMultiTableOuterVlanEgressMirrorRuleTest.

@Test
public void buildVlanMultiTableOuterVlanEgressMirrorRuleTest() {
    FlowPath path = buildPathWithMirror(true);
    Flow flow = buildFlow(path, OUTER_VLAN_ID, 0);
    EgressMirrorRuleGenerator generator = buildGenerator(path, flow, VLAN_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(SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID).build(), new GroupAction(GROUP_ID));
    assertEgressCommand(egressCommand, OfTable.EGRESS, VLAN_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) 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

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