use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class SingleTableIngressRuleGeneratorTest method oneSwitchFlowFullPortRuleTest.
@Test
public void oneSwitchFlowFullPortRuleTest() {
Flow flow = buildFlow(ONE_SWITCH_PATH, 0, OUTER_VLAN_ID_2);
SingleTableIngressRuleGenerator generator = buildGenerator(ONE_SWITCH_PATH, flow, VLAN_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(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)));
assertIngressCommand(ingressCommand, Priority.DEFAULT_FLOW_PRIORITY, expectedIngressMatch, expectedIngressActions, null);
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class FlowLoopIngressRuleGeneratorTest method buildSingleTableDefaultFlowRuleTest.
@Test
public void buildSingleTableDefaultFlowRuleTest() {
Flow flow = buildFlow(PATH, 0, 0, 0, 0);
List<SpeakerData> commands = buildGenerator(flow, false).generateCommands(SWITCH_1);
assertIngressCommands(commands, OfTable.INPUT, Priority.LOOP_DEFAULT_FLOW_PRIORITY, newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build()), newArrayList(new PortOutAction(new PortNumber(SpecialPortType.IN_PORT))));
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class FlowLoopIngressRuleGeneratorTest method buildMultiTableDoubleVlanRuleTest.
@Test
public void buildMultiTableDoubleVlanRuleTest() {
Flow flow = buildFlow(PATH, OUTER_VLAN_1, INNER_VLAN_1, 0, 0);
List<SpeakerData> commands = buildGenerator(flow, true).generateCommands(SWITCH_1);
assertIngressCommands(commands, OfTable.INGRESS, Priority.LOOP_DOUBLE_VLAN_FLOW_PRIORITY, newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(PORT_NUMBER_1).build(), FieldMatch.builder().field(Field.VLAN_VID).value(INNER_VLAN_1).build(), buildMetadataMatch(OUTER_VLAN_1)), newArrayList(new PushVlanAction(), SetFieldAction.builder().field(Field.VLAN_VID).value(OUTER_VLAN_1).build(), new PortOutAction(new PortNumber(SpecialPortType.IN_PORT))));
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class ArpPostIngressVxlanRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
if (!(sw.getFeatures().contains(NOVIFLOW_PUSH_POP_VXLAN) || sw.getFeatures().contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN))) {
return Collections.emptyList();
}
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().arpFlag(true), sw);
Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.METADATA).value(metadata.getValue()).mask(metadata.getMask()).build(), FieldMatch.builder().field(Field.IP_PROTO).value(IpProto.UDP).build(), FieldMatch.builder().field(Field.UDP_SRC).value(ARP_VXLAN_UDP_SRC).build(), FieldMatch.builder().field(Field.UDP_DST).value(VXLAN_UDP_DST).build());
if (sw.getFeatures().contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
match.add(FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.IPv4).build());
}
List<Action> actions = new ArrayList<>();
if (sw.getFeatures().contains(NOVIFLOW_PUSH_POP_VXLAN)) {
actions.add(new PopVxlanAction(POP_VXLAN_NOVIFLOW));
} else {
actions.add(new PopVxlanAction(POP_VXLAN_OVS));
}
actions.add(new PortOutAction(new PortNumber(SpecialPortType.CONTROLLER)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
Cookie cookie = new Cookie(ARP_POST_INGRESS_VXLAN_COOKIE);
return buildCommands(sw, cookie, OfTable.POST_INGRESS, Priority.ARP_POST_INGRESS_VXLAN_PRIORITY, match, instructions);
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class LldpPostIngressVxlanRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
if (!(sw.getFeatures().contains(NOVIFLOW_PUSH_POP_VXLAN) || sw.getFeatures().contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN))) {
return Collections.emptyList();
}
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(true), sw);
Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.METADATA).value(metadata.getValue()).mask(metadata.getMask()).build(), FieldMatch.builder().field(Field.IP_PROTO).value(IpProto.UDP).build(), FieldMatch.builder().field(Field.UDP_SRC).value(STUB_VXLAN_UDP_SRC).build(), FieldMatch.builder().field(Field.UDP_DST).value(VXLAN_UDP_DST).build());
if (sw.getFeatures().contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
match.add(FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.IPv4).build());
}
List<Action> actions = new ArrayList<>();
if (sw.getFeatures().contains(NOVIFLOW_PUSH_POP_VXLAN)) {
actions.add(new PopVxlanAction(POP_VXLAN_NOVIFLOW));
} else {
actions.add(new PopVxlanAction(POP_VXLAN_OVS));
}
actions.add(new PortOutAction(new PortNumber(SpecialPortType.CONTROLLER)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
Cookie cookie = new Cookie(LLDP_POST_INGRESS_VXLAN_COOKIE);
return buildCommands(sw, cookie, OfTable.POST_INGRESS, Priority.LLDP_POST_INGRESS_VXLAN_PRIORITY, match, instructions);
}
Aggregations