use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildTransformActionsVlanEncapsulationFullPortCantCopyFieldTest.
@Test
public void buildTransformActionsVlanEncapsulationFullPortCantCopyFieldTest() {
Flow flow = buildFlow(PATH, 0);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(PATH, flow, VLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(0, new HashSet<>());
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(), new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(TRANSIT_VLAN_ID).build());
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildTransformActionsVxlanEncapsulationFullPortTest.
@Test
public void buildTransformActionsVxlanEncapsulationFullPortTest() {
Flow flow = buildFlow(PATH, 0);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(0, FEATURES);
List<Action> expectedActions = newArrayList(COPY_FIELD_ACTION, buildPushVxlan());
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildCommandsFullPortTransitVlanTest.
@Test
public void buildCommandsFullPortTransitVlanTest() {
Flow flow = buildFlow(PATH, 0);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(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(SERVER_42_PORT_NUMBER).build(), FieldMatch.builder().field(Field.ETH_SRC).value(SERVER_42_MAC_ADDRESS.toLong()).build(), FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.IPv4).build(), FieldMatch.builder().field(Field.IP_PROTO).value(IpProto.UDP).build(), FieldMatch.builder().field(Field.UDP_SRC).value(PORT_OFFSET + PORT_NUMBER_1).build());
List<Action> expectedIngressActions = 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(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
assertIngressCommand(ingressCommand, Priority.SERVER_42_INGRESS_DEFAULT_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildTransformActionsVxlanEncapsulationSingleVlanCantCopyFieldTest.
@Test
public void buildTransformActionsVxlanEncapsulationSingleVlanCantCopyFieldTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(OUTER_VLAN_ID_1, Sets.newHashSet(NOVIFLOW_PUSH_POP_VXLAN));
List<Action> expectedActions = newArrayList(new PopVlanAction(), buildPushVxlan());
assertEquals(expectedActions, transformActions);
}
use of org.openkilda.rulemanager.action.Action in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildTransformActionsVxlanEncapsulationSingleVlanTest.
@Test
public void buildTransformActionsVxlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(OUTER_VLAN_ID_1, FEATURES);
List<Action> expectedActions = newArrayList(new PopVlanAction(), COPY_FIELD_ACTION, buildPushVxlan());
assertEquals(expectedActions, transformActions);
}
Aggregations