use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project netvirt by opendaylight.
the class VpnManagerImpl method doAddArpResponderFlowsToExternalNetworkIps.
private void doAddArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress, BigInteger dpnId, Uuid extNetworkId, WriteTransaction writeTx, String extInterfaceName) {
Interface extInterfaceState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker, extInterfaceName);
if (extInterfaceState == null) {
LOG.debug("No interface state found for interface {}. Delaying responder flows for {}", extInterfaceName, id);
return;
}
Integer lportTag = extInterfaceState.getIfIndex();
if (lportTag == null) {
LOG.debug("No Lport tag found for interface {}. Delaying flows for router-id {}", extInterfaceName, id);
return;
}
if (macAddress == null) {
LOG.debug("Failed to install arp responder flows for router-gateway-ip {} for router {}." + "External Gw MacAddress is missing.", fixedIps, id);
return;
}
addArpResponderFlowsToExternalNetworkIps(id, fixedIps, macAddress, dpnId, extInterfaceName, lportTag, writeTx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project netvirt by opendaylight.
the class VpnManagerImpl method addArpResponderFlowsToExternalNetworkIps.
@Override
public void addArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress, BigInteger dpnId, Uuid extNetworkId, WriteTransaction writeTx) {
if (dpnId == null || BigInteger.ZERO.equals(dpnId)) {
LOG.warn("Failed to install arp responder flows for router {}. DPN id is missing.", id);
return;
}
String extInterfaceName = elanService.getExternalElanInterface(extNetworkId.getValue(), dpnId);
if (extInterfaceName != null) {
doAddArpResponderFlowsToExternalNetworkIps(id, fixedIps, macAddress, dpnId, extNetworkId, writeTx, extInterfaceName);
return;
}
LOG.warn("Failed to install responder flows for {}. No external interface found for DPN id {}", id, dpnId);
if (!upgradeState.isUpgradeInProgress()) {
return;
}
// The following through the end of the function deals with an upgrade scenario where the neutron configuration
// is restored before the OVS switches reconnect. In such a case, the elan-dpn-interfaces entries will be
// missing from the operational data store. In order to mitigate this we use DataTreeEventCallbackRegistrar
// to wait for the exact operational md-sal object we need to contain the external interface we need.
LOG.info("Upgrade in process, waiting for an external interface to appear on dpn {} for elan {}", dpnId, extNetworkId.getValue());
InstanceIdentifier<DpnInterfaces> dpnInterfacesIid = elanService.getElanDpnInterfaceOperationalDataPath(extNetworkId.getValue(), dpnId);
eventCallbacks.onAddOrUpdate(LogicalDatastoreType.OPERATIONAL, dpnInterfacesIid, (unused, alsoUnused) -> {
LOG.info("Reattempting write of arp responder for external interfaces for external network {}", extNetworkId);
DpnInterfaces dpnInterfaces = elanService.getElanInterfaceInfoByElanDpn(extNetworkId.getValue(), dpnId);
if (dpnInterfaces == null) {
LOG.error("Could not retrieve DpnInterfaces for {}, {}", extNetworkId.getValue(), dpnId);
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
}
String extIfc = null;
for (String dpnInterface : dpnInterfaces.getInterfaces()) {
if (interfaceManager.isExternalInterface(dpnInterface)) {
extIfc = dpnInterface;
break;
}
}
if (extIfc == null) {
if (upgradeState.isUpgradeInProgress()) {
LOG.info("External interface not found yet in elan {} on dpn {}, keep waiting", extNetworkId.getValue(), dpnInterfaces);
return DataTreeEventCallbackRegistrar.NextAction.CALL_AGAIN;
} else {
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
}
}
final String extIfcFinal = extIfc;
ListenableFuture<Void> listenableFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
doAddArpResponderFlowsToExternalNetworkIps(id, fixedIps, macAddress, dpnId, extNetworkId, tx, extIfcFinal);
});
ListenableFutures.addErrorLogging(listenableFuture, LOG, "Error while configuring arp responder for ext. interface");
return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project netvirt by opendaylight.
the class SubnetRouteInterfaceStateChangeListener method getSubnetId.
@Nonnull
protected List<Uuid> getSubnetId(Interface intrf) {
List<Uuid> listSubnetIds = new ArrayList<>();
if (!NeutronUtils.isUuid(intrf.getName())) {
LOG.debug("SubnetRouteInterfaceListener: Interface {} doesn't have valid uuid pattern", intrf.getName());
return listSubnetIds;
}
PortOpDataEntry portOpEntry = subOpDpnManager.getPortOpDataEntry(intrf.getName());
if (portOpEntry != null) {
List<Uuid> subnet = portOpEntry.getSubnetIds();
if (subnet != null) {
return subnet;
}
return listSubnetIds;
}
LOG.trace("SubnetRouteInterfaceListener : Received Port {} event for {} that is not part of subnetRoute", intrf.getOperStatus(), intrf.getName());
Port port = neutronVpnManager.getNeutronPort(intrf.getName());
if (port == null) {
return listSubnetIds;
}
List<FixedIps> portIps = port.getFixedIps();
if (port.getFixedIps() != null) {
for (FixedIps portIp : portIps) {
listSubnetIds.add(portIp.getSubnetId());
}
}
return listSubnetIds;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project netvirt by opendaylight.
the class IfMgr method updateRouterIntf.
public void updateRouterIntf(Uuid portId, Uuid rtrId, List<FixedIps> fixedIpsList) {
LOG.info("updateRouterIntf portId {}, fixedIpsList {} ", portId, fixedIpsList);
VirtualPort intf = getPort(portId);
if (intf == null) {
LOG.info("Skip Router interface update for non-ipv6 port {}", portId);
return;
}
List<Ipv6Address> existingIPv6AddressList = intf.getIpv6AddressesWithoutLLA();
List<Ipv6Address> newlyAddedIpv6AddressList = new ArrayList<>();
intf.clearSubnetInfo();
for (FixedIps fip : fixedIpsList) {
IpAddress fixedIp = fip.getIpAddress();
if (fixedIp.getIpv4Address() != null) {
continue;
}
// Save the interface ipv6 address in its fully expanded format
Ipv6Address addr = new Ipv6Address(InetAddresses.forString(fixedIp.getIpv6Address().getValue()).getHostAddress());
fixedIp = new IpAddress(addr);
Uuid subnetId = fip.getSubnetId();
intf.setSubnetInfo(subnetId, fixedIp);
VirtualRouter rtr = getRouter(rtrId);
VirtualSubnet snet = getSubnet(subnetId);
if (rtr != null && snet != null) {
snet.setRouter(rtr);
intf.setSubnet(subnetId, snet);
rtr.addSubnet(snet);
} else if (snet != null) {
intf.setSubnet(subnetId, snet);
addUnprocessed(unprocessedRouterIntfs, rtrId, intf);
} else {
addUnprocessed(unprocessedRouterIntfs, rtrId, intf);
addUnprocessed(unprocessedSubnetIntfs, subnetId, intf);
}
Uuid networkID = intf.getNetworkID();
if (networkID != null) {
vrouterv6IntfMap.put(networkID, intf);
}
if (existingIPv6AddressList.contains(fixedIp.getIpv6Address())) {
existingIPv6AddressList.remove(fixedIp.getIpv6Address());
} else {
newlyAddedIpv6AddressList.add(fixedIp.getIpv6Address());
}
}
/* This is a port update event for routerPort. Check if any IPv6 subnet is added
or removed from the router port. Depending on subnet added/removed, we add/remove
the corresponding flows from IPV6_TABLE(45).
*/
for (Ipv6Address ipv6Address : newlyAddedIpv6AddressList) {
// Some v6 subnets are associated to the routerPort add the corresponding NS Flows.
programIcmpv6NSPuntFlowForAddress(intf, ipv6Address, Ipv6Constants.ADD_FLOW);
}
for (Ipv6Address ipv6Address : existingIPv6AddressList) {
// Some v6 subnets are disassociated from the routerPort, remove the corresponding NS Flows.
programIcmpv6NSPuntFlowForAddress(intf, ipv6Address, Ipv6Constants.DEL_FLOW);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project netvirt by opendaylight.
the class NeutronPortChangeListener method update.
@Override
protected void update(InstanceIdentifier<Port> identifier, Port original, Port update) {
if (update.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_GATEWAY)) {
// Todo: revisit when IPv6 north-south support is implemented.
LOG.info("IPv6Service (TODO): Skipping router_gateway port {} for update event", update);
return;
}
LOG.debug("update port notification handler is invoked for port {} ", update);
Set<FixedIps> oldIPs = getFixedIpSet(original.getFixedIps());
Set<FixedIps> newIPs = getFixedIpSet(update.getFixedIps());
if (!oldIPs.equals(newIPs)) {
Boolean portIncludesV6Address = Boolean.FALSE;
ifMgr.clearAnyExistingSubnetInfo(update.getUuid());
List<FixedIps> ipList = update.getFixedIps();
for (FixedIps fixedip : ipList) {
if (fixedip.getIpAddress().getIpv4Address() != null) {
continue;
}
portIncludesV6Address = Boolean.TRUE;
addInterfaceInfo(update, fixedip);
}
if (update.getDeviceOwner().equalsIgnoreCase(Ipv6Constants.NETWORK_ROUTER_INTERFACE)) {
ifMgr.updateRouterIntf(update.getUuid(), new Uuid(update.getDeviceId()), update.getFixedIps());
} else {
ifMgr.updateHostIntf(update.getUuid(), portIncludesV6Address);
}
}
}
Aggregations