private OFAction buildL3Modification(Instruction i) { L3ModificationInstruction l3m = (L3ModificationInstruction) i; L3ModificationInstruction.ModIPInstruction ip; Ip4Address ip4; Ip6Address ip6; OFOxm<?> oxm = null; switch (l3m.subtype()) { case IPV4_SRC: 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: ip = (L3ModificationInstruction.ModIPInstruction) i; ip6 = ip.ip().getIp6Address(); oxm = factory.oxms().ipv6Src(IPv6Address.of(ip6.toOctets())); break; case IPV6_DST: ip = (L3ModificationInstruction.ModIPInstruction) i; ip6 = ip.ip().getIp6Address(); oxm = factory.oxms().ipv6Dst(IPv6Address.of(ip6.toOctets())); break; case IPV6_FLABEL: L3ModificationInstruction.ModIPv6FlowLabelInstruction flowLabelInstruction = (L3ModificationInstruction.ModIPv6FlowLabelInstruction) i; int flowLabel = flowLabelInstruction.flowLabel(); oxm = factory.oxms().ipv6Flabel(IPv6FlowLabel.of(flowLabel)); break; case DEC_TTL: return factory.actions().decNwTtl(); case TTL_IN: return factory.actions().copyTtlIn(); case TTL_OUT: return factory.actions().copyTtlOut(); default: log.warn("Unimplemented action type {}.", l3m.subtype()); break; } if (oxm != null) { return factory.actions().buildSetField().setField(oxm).build(); } return null; }