Search in sources :

Example 11 with Action

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);
}
Also used : CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 12 with Action

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);
}
Also used : CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 13 with Action

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);
}
Also used : CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 14 with Action

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);
}
Also used : CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) Test(org.junit.Test)

Example 15 with Action

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);
}
Also used : CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) Flow(org.openkilda.model.Flow) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) Test(org.junit.Test)

Aggregations

Action (org.openkilda.rulemanager.action.Action)196 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)195 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)168 Test (org.junit.Test)151 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)149 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)146 Flow (org.openkilda.model.Flow)136 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)117 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)67 SpeakerData (org.openkilda.rulemanager.SpeakerData)67 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)59 GroupAction (org.openkilda.rulemanager.action.GroupAction)55 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)47 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)46 Instructions (org.openkilda.rulemanager.Instructions)34 ArrayList (java.util.ArrayList)29 FlowPath (org.openkilda.model.FlowPath)27 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)23 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)21 CopyFieldAction (org.openkilda.rulemanager.action.noviflow.CopyFieldAction)20