use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class Server42IslRttTurningRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<FieldMatch> match = buildMatch(new MacAddress(config.getServer42IslRttMagicMacAddress()));
List<Action> actions = new ArrayList<>();
actions.add(SetFieldAction.builder().field(UDP_SRC).value(SERVER_42_ISL_RTT_REVERSE_UDP_PORT).build());
actions.add(new PortOutAction(new PortNumber(SpecialPortType.IN_PORT)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_ISL_RTT_TURNING_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_ISL_RTT_TURNING_PRIORITY).match(match).instructions(instructions).build());
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class EgressRuleGeneratorTest method buildVlanSingleTableFullPortEgressRuleTest.
@Test
public void buildVlanSingleTableFullPortEgressRuleTest() {
FlowPath path = buildPath(false);
Flow flow = buildFlow(path, 0, 0);
EgressRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PopVlanAction(), new PortOutAction(new PortNumber(PORT_NUMBER_4)));
assertEgressCommands(commands, OfTable.INPUT, VLAN_ENCAPSULATION, expectedApplyActions);
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class EgressRuleGeneratorTest method buildVlanSingleTableOuterVlanEqualsTransitVlanEgressRuleTest.
@Test
public void buildVlanSingleTableOuterVlanEqualsTransitVlanEgressRuleTest() {
FlowPath path = buildPath(false);
Flow flow = buildFlow(path, VLAN_ENCAPSULATION.getId(), 0);
EgressRuleGenerator generator = buildGenerator(path, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_2);
ArrayList<Action> expectedApplyActions = Lists.newArrayList(new PortOutAction(new PortNumber(PORT_NUMBER_4)));
assertEgressCommands(commands, OfTable.INPUT, VLAN_ENCAPSULATION, expectedApplyActions);
}
use of org.openkilda.rulemanager.action.PortOutAction 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.PortOutAction in project open-kilda by telstra.
the class ConnectedDevicesRuleGeneratorTest method checkInstructions.
protected void checkInstructions(Instructions instructions, MeterId meterId) {
assertEquals(1, instructions.getApplyActions().size());
Action action = instructions.getApplyActions().get(0);
assertTrue(action instanceof PortOutAction);
PortOutAction portOutAction = (PortOutAction) action;
assertEquals(SpecialPortType.CONTROLLER, portOutAction.getPortNumber().getPortType());
assertNull(instructions.getWriteActions());
assertEquals(instructions.getGoToMeter(), meterId);
assertNull(instructions.getGoToTable());
}
Aggregations