use of org.openkilda.rulemanager.action.PopVxlanAction in project open-kilda by telstra.
the class EgressRuleGeneratorTest method buildVxlanSingleTableOuterVlanEgressRuleTest.
@Test
public void buildVxlanSingleTableOuterVlanEgressRuleTest() {
FlowPath path = buildPath(false);
Flow flow = buildFlow(path, OUTER_VLAN_ID, 0);
EgressRuleGenerator generator = buildGenerator(path, flow, VXLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW), new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID).build(), new PortOutAction(new PortNumber(PORT_NUMBER_4)));
assertEgressCommands(commands, OfTable.INPUT, VXLAN_ENCAPSULATION, expectedApplyActions);
}
use of org.openkilda.rulemanager.action.PopVxlanAction in project open-kilda by telstra.
the class EgressRuleGenerator method buildTransformActions.
protected List<Action> buildTransformActions(FlowEndpoint egressEndpoint, Switch sw) {
List<Action> result = new ArrayList<>();
if (VXLAN.equals(encapsulation.getType())) {
if (sw.getFeatures().contains(NOVIFLOW_PUSH_POP_VXLAN)) {
result.add(new PopVxlanAction(ActionType.POP_VXLAN_NOVIFLOW));
} else if (sw.getFeatures().contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
result.add(new PopVxlanAction(ActionType.POP_VXLAN_OVS));
} else {
throw new IllegalArgumentException(format("Switch %s must support one of following features to pop " + "VXLAN: [%s, %s]", sw.getSwitchId(), NOVIFLOW_PUSH_POP_VXLAN, KILDA_OVS_PUSH_POP_MATCH_VXLAN));
}
}
List<Integer> targetVlanStack = egressEndpoint.getVlanStack();
List<Integer> currentVlanStack = new ArrayList<>();
if (TRANSIT_VLAN.equals(encapsulation.getType())) {
currentVlanStack.add(encapsulation.getId());
}
result.addAll(Utils.makeVlanReplaceActions(currentVlanStack, targetVlanStack));
return result;
}
Aggregations