private OFAction buildL3Modification(Instruction i) { L3ModificationInstruction l3m = (L3ModificationInstruction) i; ModIPInstruction ip; Ip4Address ip4; switch (l3m.subtype()) { case IPV4_SRC: ip = (ModIPInstruction) i; ip4 = ip.ip().getIp4Address(); return factory().actions().setNwSrc(IPv4Address.of(ip4.toInt())); case IPV4_DST: ip = (ModIPInstruction) i; ip4 = ip.ip().getIp4Address(); return factory().actions().setNwDst(IPv4Address.of(ip4.toInt())); default: log.warn("Unimplemented action type {}.", l3m.subtype()); break; } return null; }
Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_SRC); ip4Prefix = Ip4Prefix.valueOf( maskedIp.getValue().getInt(), maskedIp.getMask().asCidrMaskLength()); } else { ip4Prefix = Ip4Prefix.valueOf( match.get(MatchField.IPV4_SRC).getInt(), Ip4Prefix.MAX_MASK_LENGTH); Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_DST); ip4Prefix = Ip4Prefix.valueOf( maskedIp.getValue().getInt(), maskedIp.getMask().asCidrMaskLength()); } else { ip4Prefix = Ip4Prefix.valueOf( match.get(MatchField.IPV4_DST).getInt(), Ip4Prefix.MAX_MASK_LENGTH); break; case ARP_SPA: ip = Ip4Address.valueOf(match.get(MatchField.ARP_SPA).getInt()); builder.matchArpSpa(ip); break; break; case ARP_TPA: ip = Ip4Address.valueOf(match.get(MatchField.ARP_TPA).getInt()); builder.matchArpTpa(ip); break;
@SuppressWarnings("unchecked") OFOxm<IPv4Address> ip4dst = (OFOxm<IPv4Address>) oxm; builder.setIpDst(Ip4Address.valueOf(ip4dst.getValue().getInt())); break; case IPV4_SRC: @SuppressWarnings("unchecked") OFOxm<IPv4Address> ip4src = (OFOxm<IPv4Address>) oxm; builder.setIpSrc(Ip4Address.valueOf(ip4src.getValue().getInt())); break; case MPLS_LABEL: @SuppressWarnings("unchecked") OFOxm<IPv4Address> arpspa = (OFOxm<IPv4Address>) oxm; builder.setArpSpa(Ip4Address.valueOf(arpspa.getValue().getInt())); break; case ARP_THA:
case TUNNEL_IPV4_DST: OFOxmTunnelIpv4Dst tunnelIpv4Dst = (OFOxmTunnelIpv4Dst) oxm; return new NiciraSetTunnelDst(Ip4Address.valueOf(tunnelIpv4Dst.getValue().getInt()));
ip = (L3ModificationInstruction.ModIPInstruction) i; ip4 = ip.ip().getIp4Address(); oxm = factory.oxms().ipv4Src(IPv4Address.of(ip4.toInt())); break; case IPV4_DST: ip = (L3ModificationInstruction.ModIPInstruction) i; ip4 = ip.ip().getIp4Address(); oxm = factory.oxms().ipv4Dst(IPv4Address.of(ip4.toInt())); break; case IPV6_SRC:
OFActionSetNwDst nwdst = (OFActionSetNwDst) act; IPv4Address di = nwdst.getNwAddr(); builder.setIpDst(Ip4Address.valueOf(di.getInt())); break; case SET_NW_SRC: OFActionSetNwSrc nwsrc = (OFActionSetNwSrc) act; IPv4Address si = nwsrc.getNwAddr(); builder.setIpSrc(Ip4Address.valueOf(si.getInt())); break; case EXPERIMENTER:
ip = (ModIPInstruction) i; ip4 = ip.ip().getIp4Address(); oxm = factory().oxms().ipv4Src(IPv4Address.of(ip4.toInt())); break; case IPV4_DST: ip = (ModIPInstruction) i; ip4 = ip.ip().getIp4Address(); oxm = factory().oxms().ipv4Dst(IPv4Address.of(ip4.toInt())); break; case IPV6_SRC: ModArpIPInstruction aip = (ModArpIPInstruction) i; ip4 = aip.ip().getIp4Address(); oxm = factory().oxms().arpSpa(IPv4Address.of(ip4.toInt())); break; case ARP_SHA:
Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength()); Masked<IPv4Address> maskedIp = Masked.of(IPv4Address.of(ip4Prefix.address().toInt()), IPv4Address.of(maskAddr.toInt())); mBuilder.setMasked(MatchField.IPV4_SRC, maskedIp); } else { mBuilder.setExact(MatchField.IPV4_SRC, IPv4Address.of(ip4Prefix.address().toInt())); Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength()); Masked<IPv4Address> maskedIp = Masked.of(IPv4Address.of(ip4Prefix.address().toInt()), IPv4Address.of(maskAddr.toInt())); mBuilder.setMasked(MatchField.IPV4_DST, maskedIp); } else { mBuilder.setExact(MatchField.IPV4_DST, IPv4Address.of(ip4Prefix.address().toInt())); arpPaCriterion = (ArpPaCriterion) c; mBuilder.setExact(MatchField.ARP_SPA, IPv4Address.of(arpPaCriterion.ip().toInt())); break; case ARP_THA: arpPaCriterion = (ArpPaCriterion) c; mBuilder.setExact(MatchField.ARP_TPA, IPv4Address.of(arpPaCriterion.ip().toInt())); break; case EXTENSION:
NiciraSetTunnelDst tunnelDst = (NiciraSetTunnelDst) extensionTreatment; return factory.actions().setField(factory.oxms().tunnelIpv4Dst( IPv4Address.of(tunnelDst.tunnelDst().toInt())));