use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildSingleTableCommandsVlanEncapsulationSingleVlanTest.
@Test
public void buildSingleTableCommandsVlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(SINGLE_TABLE_PATH, OUTER_VLAN_ID_1, 0);
IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_TABLE_PATH, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = getCommand(FlowSpeakerData.class, commands);
GroupSpeakerData groupCommand = getCommand(GroupSpeakerData.class, commands);
Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_1).build());
List<Action> expectedIngressActions = newArrayList(new PopVlanAction(), new GroupAction(GROUP_ID));
assertIngressCommand(ingressCommand, Priority.MIRROR_FLOW_PRIORITY, INPUT, expectedIngressMatch, expectedIngressActions, METER_ID, groupCommand.getUuid());
Set<Action> expectedFlowBucketActions = newHashSet(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(TRANSIT_VLAN_ID).build(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
assertGroupCommand(groupCommand, expectedFlowBucketActions);
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildIngressActionsOneSwitchFullPortInSingleVlanOutTest.
@Test
public void buildIngressActionsOneSwitchFullPortInSingleVlanOutTest() {
Flow flow = buildFlow(MULTI_TABLE_ONE_SWITCH_PATH, 0, 0, OUTER_VLAN_ID_2, 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 PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build(), new GroupAction(GROUP_ID));
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method assertGroupCommand.
private void assertGroupCommand(GroupSpeakerData command, Set<Action> flowActions) {
assertEquals(GROUP_ID, command.getGroupId());
assertEquals(SWITCH_1.getSwitchId(), command.getSwitchId());
assertEquals(SWITCH_1.getOfVersion(), command.getOfVersion().toString());
assertEquals(GroupType.ALL, command.getType());
assertTrue(command.getDependsOn().isEmpty());
assertEquals(2, command.getBuckets().size());
Bucket flowBucket = command.getBuckets().get(0);
assertBucketCommon(flowBucket);
assertEquals(flowActions, flowBucket.getWriteActions());
Bucket mirrorBucket = command.getBuckets().get(1);
assertBucketCommon(mirrorBucket);
assertEquals(newHashSet(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(MIRROR_VLAN).build(), new PortOutAction(new PortNumber(MIRROR_PORT))), mirrorBucket.getWriteActions());
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildSingleTableIngressActionsOneSwitchFullPortInSingleVlanOutTest.
@Test
public void buildSingleTableIngressActionsOneSwitchFullPortInSingleVlanOutTest() {
Flow flow = buildFlow(SINGLE_TABLE_ONE_SWITCH_PATH, 0, 0, OUTER_VLAN_ID_2, 0);
IngressMirrorRuleGenerator generator = buildGenerator(SINGLE_TABLE_ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
List<Action> expectedActions = newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build(), new GroupAction(GROUP_ID));
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class IngressMirrorRuleGeneratorTest method buildIngressActionsOneSwitchDoubleVlanInDoubleVlanOutTest.
@Test
public void buildIngressActionsOneSwitchDoubleVlanInDoubleVlanOutTest() {
Flow flow = buildFlow(MULTI_TABLE_ONE_SWITCH_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1, OUTER_VLAN_ID_2, INNER_VLAN_ID_2);
IngressMirrorRuleGenerator generator = buildGenerator(MULTI_TABLE_ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildIngressActions(getEndpoint(flow), GROUP_ID);
List<Action> expectedActions = newArrayList(SetFieldAction.builder().field(Field.VLAN_VID).value(INNER_VLAN_ID_2).build(), new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build(), new GroupAction(GROUP_ID));
assertEquals(expectedActions, transformActions);
}
Aggregations