use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets in project netvirt by opendaylight.
the class ExternalSubnetVpnInstanceListener method add.
@Override
protected void add(InstanceIdentifier<VpnInstance> key, VpnInstance vpnInstance) {
LOG.trace("add : External Subnet VPN Instance OP Data Entry add mapping method - key:{}. value={}", vpnInstance.getKey(), vpnInstance);
String possibleExtSubnetUuid = vpnInstance.getVpnInstanceName();
Optional<Subnets> optionalSubnets = NatUtil.getOptionalExternalSubnets(dataBroker, new Uuid(possibleExtSubnetUuid));
if (optionalSubnets.isPresent()) {
LOG.debug("add : VpnInstance {} for external subnet {}.", possibleExtSubnetUuid, optionalSubnets.get());
addOrDelDefaultFibRouteToSNATFlow(vpnInstance, optionalSubnets.get(), NwConstants.ADD_FLOW);
invokeSubnetAddedToVpn(possibleExtSubnetUuid);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets in project netvirt by opendaylight.
the class ExternalSubnetVpnInstanceListener method remove.
@Override
protected void remove(InstanceIdentifier<VpnInstance> key, VpnInstance vpnInstance) {
LOG.trace("remove : External Subnet VPN Instance remove mapping method - key:{}. value={}", vpnInstance.getKey(), vpnInstance);
String possibleExtSubnetUuid = vpnInstance.getVpnInstanceName();
Optional<Subnets> optionalSubnets = NatUtil.getOptionalExternalSubnets(dataBroker, new Uuid(possibleExtSubnetUuid));
if (optionalSubnets.isPresent()) {
addOrDelDefaultFibRouteToSNATFlow(vpnInstance, optionalSubnets.get(), NwConstants.DEL_FLOW);
invokeSubnetDeletedFromVpn(possibleExtSubnetUuid);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets in project netvirt by opendaylight.
the class VpnFloatingIpHandler method onRemoveFloatingIp.
@Override
public void onRemoveFloatingIp(final BigInteger dpnId, String routerUuid, long routerId, final Uuid networkId, InternalToExternalPortMap mapping, final long label, WriteTransaction removeFlowInvTx) {
String externalIp = mapping.getExternalIp();
Uuid floatingIpId = mapping.getExternalId();
Uuid subnetId = NatUtil.getFloatingIpPortSubnetIdFromFloatingIpId(dataBroker, floatingIpId);
Optional<Subnets> externalSubnet = NatUtil.getOptionalExternalSubnets(dataBroker, subnetId);
final String vpnName = externalSubnet.isPresent() ? subnetId.getValue() : NatUtil.getAssociatedVPN(dataBroker, networkId);
if (vpnName == null) {
LOG.error("onRemoveFloatingIp: No VPN associated with ext nw {} to remove floating ip {} configuration " + "for router {}", networkId, externalIp, routerUuid);
return;
}
// Remove floating mac from mymac table
LOG.debug("onRemoveFloatingIp: Removing FloatingIp {}", externalIp);
String floatingIpPortMacAddress = NatUtil.getFloatingIpPortMacFromFloatingIpId(dataBroker, floatingIpId);
if (floatingIpPortMacAddress == null) {
LOG.error("onRemoveFloatingIp: Unable to retrieve floatingIp port MAC address from floatingIpId {} for " + "router {} to remove floatingIp {}", floatingIpId, routerUuid, externalIp);
return;
}
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
String networkVpnName = NatUtil.getAssociatedVPN(dataBroker, networkId);
vpnManager.removeSubnetMacFromVpnInstance(networkVpnName, subnetId.getValue(), floatingIpPortMacAddress, dpnId, tx);
vpnManager.removeArpResponderFlowsToExternalNetworkIps(routerUuid, Collections.singletonList(externalIp), floatingIpPortMacAddress, dpnId, networkId);
}), LOG, "onRemoveFloatingIp");
removeFromFloatingIpPortInfo(floatingIpId);
ProviderTypes provType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerUuid, networkId);
if (provType == null) {
return;
}
if (provType == ProviderTypes.VXLAN) {
Uuid floatingIpInterface = NatEvpnUtil.getFloatingIpInterfaceIdFromFloatingIpId(dataBroker, floatingIpId);
evpnDnatFlowProgrammer.onRemoveFloatingIp(dpnId, vpnName, externalIp, floatingIpInterface.getValue(), floatingIpPortMacAddress, routerId, removeFlowInvTx);
return;
}
cleanupFibEntries(dpnId, vpnName, externalIp, label, removeFlowInvTx, provType);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets 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.subnets.rev150712.subnets.attributes.Subnets in project netvirt by opendaylight.
the class NeutronvpnManager method dissociateRouterFromVpn.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
protected void dissociateRouterFromVpn(Uuid vpnId, Uuid routerId) {
List<Uuid> routerSubnets = neutronvpnUtils.getNeutronRouterSubnetIds(routerId);
boolean vpnInstanceIpVersionsRemoved = false;
IpVersionChoice vpnInstanceIpVersionsToRemove = IpVersionChoice.UNDEFINED;
for (Uuid subnetId : routerSubnets) {
Subnetmap sn = neutronvpnUtils.getSubnetmap(subnetId);
if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(sn, vpnId)) {
vpnInstanceIpVersionsToRemove = vpnInstanceIpVersionsToRemove.addVersion(NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()));
vpnInstanceIpVersionsRemoved = true;
}
LOG.debug("Updating association of subnets to internal vpn {}", routerId.getValue());
updateVpnForSubnet(vpnId, routerId, subnetId, false);
}
if (vpnInstanceIpVersionsRemoved) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), vpnInstanceIpVersionsToRemove, false);
}
clearFromVpnMaps(vpnId, routerId, null);
try {
checkAndPublishRouterDisassociatedFromVpnNotification(routerId, vpnId);
LOG.debug("notification upon disassociation of router {} from VPN {} published", routerId.getValue(), vpnId.getValue());
} catch (Exception e) {
LOG.error("publishing of notification upon disassociation of router {} from VPN {} failed : ", routerId.getValue(), vpnId.getValue(), e);
}
}
Aggregations