use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class SingleTableIngressRuleGeneratorTest method oneSwitchFlowFullPortRuleTest.
@Test
public void oneSwitchFlowFullPortRuleTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, 0, OUTER_VLAN_ID_2);
SingleTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(1, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build());
List<Action> expectedIngressActions = newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
assertIngressCommand(ingressCommand, Priority.DEFAULT_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, null);
}
use of org.openkilda.rulemanager.action.Action 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);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVlanSingleTableFullPortEgressMirrorRuleTest.
@Test
public void buildVlanSingleTableFullPortEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(false);
Flow flow = buildFlow(path, 0, 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(new PopVlanAction(), new GroupAction(GROUP_ID));
assertEgressCommand(egressCommand, OfTable.INPUT, VLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
use of org.openkilda.rulemanager.action.Action 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);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method buildVlanMultiTableOuterVlanEqualsTransitEgressMirrorRuleTest.
@Test
public void buildVlanMultiTableOuterVlanEqualsTransitEgressMirrorRuleTest() {
FlowPath path = buildPathWithMirror(true);
Flow flow = buildFlow(path, VLAN_ENCAPSULATION.getId(), 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(new GroupAction(GROUP_ID));
assertEgressCommand(egressCommand, OfTable.EGRESS, VLAN_ENCAPSULATION, expectedApplyActions, groupCommand.getUuid());
assertGroupCommand(groupCommand);
}
Aggregations