use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class MultiTableIngressYRuleGeneratorTest method buildTransformActionsVlanEncapsulationSingleVlanTest.
@Test
public void buildTransformActionsVlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
MultiTableIngressYRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(0, FEATURES);
List<Action> expectedActions = newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(TRANSIT_VLAN_ID).build());
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class MultiTableIngressYRuleGeneratorTest method buildTransformActionsOneSwitchSingleVlanInSingleVlanOutTest.
@Test
public void buildTransformActionsOneSwitchSingleVlanInSingleVlanOutTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_1, 0, OUTER_VLAN_ID_2, 0);
MultiTableIngressYRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(0, FEATURES);
List<Action> expectedActions = newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build());
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class EgressMirrorRuleGeneratorTest method assertGroupCommand.
private void assertGroupCommand(GroupSpeakerData command) {
assertEquals(GROUP_ID, command.getGroupId());
assertEquals(SWITCH_2.getSwitchId(), command.getSwitchId());
assertEquals(SWITCH_2.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(newHashSet(new PortOutAction(new PortNumber(PORT_NUMBER_4))), 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 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);
}
use of org.openkilda.rulemanager.action.PushVlanAction 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);
}
Aggregations