Search in sources :

Example 31 with PushVlanAction

use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.

the class IngressMirrorRuleGeneratorTest method buildIngressActionsOneSwitchSingleVlanInSingleVlanOutTest.

@Test
public void buildIngressActionsOneSwitchSingleVlanInSingleVlanOutTest() {
    Flow flow = buildFlow(MULTI_TABLE_ONE_SWITCH_PATH, OUTER_VLAN_ID_1, 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);
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) 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 32 with PushVlanAction

use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.

the class RuleManagerHelperTest method buildAllActions.

private List<Action> buildAllActions() {
    List<Action> actions = new ArrayList<>();
    actions.add(new GroupAction(GROUP_ID_1));
    actions.add(new MeterAction(METER_ID_1));
    actions.add(new PopVlanAction());
    actions.add(new PopVxlanAction(ActionType.POP_VXLAN_OVS));
    actions.add(new PortOutAction(PORT_NUMBER));
    actions.add(new PushVlanAction());
    actions.add(SetFieldAction.builder().field(Field.VLAN_VID).value(VLAN_ID).build());
    actions.add(CopyFieldAction.builder().srcOffset(0).dstOffset(0).numberOfBits(NUMBER_OF_BITS).oxmSrcHeader(OpenFlowOxms.NOVIFLOW_TX_TIMESTAMP).oxmDstHeader(OpenFlowOxms.NOVIFLOW_PACKET_OFFSET).build());
    actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_NOVIFLOW).vni(VNI).srcMacAddress(SRC_MAC_ADDRESS).dstMacAddress(DST_MAC_ADDRESS).srcIpv4Address(SRC_IPV4_ADDRESS).dstIpv4Address(DST_IPV4_ADDRESS).udpSrc(UDP_SRC).build());
    return actions;
}
Also used : GroupAction(org.openkilda.rulemanager.action.GroupAction) MeterAction(org.openkilda.rulemanager.action.MeterAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) 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) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) MeterAction(org.openkilda.rulemanager.action.MeterAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction)

Example 33 with PushVlanAction

use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.

the class SingleTableIngressRuleGeneratorTest method buildTransformActionsVlanEncapsulationFullPortTest.

@Test
public void buildTransformActionsVlanEncapsulationFullPortTest() {
    Flow flow = buildFlow(PATH, 0, 0);
    SingleTableIngressRuleGenerator 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);
}
Also used : 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 34 with PushVlanAction

use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.

the class SingleTableIngressRuleGeneratorTest method buildTransformActionsOneSwitchFullPortInSingleVlanOutTest.

@Test
public void buildTransformActionsOneSwitchFullPortInSingleVlanOutTest() {
    Flow flow = buildFlow(ONE_SWITCH_PATH, 0, OUTER_VLAN_ID_2);
    SingleTableIngressRuleGenerator 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);
}
Also used : 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 35 with PushVlanAction

use of org.openkilda.rulemanager.action.PushVlanAction in project open-kilda by telstra.

the class MultiTableServer42IngressRuleGeneratorTest method buildTransformActionsVlanEncapsulationSingleVlanTest.

@Test
public void buildTransformActionsVlanEncapsulationSingleVlanTest() {
    Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, 0);
    MultiTableServer42IngressRuleGenerator 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(), new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(TRANSIT_VLAN_ID).build());
    assertEquals(expectedActions, transformActions);
}
Also used : 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)

Aggregations

PortOutAction (org.openkilda.rulemanager.action.PortOutAction)58 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)58 Action (org.openkilda.rulemanager.action.Action)53 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)53 Test (org.junit.Test)48 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)48 Flow (org.openkilda.model.Flow)46 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)37 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)23 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)21 SpeakerData (org.openkilda.rulemanager.SpeakerData)21 GroupAction (org.openkilda.rulemanager.action.GroupAction)16 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)15 FlowPath (org.openkilda.model.FlowPath)10 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)10 CopyFieldAction (org.openkilda.rulemanager.action.noviflow.CopyFieldAction)9 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)7 ArrayList (java.util.ArrayList)6 Cookie (org.openkilda.model.cookie.Cookie)6 Instructions (org.openkilda.rulemanager.Instructions)6