import static java.util.Objects.requireNonNull;
-import static org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils.nullToEmpty;
-
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
buf.putInt((int)pdu.getMtu().longValue());
}
- for (PrefixList prefix : nullToEmpty(pdu.getPrefixList())) {
+ for (PrefixList prefix : pdu.nonnullPrefixList()) {
buf.put((byte)prefix.getOptionType().shortValue());
buf.put((byte)prefix.getOptionLength().shortValue());
buf.put((byte)prefix.getPrefixLength().shortValue());
*/
package org.opendaylight.netvirt.ipv6service;
-import static org.opendaylight.netvirt.ipv6service.utils.Ipv6ServiceUtils.nullToEmpty;
-
import com.google.common.base.Strings;
-
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
}
LOG.debug("Add port notification handler is invoked for port {} ", port);
- for (FixedIps fixedip : nullToEmpty(port.getFixedIps())) {
+ for (FixedIps fixedip : port.nonnullFixedIps()) {
if (fixedip.getIpAddress().getIpv4Address() != null) {
continue;
}
//Neutron Port update with proper device owner information
if ((Strings.isNullOrEmpty(original.getDeviceOwner()) || Strings.isNullOrEmpty(original.getDeviceId()))
&& !Strings.isNullOrEmpty(update.getDeviceOwner()) && !Strings.isNullOrEmpty(update.getDeviceId())) {
- for (FixedIps fixedip : nullToEmpty(update.getFixedIps())) {
+ for (FixedIps fixedip : update.nonnullFixedIps()) {
if (fixedip.getIpAddress().getIpv4Address() != null) {
continue;
}
package org.opendaylight.netvirt.ipv6service.utils;
-import static java.util.Collections.emptyList;
-
import com.google.common.base.Optional;
import java.math.BigInteger;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
}
return subnet.getIpVersion().equals(Ipv6ServiceConstants.IP_VERSION_V6) ? true : false;
}
-
- // TODO Replace this with mdsal's DataObjectUtils.nullToEmpty when upgrading to mdsal 3
- @Nonnull
- public static <T> List<T> nullToEmpty(final @Nullable List<T> input) {
- return input != null ? input : emptyList();
- }
}