Source:
private List<NetworkAttachment> getAttachmentsWithMissingUpdatedDefaultRoute() { NetworkCluster currentDefaultRouteNetworkCluster = findCurrentDefaultRouteNetworkForCluster(); NetworkAttachment currentDefaultRouteNetworkAttachment = currentDefaultRouteNetworkCluster == null ? null : findNetworkAttachmentBy( networkIdAttachmentPredicate(currentDefaultRouteNetworkCluster.getNetworkId()), getExistingAttachments()); VdsNetworkInterface previousDefaultRouteNic = findPreviousDefaultRouteNic(); NetworkAttachment previousDefaultRouteNetworkAttachment = previousDefaultRouteNic == null ? null : findNetworkAttachmentBy(networkNameAttachmentPredicate(previousDefaultRouteNic.getNetworkName()), getExistingAttachments()); if (currentDefaultRouteNetworkAttachment != null && previousDefaultRouteNetworkAttachment != null && currentDefaultRouteNetworkAttachment.getId().equals(previousDefaultRouteNetworkAttachment.getId())) { return getParameters().getNetworkAttachments(); } if (previousDefaultRouteNetworkAttachment != null && previousDefaultRouteNetworkAttachment.getIpConfiguration() != null && previousDefaultRouteNetworkAttachment.getIpConfiguration().getIpv6PrimaryAddress() != null) { previousDefaultRouteNetworkAttachment.getIpConfiguration().getIpv6PrimaryAddress().setGateway(null); } List<NetworkAttachment> extendedAttachments = getParameters().getNetworkAttachments(); NetworkAttachment potentialyMissingAttachment = getPotentialyMissingAttachment( currentDefaultRouteNetworkCluster == null ? null : currentDefaultRouteNetworkCluster.getNetworkId(), currentDefaultRouteNetworkAttachment, previousDefaultRouteNetworkAttachment); addAttachmentIfMissing(potentialyMissingAttachment, extendedAttachments); return extendedAttachments; }

Target:
private List<NetworkAttachment> getAttachmentsWithMissingUpdatedDefaultRoute() { NetworkCluster currentDefaultRouteNetworkCluster = findCurrentDefaultRouteNetworkForCluster(); NetworkAttachment currentDefaultRouteNetworkAttachment = currentDefaultRouteNetworkCluster == null ? null : findNetworkAttachmentBy( networkIdAttachmentPredicate(currentDefaultRouteNetworkCluster.getNetworkId()), getExistingAttachments()); VdsNetworkInterface previousDefaultRouteNic = findPreviousDefaultRouteNic(); NetworkAttachment previousDefaultRouteNetworkAttachment = previousDefaultRouteNic == null ? null : findNetworkAttachmentBy(networkNameAttachmentPredicate(previousDefaultRouteNic.getNetworkName()), getExistingAttachments()); if (currentDefaultRouteNetworkAttachment != null && previousDefaultRouteNetworkAttachment != null && currentDefaultRouteNetworkAttachment.getId().equals(previousDefaultRouteNetworkAttachment.getId())) { return getParameters().getNetworkAttachments(); } if (hasIpv6PrimaryAddress(previousDefaultRouteNetworkAttachment)) { previousDefaultRouteNetworkAttachment.getIpConfiguration().getIpv6PrimaryAddress().setGateway(null); } List<NetworkAttachment> extendedAttachments = getParameters().getNetworkAttachments(); NetworkAttachment potentialyMissingAttachment = getPotentialyMissingAttachment( currentDefaultRouteNetworkCluster == null ? null : currentDefaultRouteNetworkCluster.getNetworkId(), currentDefaultRouteNetworkAttachment, previousDefaultRouteNetworkAttachment); addAttachmentIfMissing(potentialyMissingAttachment, extendedAttachments); return extendedAttachments; }