use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildTransformActionsVlanEncapsulationFullPortTest.
@Test
public void buildTransformActionsVlanEncapsulationFullPortTest() {
Flow flow = buildFlow(PATH, 0);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(0, FEATURES);
List<Action> expectedActions = newArrayList(SetFieldAction.builder().field(Field.ETH_SRC).value(SWITCH_ID_1.toMacAddressAsLong()).build(), SetFieldAction.builder().field(Field.ETH_DST).value(SWITCH_ID_2.toMacAddressAsLong()).build(), SetFieldAction.builder().field(Field.UDP_SRC).value(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT).build(), SetFieldAction.builder().field(Field.UDP_DST).value(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT).build(), COPY_FIELD_ACTION, 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 MultiTableIngressRuleGeneratorTest method buildTransformActionsOneSwitchFullPortInSingleVlanOutTest.
@Test
public void buildTransformActionsOneSwitchFullPortInSingleVlanOutTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, 0, 0, OUTER_VLAN_ID_2, 0);
MultiTableIngressRuleGenerator 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 MultiTableIngressRuleGeneratorTest method buildTransformActionsVlanEncapsulationFullPortTest.
@Test
public void buildTransformActionsVlanEncapsulationFullPortTest() {
Flow flow = buildFlow(PATH, 0, 0);
MultiTableIngressRuleGenerator 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 MultiTableIngressRuleGeneratorTest method oneSwitchFlowFullPortRuleTest.
@Test
public void oneSwitchFlowFullPortRuleTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, 0, 0, OUTER_VLAN_ID_2, 0);
MultiTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
FlowSpeakerData inputCustomerCommand = (FlowSpeakerData) commands.get(1);
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)));
RoutingMetadata metadata = RoutingMetadata.builder().oneSwitchFlowFlag(true).build(SWITCH_1.getFeatures());
assertIngressCommand(ingressCommand, Priority.DEFAULT_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, null, mapMetadata(metadata));
assertInputCustomerCommand(inputCustomerCommand, new PortColourCookie(MULTI_TABLE_INGRESS_RULES, PORT_NUMBER_1), Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build()));
}
use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.
the class MultiTableIngressRuleGeneratorTest method buildTransformActionsOneSwitchDoubleVlanInDoubleVlanOutTest.
@Test
public void buildTransformActionsOneSwitchDoubleVlanInDoubleVlanOutTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1, OUTER_VLAN_ID_2, INNER_VLAN_ID_2);
MultiTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(INNER_VLAN_ID_1, FEATURES);
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());
assertEquals(expectedActions, transformActions);
}
Aggregations