use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.
the class OfInstructionsConverterTest method buildActions.
private static List<Action> buildActions() {
List<Action> actions = new ArrayList<>();
actions.add(new GroupAction(new GroupId(3)));
actions.add(new PortOutAction(new PortNumber(SpecialPortType.CONTROLLER)));
actions.add(new PopVlanAction());
actions.add(new PushVlanAction());
actions.add(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW));
actions.add(new PopVxlanAction(ActionType.POP_VXLAN_OVS));
actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_NOVIFLOW).srcMacAddress(buildMacAddress("00:00:00:00:00:0b")).dstMacAddress(buildMacAddress("00:00:00:00:00:16")).srcIpv4Address(buildIPv4Address("0.0.0.33")).dstIpv4Address(buildIPv4Address("0.0.0.44")).udpSrc(55).vni(66).build());
actions.add(PushVxlanAction.builder().type(ActionType.PUSH_VXLAN_OVS).srcMacAddress(buildMacAddress("00:00:00:00:00:6f")).dstMacAddress(buildMacAddress("00:00:00:00:00:de")).srcIpv4Address(buildIPv4Address("0.0.1.77")).dstIpv4Address(buildIPv4Address("0.0.1.188")).udpSrc(555).vni(666).build());
actions.add(SetFieldAction.builder().field(Field.UDP_DST).value(7).build());
actions.add(CopyFieldAction.builder().numberOfBits(1).srcOffset(2).dstOffset(3).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
actions.add(SwapFieldAction.builder().type(ActionType.NOVI_SWAP_FIELD).numberOfBits(11).srcOffset(22).dstOffset(33).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
actions.add(SwapFieldAction.builder().type(ActionType.KILDA_SWAP_FIELD).numberOfBits(111).srcOffset(222).dstOffset(333).oxmSrcHeader(OpenFlowOxms.ETH_SRC).oxmDstHeader(OpenFlowOxms.ETH_DST).build());
return actions;
}
use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGeneratorTest method buildCommandsVxlanEncapsulationSingleVlanTest.
@Test
public void buildCommandsVxlanEncapsulationSingleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1);
SingleTableServer42IngressRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_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(), FieldMatch.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_1).build());
List<Action> expectedIngressActions = newArrayList(new PopVlanAction(), COPY_FIELD_ACTION, buildPushVxlan(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
assertIngressCommand(ingressCommand, Priority.SERVER_42_INGRESS_SINGLE_VLAN_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions);
}
use of org.openkilda.rulemanager.action.PopVlanAction 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.PopVlanAction 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);
}
use of org.openkilda.rulemanager.action.PopVlanAction in project open-kilda by telstra.
the class MultiTableIngressRuleGeneratorTest method buildTransformActionsVxlanEncapsulationDoubleVlanTest.
@Test
public void buildTransformActionsVxlanEncapsulationDoubleVlanTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_ID_1, INNER_VLAN_ID_1);
MultiTableIngressRuleGenerator generator = buildGenerator(PATH, flow, VXLAN_ENCAPSULATION);
List<Action> transformActions = generator.buildTransformActions(INNER_VLAN_ID_1, FEATURES);
List<Action> expectedActions = newArrayList(new PopVlanAction(), buildPushVxlan());
assertEquals(expectedActions, transformActions);
}
Aggregations