package org.opendaylight.netvirt.ipv6service;
+import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.net.InetAddresses;
String deviceOwner) {
LOG.debug("addRouterIntf portId {}, rtrId {}, snetId {}, networkId {}, ip {}, mac {}",
portId, rtrId, snetId, networkId, fixedIp, macAddress);
+ /* Added the below logic for supporting neutron router interface creation.
+ * Since when neutron port is created with fixed Ipv6 address, that time it will be
+ * treated as a host port and it will be added into the vintfs map through
+ * NeutronPortChangeListener ADD() event.
+ * Later the same neutron port is added to router this time it will be treated as
+ * a router_interface through NeutronPortChangeListener UPDATE() event.
+ */
+ VirtualPort virInterface = vintfs.get(portId);
+ if (virInterface != null && Strings.isNullOrEmpty(virInterface.getDeviceOwner())) {
+ vintfs.remove(portId);
+ }
//Save the interface ipv6 address in its fully expanded format
Ipv6Address addr = new Ipv6Address(InetAddresses
.forString(fixedIp.getIpv6Address().getValue()).getHostAddress());
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;
ifMgr.updateHostIntf(update.getUuid(), portIncludesV6Address);
}
}
+ //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())) {
+ if (fixedip.getIpAddress().getIpv4Address() != null) {
+ continue;
+ }
+ addInterfaceInfo(update, fixedip);
+ }
+ }
}
protected void addInterfaceInfo(Port port, FixedIps fixedip) {
for (FixedIps ip : requireNonNullElse(port.getFixedIps(), Collections.<FixedIps>emptyList())) {
String ipValue = ip.getIpAddress().stringValue();
String ipPrefix = ip.getIpAddress().getIpv4Address() != null ? ipValue + "/32" : ipValue + "/128";
- if (sn != null && !FibHelper.doesPrefixBelongToSubnet(ipPrefix, sn.getSubnetIp(), false)) {
+ Subnetmap snTemp = neutronvpnUtils.getSubnetmap(ip.getSubnetId());
+ if (snTemp != null && !FibHelper.doesPrefixBelongToSubnet(ipPrefix,
+ snTemp.getSubnetIp(), false)) {
continue;
}
- Subnetmap snTemp = sn != null ? sn : neutronvpnUtils.getSubnetmap(ip.getSubnetId());
Uuid vpnId = snTemp != null ? snTemp.getVpnId() : null;
if (vpnId != null) {
neutronvpnUtils.createVpnPortFixedIpToPort(vpnId.getValue(), ipValue,
LOG.info("createFibEntryForRouterInterface: Router interface {} for vpn {} rd {} prefix {} label {}"
+ " macAddress {} processed successfully;", interfaceName, vpnName, primaryRd, prefix, label,
macAddress);
- return;
+ } else {
+ LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as primary"
+ + " adjacency for this vpn interface could not be obtained. rd {} vpnName {}",
+ interfaceName, primaryRd, vpnName);
}
}
- LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as primary"
- + " adjacency for this vpn interface could not be obtained. rd {} vpnName {}", interfaceName,
- primaryRd, vpnName);
}
protected void deleteFibEntryForRouterInterface(VpnInterface vpnInterface,