use of org.openkilda.rulemanager.match.FieldMatch 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.match.FieldMatch in project open-kilda by telstra.
the class LldpPostIngressOneSwitchRuleGenerator 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(LLDP_POST_INGRESS_ONE_SWITCH_COOKIE);
return buildCommands(sw, cookie, OfTable.POST_INGRESS, Priority.LLDP_POST_INGRESS_ONE_SWITCH_PRIORITY, match, instructions);
}
use of org.openkilda.rulemanager.match.FieldMatch 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);
}
use of org.openkilda.rulemanager.match.FieldMatch in project open-kilda by telstra.
the class LldpTransitRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.LLDP).build());
Instructions instructions = buildSendToControllerInstructions();
Cookie cookie = new Cookie(LLDP_TRANSIT_COOKIE);
return buildCommands(sw, cookie, OfTable.TRANSIT, Priority.LLDP_TRANSIT_ISL_PRIORITY, match, instructions);
}
use of org.openkilda.rulemanager.match.FieldMatch in project open-kilda by telstra.
the class Server42IslRttInputRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
int udpOffset = config.getServer42IslRttUdpPortOffset();
Set<FieldMatch> match = buildMatch(server42Port, udpOffset + islPort, sw.getSwitchId());
long ethDst = new SwitchId(config.getServer42IslRttMagicMacAddress()).toLong();
List<Action> actions = Lists.newArrayList(SetFieldAction.builder().field(Field.UDP_SRC).value(SERVER_42_ISL_RTT_FORWARD_UDP_PORT).build(), SetFieldAction.builder().field(Field.ETH_DST).value(ethDst).build(), new PortOutAction(new PortNumber(islPort)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(encodeServer42IslRttInput(islPort))).table(OfTable.INPUT).priority(SERVER_42_ISL_RTT_INPUT_PRIORITY).match(match).instructions(instructions).build());
}
Aggregations