if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4) { filteredSelectorBuilder = filteredSelectorBuilder .matchEthType(Ethernet.TYPE_IPV4) .matchIPDst(((IPCriterion) selector .getCriterion(Criterion.Type.IPV4_DST)) .ip()); } else { filteredSelectorBuilder = filteredSelectorBuilder .matchEthType(Ethernet.MPLS_UNICAST) .matchMplsLabel(((MplsCriterion) selector.getCriterion(Criterion.Type.MPLS_LABEL)).label()); if (selector.getCriterion(Criterion.Type.MPLS_BOS) != null) { filteredSelectorBuilder.matchMplsBos(((MplsBosCriterion) selector.getCriterion(Type.MPLS_BOS)).mplsBos()); TrafficSelector filteredSelector = filteredSelectorBuilder.build(); TrafficTreatment treatment = treatmentBuilder.transition(aclTableId) .build();
srcIpPrefix = IpPrefix.valueOf(srcIpString); if (srcIpPrefix.isIp4()) { selectorBuilder.matchIPSrc(srcIpPrefix); } else { selectorBuilder.matchIPv6Src(srcIpPrefix); dstIpPrefix = IpPrefix.valueOf(dstIpString); if (dstIpPrefix.isIp4()) { selectorBuilder.matchIPDst(dstIpPrefix); } else { selectorBuilder.matchIPv6Dst(dstIpPrefix); selectorBuilder.matchEthType(ethType); selectorBuilder.matchVlanId(VlanId.vlanId(Short.parseShort(vlanString))); selectorBuilder.matchEthSrc(MacAddress.valueOf(srcMacString)); selectorBuilder.matchEthDst(MacAddress.valueOf(dstMacString)); selectorBuilder.matchIPProtocol((byte) ipProtoShort); selectorBuilder.matchIPv6FlowLabel(Integer.parseInt(fLabelString)); selectorBuilder.matchIcmpv6Type(icmp6Type); selectorBuilder.matchIcmpv6Code(icmp6Code); selectorBuilder.matchIPv6NDTargetAddress(Ip6Address.valueOf(ndTargetString));
switch (field.id) { case IN_PORT: builder.matchInPort(PortNumber .portNumber(match.get(MatchField.IN_PORT).getPortNumber())); break; case IN_PHY_PORT: builder.matchInPhyPort(PortNumber .portNumber(match.get(MatchField.IN_PHY_PORT).getPortNumber())); break; long metadata = match.get(MatchField.METADATA).getValue().getValue(); builder.matchMetadata(metadata); break; case ETH_DST: Masked<org.projectfloodlight.openflow.types.MacAddress> maskedMac = match.getMasked(MatchField.ETH_DST); builder.matchEthDstMasked(MacAddress.valueOf(maskedMac.getValue().getLong()), MacAddress.valueOf(maskedMac.getMask().getLong())); } else { mac = MacAddress.valueOf(match.get(MatchField.ETH_DST).getLong()); builder.matchEthDst(mac); Masked<org.projectfloodlight.openflow.types.MacAddress> maskedMac = match.getMasked(MatchField.ETH_SRC); builder.matchEthSrcMasked(MacAddress.valueOf(maskedMac.getValue().getLong()), MacAddress.valueOf(maskedMac.getMask().getLong())); } else {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); selector.matchEthDst(e.mac()); selector.matchEthType(Ethernet.TYPE_IPV4); treatment.transition(MAC_TABLE); FlowRule rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(FILTER_TABLE_TMAC_PRIORITY) selector = DefaultTrafficSelector.builder(); treatment = DefaultTrafficTreatment.builder(); selector.matchEthDst(e.mac()); selector.matchMetadata(DEFAULT_METADATA); treatment.transition(ROUTE_TABLE); rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(MAC_TABLE_PRIORITY) TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); selector.matchVlanId(v.vlanId()); selector.matchInPort(p.port());
filteredSelectorBuilder.matchEthDst(ethCriterion.mac()); log.debug("processing L2 forwarding objective:{} -> next:{} in dev:{}", fwd.id(), fwd.nextId(), deviceId); filteredSelectorBuilder.extension(ofdpaMatchVlanVid, deviceId); TrafficSelector filteredSelector = filteredSelectorBuilder.build();
selector.matchInPort(pnum); selector.extension(ofdpaMatchVlanVid, deviceId); selector.matchEthType(Ethernet.TYPE_IPV4); selector.matchEthDst(ethCriterion.mac()); treatment.transition(UNICAST_ROUTING_TABLE); FlowRule rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(DEFAULT_PRIORITY) selector.matchInPort(pnum); selector.extension(ofdpaMatchVlanVid, deviceId); selector.matchEthType(Ethernet.MPLS_UNICAST); selector.matchEthDst(ethCriterion.mac()); treatment.transition(MPLS_TABLE_0); rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(DEFAULT_PRIORITY)
selectorBuilder.matchInPort(intent.dst().port()); .withSelector(selectorBuilder.build()) .withTreatment(treatmentBuilder.build()) .withPriority(intent.priority()) .withSelector(selectorBuilder.build()) .withTreatment(treatmentBuilder.build()) .withPriority(intent.priority()) selectorBuilder.matchInPort(link.src().port()); if (!isTransparent(current.deviceId())) { selectorBuilder.add(Criteria.matchLambda(intent.lambda())); selectorBuilder.add(Criteria.matchOchSignalType(intent.signalType())); .withSelector(selectorBuilder.build()) .withTreatment(treatmentLast.build()) .withPriority(intent.priority())
selector.matchInPort(pnum); selector.matchVlanId(vidCriterion.vlanId()); selector.matchEthType(Ethernet.TYPE_IPV4); selector.matchEthDst(ethCriterion.mac()); FlowRule rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(DEFAULT_PRIORITY) selector.matchInPort(pnum); selector.matchVlanId(vidCriterion.vlanId()); selector.matchEthType(Ethernet.MPLS_UNICAST); selector.matchEthDst(ethCriterion.mac()); rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(DEFAULT_PRIORITY)
selectorBuilder.matchInPort(intent.src().port()); .withSelector(selectorBuilder.build()) .withTreatment(treatmentBuilder.build()) .withPriority(intent.priority()) .withSelector(selectorBuilder.build()) .withTreatment(treatmentBuilder.build()) .withPriority(intent.priority()) selectorBuilder.matchInPort(link.dst().port()); if (!isTransparent(current.deviceId())) { selectorBuilder.add(Criteria.matchLambda(intent.lambda())); selectorBuilder.add(Criteria.matchOchSignalType(intent.signalType())); .withSelector(selectorBuilder.build()) .withTreatment(treatmentLast.build()) .withPriority(intent.priority())
switch (ipInstr.subtype()) { case IPV4_SRC: builder.matchIPSrc(prefix); break; builder.matchIPSrc(prefix); break; builder.matchIPv6Src(prefix); break; builder.matchIPv6Dst(prefix); break; builder.matchIPv6FlowLabel(ipFlowInstr.flowLabel()); break; ModArpIPInstruction arpIpInstr = (ModArpIPInstruction) l3instruction; if (arpIpInstr.ip().isIp4()) { builder.matchArpSpa((Ip4Address) arpIpInstr.ip()); } else { throw new IntentCompilationException(UNSUPPORTED_ARP); builder.matchArpSha(arpEthInstr.mac()); break; builder.matchArpOp((int) arpOpInstr.op()); break;
switch (ethInstr.subtype()) { case ETH_SRC: builder.matchEthSrc(ethInstr.mac()); break; builder.matchEthDst(ethInstr.mac()); break; builder.matchVlanId(vlanIdInstr.vlanId()); break; case VLAN_PCP: ModVlanPcpInstruction vlanPcpInstruction = (ModVlanPcpInstruction) l2instruction; builder.matchVlanPcp(vlanPcpInstruction.vlanPcp()); break; builder.matchMplsLabel(mplsInstr.label()); break; builder.matchMplsBos(mplsBosInstr.mplsBos()); break; builder.matchTunnelId(tunInstr.tunnelId()); break;
filteredSelectorBuilder.matchEthDst(ethCriterion.mac()); log.debug("processing L2 forwarding objective:{} -> next:{} in dev:{}", fwd.id(), fwd.nextId(), deviceId); fwd.id(), fwd.nextId(), deviceId, vlanIdCriterion.vlanId()); filteredSelectorBuilder.matchVlanId(vlanIdCriterion.vlanId()); TrafficSelector filteredSelector = filteredSelectorBuilder.build();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); selector.matchInPort(p.port()); selector.matchVlanId(v.vlanId()); selector.matchEthDst(e.mac()); selector.matchEthType(Ethernet.TYPE_IPV4); selector.matchIPDst(ipaddr.ip()); // router IPs to the controller treatment.setOutput(PortNumber.CONTROLLER); FlowRule rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(HIGHEST_PRIORITY)
TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); selector.matchInPort(p.port()); selector.matchEthDstMasked(e.mac(), e.mask()); } else { selector.matchEthDst(e.mac()); selector.matchVlanId(v.vlanId()); selector.matchEthType(Ethernet.TYPE_IPV4); if (!v.vlanId().equals(VlanId.NONE)) { treatment.popVlan(); FlowRule rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(DEFAULT_PRIORITY)
selector.matchIPSrc(flowClassifier.srcIpPrefix()); } else if (fiveTuple != null && fiveTuple.ipSrc() != null) { selector.matchIPSrc(IpPrefix.valueOf(fiveTuple.ipSrc(), 24)); selector.matchIPDst(flowClassifier.dstIpPrefix()); } else if (fiveTuple != null && fiveTuple.ipDst() != null) { selector.matchIPDst(IpPrefix.valueOf(fiveTuple.ipDst(), 24)); selector.add(Criteria.matchIPProtocol(IPv4.PROTOCOL_TCP)); } else if (flowClassifier.protocol().equalsIgnoreCase("UDP")) { selector.add(Criteria.matchIPProtocol(IPv4.PROTOCOL_UDP)); } else if (flowClassifier.protocol().equalsIgnoreCase("ICMP")) { selector.add(Criteria.matchIPProtocol(IPv4.PROTOCOL_ICMP)); selector.add(Criteria.matchIPProtocol(fiveTuple.protocol())); && (flowClassifier.etherType().equals("IPv4") || flowClassifier.etherType().equals("IPv6"))) { if (flowClassifier.etherType().equals("IPv4")) { selector.matchEthType(Ethernet.TYPE_IPV4); } else { selector.matchEthType(Ethernet.TYPE_IPV6); MacAddress macAddress = virtualPortService.getPort(vPortId).macAddress(); Host host = hostService.getHost(HostId.hostId(macAddress)); selector.matchInPort(host.location().port()); selector.matchTcpSrc(TpPort.tpPort((int) fiveTuple.portSrc().toLong())); selector.matchTcpDst(TpPort.tpPort((int) fiveTuple.portDst().toLong())); } else {
selector.matchEthType(Ethernet.TYPE_ARP); treatment.punt(); rule = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(FILTER_TABLE_CONTROLLER_PRIORITY) selector.matchEthType(Ethernet.TYPE_IPV4) .matchIPProtocol(IPv4.PROTOCOL_TCP) .matchTcpSrc(TpPort.tpPort(BGP_PORT)); treatment.punt(); rule = DefaultFlowRule.builder() .forDevice(deviceId) .withPriority(FILTER_TABLE_HIGHEST_PRIORITY) .withSelector(selector.build()) .withTreatment(treatment.build()) .fromApp(appId) selector.matchEthType(Ethernet.TYPE_IPV4) .matchIPProtocol(IPv4.PROTOCOL_TCP) .matchTcpDst(TpPort.tpPort(BGP_PORT)); treatment.punt(); rule = DefaultFlowRule.builder() .forDevice(deviceId) .withPriority(FILTER_TABLE_HIGHEST_PRIORITY) .withSelector(selector.build()) .withTreatment(treatment.build()) .fromApp(appId)