use of org.openkilda.rulemanager.ProtoConstants.PortNumber 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.ProtoConstants.PortNumber 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.ProtoConstants.PortNumber 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.ProtoConstants.PortNumber 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.ProtoConstants.PortNumber in project open-kilda by telstra.
the class MultiTableIngressRuleGeneratorTest method oneSwitchFlowFullPortRuleTest.
@Test
public void oneSwitchFlowFullPortRuleTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, 0, 0, OUTER_VLAN_ID_2, 0);
MultiTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_ENCAPSULATION);
List<SpeakerData> commands = generator.generateCommands(SWITCH_1);
assertEquals(2, commands.size());
FlowSpeakerData ingressCommand = (FlowSpeakerData) commands.get(0);
FlowSpeakerData inputCustomerCommand = (FlowSpeakerData) commands.get(1);
Set<FieldMatch> expectedIngressMatch = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build());
List<Action> expectedIngressActions = newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_ID_2).build(), new PortOutAction(new PortNumber(PORT_NUMBER_2)));
RoutingMetadata metadata = RoutingMetadata.builder().oneSwitchFlowFlag(true).build(SWITCH_1.getFeatures());
assertIngressCommand(ingressCommand, Priority.DEFAULT_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, null, mapMetadata(metadata));
assertInputCustomerCommand(inputCustomerCommand, new PortColourCookie(MULTI_TABLE_INGRESS_RULES, PORT_NUMBER_1), Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build()));
}
Aggregations