use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class Server42IslRttOutputRuleGenerator 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(ETH_SRC).value(sw.getSwitchId().toMacAddressAsLong()).build());
actions.add(SetFieldAction.builder().field(ETH_DST).value(server42MacAddress.toLong()).build());
actions.add(new PortOutAction(new PortNumber(server42Port)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
Set<FieldMatch> match = buildMatch(new MacAddress(config.getServer42IslRttMagicMacAddress()));
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_ISL_RTT_OUTPUT_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_ISL_RTT_OUTPUT_PRIORITY).match(match).instructions(instructions).build());
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class ArpPostIngressOneSwitchRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
RoutingMetadata metadata = makeMetadataMatch(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(ARP_POST_INGRESS_ONE_SWITCH_COOKIE);
return buildCommands(sw, cookie, OfTable.POST_INGRESS, Priority.ARP_POST_INGRESS_ONE_SWITCH_PRIORITY, match, instructions);
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class MultiTableServer42IngressRuleGenerator method buildServer42PreIngressCommand.
private FlowSpeakerData buildServer42PreIngressCommand(Switch sw, FlowEndpoint endpoint) {
FlowSharedSegmentCookie cookie = FlowSharedSegmentCookie.builder(SharedSegmentType.SERVER42_QINQ_OUTER_VLAN).portNumber(switchProperties.getServer42Port()).vlanId(endpoint.getOuterVlanId()).build();
RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(sw.getFeatures());
Instructions instructions = Instructions.builder().applyActions(Lists.newArrayList(new PopVlanAction())).writeMetadata(new OfMetadata(metadata.getValue(), metadata.getMask())).goToTable(OfTable.INGRESS).build();
FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(endpoint.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(cookie).table(OfTable.PRE_INGRESS).priority(SERVER_42_PRE_INGRESS_FLOW_PRIORITY).match(Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(switchProperties.getServer42Port()).build(), FieldMatch.builder().field(Field.VLAN_VID).value(endpoint.getOuterVlanId()).build())).instructions(instructions);
return builder.build();
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class IngressMirrorRuleGenerator method buildIngressInstructions.
private Instructions buildIngressInstructions(Switch sw, List<Action> actions) {
Instructions instructions = Instructions.builder().applyActions(actions).build();
addMeterToInstructions(flowPath.getMeterId(), sw, instructions);
return instructions;
}
use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.
the class ArpInputPreDropRuleGenerator 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_INPUT_PRE_DROP_COOKIE);
return buildCommands(sw, cookie, OfTable.INPUT, Priority.ARP_INPUT_PRE_DROP_PRIORITY, match, instructions);
}
Aggregations