*/
package org.opendaylight.netvirt.natservice.internal;
+import static org.opendaylight.netvirt.natservice.internal.NatUtil.requireNonNullElse;
+
import com.google.common.base.Optional;
import java.math.BigInteger;
+import java.util.Collections;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
LOG.warn("remove : Interface {} is not a VPN Interface, ignoring.", interfaceName);
return;
}
- for (VpnInstanceNames vpnInterfaceVpnInstance : cfgVpnInterface.get().getVpnInstanceNames()) {
+ for (VpnInstanceNames vpnInterfaceVpnInstance : requireNonNullElse(
+ cfgVpnInterface.get().getVpnInstanceNames(), Collections.<VpnInstanceNames>emptyList())) {
String vpnName = vpnInterfaceVpnInstance.getVpnName();
InstanceIdentifier<VpnInterfaceOpDataEntry> idOper = NatUtil
.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
}
}
}
- if (intfDpnId.equals(BigInteger.ZERO)) {
+ if (BigInteger.ZERO.equals(intfDpnId)) {
LOG.warn("remove : Could not retrieve dpnid for interface {} ", interfaceName);
return;
}
LOG.warn("update : Interface {} is not a VPN Interface, ignoring.", interfaceName);
return;
}
- for (VpnInstanceNames vpnInterfaceVpnInstance : cfgVpnInterface.get().getVpnInstanceNames()) {
+ for (VpnInstanceNames vpnInterfaceVpnInstance : requireNonNullElse(
+ cfgVpnInterface.get().getVpnInstanceNames(), Collections.<VpnInstanceNames>emptyList())) {
String vpnName = vpnInterfaceVpnInstance.getVpnName();
InstanceIdentifier<VpnInterfaceOpDataEntry> idOper = NatUtil
.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
}
}
}
- if (intfDpnId.equals(BigInteger.ZERO)) {
+ if (BigInteger.ZERO.equals(intfDpnId)) {
LOG.warn("remove : Could not retrieve dpnid for interface {} ", interfaceName);
return;
}