use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class MultiTableIngressRuleGeneratorTest method assertInputCustomerCommand.
private void assertInputCustomerCommand(FlowSpeakerData command, CookieBase cookie, Set<FieldMatch> expectedMatch) {
assertEquals(SWITCH_1.getSwitchId(), command.getSwitchId());
assertEquals(SWITCH_1.getOfVersion(), command.getOfVersion().toString());
assertEquals(cookie, command.getCookie());
assertEquals(OfTable.INPUT, command.getTable());
assertEquals(Priority.INGRESS_CUSTOMER_PORT_RULE_PRIORITY_MULTITABLE, command.getPriority());
assertTrue(command.getDependsOn().isEmpty());
assertEqualsMatch(expectedMatch, command.getMatch());
Instructions expectedInstructions = Instructions.builder().goToTable(OfTable.PRE_INGRESS).build();
assertEquals(expectedInstructions, command.getInstructions());
assertTrue(command.getFlags().isEmpty());
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class ArpTransitRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.ARP).build());
Instructions instructions = buildSendToControllerInstructions();
Cookie cookie = new Cookie(ARP_TRANSIT_COOKIE);
return buildCommands(sw, cookie, OfTable.TRANSIT, Priority.ARP_TRANSIT_ISL_PRIORITY, match, instructions);
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class EgressIslVxlanRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<SwitchFeature> features = sw.getFeatures();
if (!(features.contains(NOVIFLOW_PUSH_POP_VXLAN) || features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN))) {
return Collections.emptyList();
}
Set<FieldMatch> match = buildEgressIslVxlanRuleMatch(sw.getSwitchId());
Instructions instructions = Instructions.builder().goToTable(OfTable.EGRESS).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_EGRESS_RULES, islPort)).table(OfTable.INPUT).priority(ISL_EGRESS_VXLAN_RULE_PRIORITY_MULTITABLE).match(match).instructions(instructions).build());
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class LldpIngressRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
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());
Instructions instructions = buildSendToControllerInstructions();
Cookie cookie = new Cookie(LLDP_INGRESS_COOKIE);
return buildCommands(sw, cookie, OfTable.INGRESS, Priority.LLDP_INGRESS_PRIORITY, match, instructions);
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class Server42FlowRttOutputVlanRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
List<Action> actions = new ArrayList<>();
if (server42Vlan > 0) {
actions.add(new PushVlanAction());
actions.add(SetFieldAction.builder().field(Field.VLAN_VID).value(server42Vlan).build());
}
actions.add(SetFieldAction.builder().field(Field.ETH_SRC).value(sw.getSwitchId().toLong()).build());
actions.add(SetFieldAction.builder().field(Field.ETH_DST).value(server42MacAddress.toLong()).build());
if (sw.getFeatures().contains(NOVIFLOW_COPY_FIELD)) {
actions.add(buildCopyTimestamp());
}
actions.add(new PortOutAction(new PortNumber(server42Port)));
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_FLOW_RTT_OUTPUT_VLAN_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_OUTPUT_VLAN_PRIORITY).match(buildMatch(sw.getSwitchId())).instructions(instructions).build());
}
Aggregations