import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.GroupEntity;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
+import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
+ "vpnId {}...", dpnId, routerUuid, vpnId);
snatDefaultRouteProgrammer.installDefNATRouteInDPN(dpnId, vpnId, routerId, confTx);
}
+ /* install V6 internet default fallback rule in FIB_TABLE if router
+ * is having V6 subnet
+ */
+ nvpnManager.programV6InternetFallbackFlow(new Uuid(routerUuid),
+ NatUtil.getVpnIdfromNetworkId(dataBroker, networkId), NwConstants.ADD_FLOW);
if (router.isEnableSnat()) {
LOG.info("add : SNAT enabled for router {}", routerUuid);
if (extNwProvType == null) {
vpnName);
snatDefaultRouteProgrammer.removeDefNATRouteInDPN(dpnId, vpnId, routerId, confTx);
}
-
+ /* remove V6 internet default fallback rule in FIB_TABLE if router
+ * is having V6 subnet
+ */
+ nvpnManager.programV6InternetFallbackFlow(new Uuid(routerUuid),
+ NatUtil.getVpnIdfromNetworkId(dataBroker, networkId), NwConstants.DEL_FLOW);
if (router.isEnableSnat()) {
LOG.info("remove : SNAT enabled for router {}", routerUuid);
removeSNATFromDPN(dpnId, routerUuid, routerId, vpnId, networkId, confTx);
String getOpenDaylightVniRangesConfig();
+ void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove);
+
}
this.mdsalManager = mdsalManager;
}
- private FlowEntity buildIPv6FallbacktoExternalVpn(BigInteger dpId, long internetBgpVpnId, long vpnId, boolean add) {
+ private FlowEntity buildIPv6FallbacktoExternalVpn(BigInteger dpId, String routerId, long internetBgpVpnId,
+ long vpnId, boolean add) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV6);
instructionInfo.add(new InstructionApplyActions(listActionInfo));
}
String defaultIPv6 = "0:0:0:0:0:0:0:0";
- String flowRef = getIPv6FlowRefL3(dpId, NwConstants.L3_FIB_TABLE, defaultIPv6, internetBgpVpnId);
+ /* For each router it needs to have unique flow-id. Hence router-id is being used to generate the
+ * flow-id for each DPN instead of internet vpnId.
+ */
+ String flowRef = getIPv6FlowRefL3(dpId, NwConstants.L3_FIB_TABLE, defaultIPv6, routerId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef,
NwConstants.TABLE_MISS_PRIORITY, flowRef/* "L3 ipv6 internet default route",*/, 0, 0,
* @param internetBgpVpnId internetVpn id as long
* @param vpnId id of router associated to internet bgpvpn as long
*/
- public void installDefaultRoute(BigInteger dpnId, long internetBgpVpnId, long vpnId) {
- FlowEntity flowEntity = buildIPv6FallbacktoExternalVpn(dpnId, internetBgpVpnId, vpnId, true);
+ public void installDefaultRoute(BigInteger dpnId, String routerId, long internetBgpVpnId, long vpnId) {
+ FlowEntity flowEntity = buildIPv6FallbacktoExternalVpn(dpnId, routerId, internetBgpVpnId, vpnId, true);
LOG.trace("installDefaultRoute: flowEntity: {} ", flowEntity);
mdsalManager.installFlow(flowEntity);
}
- public void removeDefaultRoute(BigInteger dpnId, long internetBgpVpnId, long vpnId) {
- FlowEntity flowEntity = buildIPv6FallbacktoExternalVpn(dpnId, internetBgpVpnId, vpnId, false);
+ public void removeDefaultRoute(BigInteger dpnId, String routerId, long internetBgpVpnId, long vpnId) {
+ FlowEntity flowEntity = buildIPv6FallbacktoExternalVpn(dpnId, routerId, internetBgpVpnId, vpnId, false);
LOG.trace("removeDefaultRoute: flowEntity: {} ", flowEntity);
mdsalManager.removeFlow(flowEntity);
}
- public String getIPv6FlowRefL3(BigInteger dpnId, short tableId, String destPrefix, long vpnId) {
+ public String getIPv6FlowRefL3(BigInteger dpnId, short tableId, String destPrefix, String routerId) {
return "L3." + dpnId.toString() + NwConstants.FLOWID_SEPARATOR + tableId
- + NwConstants.FLOWID_SEPARATOR + destPrefix + NwConstants.FLOWID_SEPARATOR + vpnId;
+ + NwConstants.FLOWID_SEPARATOR + destPrefix + NwConstants.FLOWID_SEPARATOR + routerId;
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.RoutersBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingBuilder;
IpVersionChoice.IPV6, routerId, true)) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(internetVpnId.getValue(), IpVersionChoice.IPV6,
true);
- neutronvpnUtils.updateVpnInstanceWithFallback(internetVpnId, true);
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, internetVpnId, true);
}
}
if (! subnetMapList.isEmpty()) {
if (vpnInstanceInternetIpVersionRemoved) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnInstanceInternetUuid.getValue(),
IpVersionChoice.IPV6, false);
- neutronvpnUtils.updateVpnInstanceWithFallback(vpnInstanceInternetUuid, false);
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, vpnInstanceInternetUuid, false);
}
}
}
if (isExternal) {
Uuid vpnInternetId = neutronvpnUtils.getVpnForNetwork(networkId);
if (vpnInternetId != null) {
- if (isRtrGwRemoved) {
- //Set VPN type BGPVPNExternal from BGPVPNInternet for removal case
- neutronvpnUtils.updateVpnInstanceOpWithType(VpnInstanceOpDataEntry.BgpvpnType.BGPVPNExternal,
- vpnInternetId);
- } else {
- //Set VPN type BGPVPNInternet from BGPVPNExternal for add case
- neutronvpnUtils.updateVpnInstanceOpWithType(VpnInstanceOpDataEntry.BgpvpnType.BGPVPNInternet,
- vpnInternetId);
+ if (!isRtrGwRemoved) {
nvpnManager.updateVpnMaps(vpnInternetId, null, routerId, null, null);
}
List<Subnetmap> snList = neutronvpnUtils.getNeutronRouterSubnetMaps(routerId);
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.infra.TypedWriteTransaction;
+import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.infrautils.utils.concurrent.KeyedLocks;
import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
if (vpnId != null) {
builder.setVpnId(vpnId);
}
- builder.setInternetVpnId(internetvpnId);
-
+ if (neutronvpnUtils.getIpVersionFromString(sn.get().getSubnetIp()) == IpVersionChoice.IPV6) {
+ builder.setInternetVpnId(internetvpnId);
+ }
Subnetmap subnetmap = builder.build();
LOG.debug("Creating/Updating subnetMap node: {} ", subnetId.getValue());
SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, id, subnetmap);
* associated with internet BGP-VPN.
*/
if (vpnExtUuid != null) {
- //Update V6 Internet default route match with new VPN metadata
- neutronvpnUtils.updateVpnInstanceWithFallback(vpnExtUuid, isBeingAssociated);
+ /* Update V6 Internet default route match with new VPN metadata.
+ * isBeingAssociated = true means oldVpnId is same as routerId
+ * isBeingAssociated = false means newVpnId is same as routerId
+ */
+ if (isBeingAssociated) {
+ neutronvpnUtils.updateVpnInstanceWithFallback(oldVpnId, vpnExtUuid, true);
+ } else {
+ neutronvpnUtils.updateVpnInstanceWithFallback(newVpnId, vpnExtUuid, true);
+ }
}
//Update Router Interface first synchronously.
//CAUTION: Please DONOT make the router interface VPN Movement as an asynchronous commit again !
@SuppressWarnings("checkstyle:IllegalCatch")
protected void dissociateRouterFromVpn(Uuid vpnId, Uuid routerId) {
+ clearFromVpnMaps(vpnId, routerId, null);
List<Subnetmap> subMapList = neutronvpnUtils.getNeutronRouterSubnetMapList(routerId);
IpVersionChoice ipVersion = IpVersionChoice.UNDEFINED;
for (Subnetmap sn : subMapList) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), ipVersion,
false);
}
- clearFromVpnMaps(vpnId, routerId, null);
try {
checkAndPublishRouterDisassociatedFromVpnNotification(routerId, vpnId);
LOG.debug("notification upon disassociation of router {} from VPN {} published", routerId.getValue(),
protected List<String> associateNetworksToVpn(@Nonnull Uuid vpnId, @Nonnull List<Uuid> networkList) {
List<String> failedNwList = new ArrayList<>();
HashSet<Uuid> passedNwList = new HashSet<>();
+ boolean isExternalNetwork = false;
if (networkList.isEmpty()) {
LOG.error("associateNetworksToVpn: Failed as given networks list is empty, VPN Id: {}", vpnId.getValue());
failedNwList.add(String.format("Failed to associate networks with VPN %s as given networks list is empty",
nw.getValue(), vpnId.getValue()));
continue;
}
+ if (NeutronvpnUtils.getIsExternal(network)) {
+ isExternalNetwork = true;
+ }
List<Subnetmap> subnetmapList = neutronvpnUtils.getSubnetmapListFromNetworkId(nw);
if (subnetmapList == null || subnetmapList.isEmpty()) {
passedNwList.add(nw);
failedNwList.add(String.format("Failed to associate VPN %s with networks %s: %s", vpnId.getValue(),
networkList, e));
}
- updateVpnMaps(vpnId, null, null, null, new ArrayList<>(passedNwList));
+ //VpnMap update for ext-nw is already done in associateExtNetworkToVpn() method.
+ if (!isExternalNetwork) {
+ updateVpnMaps(vpnId, null, null, null, new ArrayList<>(passedNwList));
+ }
LOG.info("Network(s) {} associated to L3VPN {} successfully", passedNwList.toString(), vpnId.getValue());
return failedNwList;
}
LOG.info("associateExtNetworkToVpn: set type {} for VPN {}", BgpvpnType.BGPVPNInternet, vpnId.getValue());
neutronvpnUtils.updateVpnInstanceOpWithType(BgpvpnType.BGPVPNInternet, vpnId);
}
+ //Update VpnMap with ext-nw is needed first before processing V6 internet default fallback flows
+ List<Uuid> extNwList = Collections.singletonList(extNet.key().getUuid());
+ updateVpnMaps(vpnId, null, null, null, extNwList);
IpVersionChoice ipVersion = IpVersionChoice.UNDEFINED;
for (Uuid snId: neutronvpnUtils.getPrivateSubnetsToExport(extNet, vpnId)) {
Subnetmap sm = neutronvpnUtils.getSubnetmap(snId);
continue;
}
IpVersionChoice ipVers = neutronvpnUtils.getIpVersionFromString(sm.getSubnetIp());
+ if (ipVers.isIpVersionChosen(IpVersionChoice.IPV4)) {
+ continue;
+ }
if (ipVers.isIpVersionChosen(IpVersionChoice.IPV6)) {
updateVpnInternetForSubnet(sm, vpnId, true);
}
ipVersion = ipVersion.addVersion(ipVers);
}
}
- if (!ipVersion.isIpVersionChosen(IpVersionChoice.IPV4)) {
+ if (ipVersion != IpVersionChoice.UNDEFINED) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), IpVersionChoice.IPV6, true);
LOG.info("associateExtNetworkToVpn: add IPv6 Internet default route in VPN {}", vpnId.getValue());
- neutronvpnUtils.updateVpnInstanceWithFallback(vpnId, true);
+ neutronvpnUtils.updateVpnInstanceWithFallback(/*routerId*/ null, vpnId, true);
}
return true;
}
if (NeutronvpnUtils.getIsExternal(network)) {
if (disassociateExtNetworkFromVpn(vpnId, network)) {
passedNwList.add(nw);
- continue;
} else {
LOG.error("dissociateNetworksFromVpn: Failed to withdraw Provider Network {} from VPN {}",
nw.getValue(), vpnId.getValue());
continue;
}
}
- Set<VpnTarget> routeTargets = vpnManager.getRtListForVpn(vpnId.getValue());
IpVersionChoice ipVersion = IpVersionChoice.UNDEFINED;
for (Uuid subnet : networkSubnets) {
Subnetmap subnetmap = neutronvpnUtils.getSubnetmap(subnet);
if (!ipVersion.isIpVersionChosen(ipVers)) {
ipVersion = ipVersion.addVersion(ipVers);
}
- LOG.debug("dissociateNetworksFromVpn: Withdraw subnet {} from VPN {}", subnet.getValue(),
- vpnId.getValue());
- removeSubnetFromVpn(vpnId, subnet, null);
- vpnManager.removeRouteTargetsToSubnetAssociation(routeTargets, subnetmap.getSubnetIp(),
- vpnId.getValue());
- passedNwList.add(nw);
+ if (!NeutronvpnUtils.getIsExternal(network)) {
+ LOG.debug("dissociateNetworksFromVpn: Withdraw subnet {} from VPN {}", subnet.getValue(),
+ vpnId.getValue());
+ removeSubnetFromVpn(vpnId, subnet, null);
+ Set<VpnTarget> routeTargets = vpnManager.getRtListForVpn(vpnId.getValue());
+ vpnManager.removeRouteTargetsToSubnetAssociation(routeTargets, subnetmap.getSubnetIp(),
+ vpnId.getValue());
+ passedNwList.add(nw);
+ }
}
if (ipVersion != IpVersionChoice.UNDEFINED) {
LOG.debug("vpnInstanceOpDataEntry is getting update with ip address family {} for VPN {}",
continue;
}
IpVersionChoice ipVers = neutronvpnUtils.getIpVersionFromString(sm.getSubnetIp());
+ if (ipVers.isIpVersionChosen(IpVersionChoice.IPV4)) {
+ continue;
+ }
if (ipVers.isIpVersionChosen(IpVersionChoice.IPV6)) {
updateVpnInternetForSubnet(sm, vpnId, false);
}
ipVersion = ipVersion.addVersion(ipVers);
}
}
- if (!ipVersion.isIpVersionChosen(IpVersionChoice.IPV4)) {
+ if (ipVersion != IpVersionChoice.UNDEFINED) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(), IpVersionChoice.IPV6, false);
LOG.info("disassociateExtNetworkFromVpn: withdraw IPv6 Internet default route from VPN {}",
vpnId.getValue());
- neutronvpnUtils.updateVpnInstanceWithFallback(vpnId, false);
+ neutronvpnUtils.updateVpnInstanceWithFallback(/*routerId*/ null, vpnId, false);
}
return true;
}
protected void addV6PrivateSubnetToExtNetwork(@Nonnull Uuid routerId, @Nonnull Uuid internetVpnId,
@Nonnull Subnetmap subnetMap) {
updateVpnInternetForSubnet(subnetMap, internetVpnId, true);
- if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(
- IpVersionChoice.IPV6, routerId, true)) {
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, internetVpnId, true);
+ if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(IpVersionChoice.IPV6, routerId, true)) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(internetVpnId.getValue(), IpVersionChoice.IPV6, true);
LOG.info("addV6PrivateSubnetToExtNetwork: Advertise IPv6 Private Subnet {} to Internet VPN {}",
- subnetMap.getId(), internetVpnId.getValue());
+ subnetMap.getId().getValue(), internetVpnId.getValue());
}
- neutronvpnUtils.updateVpnInstanceWithFallback(internetVpnId, true);
}
protected void removeV6PrivateSubnetToExtNetwork(@Nonnull Uuid routerId, @Nonnull Uuid internetVpnId,
@Nonnull Subnetmap subnetMap) {
updateVpnInternetForSubnet(subnetMap, internetVpnId, false);
- if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChange(
- IpVersionChoice.IPV6, routerId, false)) {
- neutronvpnUtils.updateVpnInstanceWithIpFamily(internetVpnId.getValue(), IpVersionChoice.IPV6, false);
- LOG.info("removeV6PrivateSubnetToExtNetwork: withdraw IPv6 Private subnet {} from Internet VPN {}",
- subnetMap.getId(), internetVpnId.getValue());
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, internetVpnId, false);
+ }
+
+ protected void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove) {
+ if (neutronvpnUtils.isV6SubnetPartOfRouter(routerId)) {
+ LOG.debug("processV6InternetFlowsForRtr: Successfully {} V6 internet vpn {} default fallback rule "
+ + "for the router {}", addOrRemove == NwConstants.ADD_FLOW ? "added" : "removed",
+ internetVpnId.getValue(), routerId.getValue());
+ neutronvpnUtils.updateVpnInstanceWithFallback(routerId, internetVpnId, addOrRemove == NwConstants.ADD_FLOW
+ ? true : false);
}
- neutronvpnUtils.updateVpnInstanceWithFallback(internetVpnId, false);
}
}
public String getOpenDaylightVniRangesConfig() {
return nvManager.getOpenDaylightVniRangesConfig();
}
+
+ @Override
+ public void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove) {
+ nvManager.programV6InternetFallbackFlow(routerId, internetVpnId, addOrRemove);
+ }
}
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.netvirt.elanmanager.api.IElanService;
-import org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice;
import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronConstants;
import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.VpnInterfaces;
import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.SubnetsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPortsKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.ExternalGatewayInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.external_gateway_info.ExternalFixedIps;
SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, netsIdentifier,
networkss);
LOG.trace("Updated externalnetworks successfully to CONFIG Datastore");
- //get vpn external form this network external to setup vpnInternet for ipv6
- Uuid vpnExternal = neutronvpnUtils.getVpnForNetwork(extNetId);
- if (vpnExternal == null) {
- LOG.debug("addExternalNetworkToRouter : no vpnExternal for Network {}", extNetId);
- }
- LOG.debug("addExternalNetworkToRouter : the vpnExternal {}", vpnExternal);
- //get subnetmap associate to the router, any subnetmap "external" could be existing
- List<Subnetmap> snList = neutronvpnUtils.getNeutronRouterSubnetMaps(routerId);
- LOG.debug("addExternalNetworkToRouter : the vpnExternal {} subnetmap to be set with vpnInternet {}",
- vpnExternal, snList);
- for (Subnetmap sn : snList) {
- if (sn.getInternetVpnId() == null) {
- continue;
- }
- IpVersionChoice ipVers = NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
- if (ipVers == IpVersionChoice.IPV6) {
- LOG.debug("addExternalNetworkToRouter : setup vpnInternet IPv6 for vpnExternal {} subnetmap {}",
- vpnExternal, sn);
- nvpnManager.updateVpnInternetForSubnet(sn, vpnExternal, true);
- }
- }
} catch (TransactionCommitFailedException | ReadFailedException ex) {
LOG.error("Creation of externalnetworks failed for {}",
extNetId.getValue(), ex);
LOG.error("removeExternalNetworkFromRouter: Failed to remove provider network {} from router {}",
origExtNetId.getValue(), routerId.getValue(), ex);
}
-
- // Remove the vpnInternetId fromSubnetmap
- Network net = neutronvpnUtils.getNeutronNetwork(nets.getId());
- List<Uuid> submapIds = neutronvpnUtils.getPrivateSubnetsToExport(net, /*internetVpnId*/ null);
- for (Uuid snId : submapIds) {
- Subnetmap subnetMap = neutronvpnUtils.getSubnetmap(snId);
- if (subnetMap == null || subnetMap.getInternetVpnId() == null) {
- LOG.error("removeExternalNetworkFromRouter: Can not find Subnetmap for SubnetId {} in ConfigDS",
- snId.getValue());
- continue;
- }
- LOG.trace("removeExternalNetworkFromRouter: Remove Internet VPN Id {} from SubnetMap {}",
- subnetMap.getInternetVpnId(), subnetMap.getId());
- IpVersionChoice ipVers = NeutronvpnUtils.getIpVersionFromString(subnetMap.getSubnetIp());
- if (ipVers == IpVersionChoice.IPV6) {
- nvpnManager.updateVpnInternetForSubnet(subnetMap, subnetMap.getInternetVpnId(), false);
- LOG.debug("removeExternalNetworkFromRouter: Withdraw IPv6 routes from VPN {}",
- subnetMap.getInternetVpnId());
- }
- }
}
public void addExternalRouter(Router update) {
}
public void updateVpnInstanceWithIpFamily(String vpnName, IpVersionChoice ipVersion, boolean add) {
- VpnInstanceOpDataEntry vpnInstanceOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(vpnName);
- if (vpnInstanceOpDataEntry == null) {
- return;
- }
- if (vpnInstanceOpDataEntry.getType() == VpnInstanceOpDataEntry.Type.L2) {
- LOG.debug("updateVpnInstanceWithIpFamily: Update VpnInstance {} with ipFamily {}."
- + "VpnInstanceOpDataEntry is L2 instance. Do nothing.", vpnName, ipVersion);
- return;
- }
- if (ipVersion == IpVersionChoice.UNDEFINED) {
- LOG.debug("updateVpnInstanceWithIpFamily: Update VpnInstance {} with Undefined address family"
- + "is not allowed. Do nothing", vpnName);
- return;
- }
jobCoordinator.enqueueJob("VPN-" + vpnName, () -> {
+ VpnInstanceOpDataEntry vpnInstanceOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(vpnName);
+ if (vpnInstanceOpDataEntry == null) {
+ return Collections.emptyList();
+ }
+ if (vpnInstanceOpDataEntry.getType() == VpnInstanceOpDataEntry.Type.L2) {
+ LOG.debug("updateVpnInstanceWithIpFamily: Update VpnInstance {} with ipFamily {}."
+ + "VpnInstanceOpDataEntry is L2 instance. Do nothing.", vpnName, ipVersion);
+ return Collections.emptyList();
+ }
+ if (ipVersion == IpVersionChoice.UNDEFINED) {
+ LOG.debug("updateVpnInstanceWithIpFamily: Update VpnInstance {} with Undefined address family"
+ + "is not allowed. Do nothing", vpnName);
+ return Collections.emptyList();
+ }
VpnInstanceOpDataEntryBuilder builder = new VpnInstanceOpDataEntryBuilder(vpnInstanceOpDataEntry);
boolean ipConfigured = add;
if (ipVersion.isIpVersionChosen(IpVersionChoice.IPV4AND6)) {
router.getUuid().getValue(), extNet.getUuid().getValue());
continue;
}
- subList.addAll(getSubnetsforVpn(rtrId));
+ subList.addAll(getNeutronRouterSubnetIds(rtrId));
}
return subList;
}
- public void updateVpnInstanceWithFallback(Uuid vpnName, boolean add) {
+ public void updateVpnInstanceWithFallback(Uuid routerId, Uuid vpnName, boolean add) {
VpnInstanceOpDataEntry vpnInstanceOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(vpnName.getValue());
if (vpnInstanceOpDataEntry == null) {
LOG.error("updateVpnInstanceWithFallback: vpnInstanceOpDataEntry not found for vpn {}", vpnName);
return;
}
Long internetBgpVpnId = vpnInstanceOpDataEntry.getVpnId();
- List<Uuid> routerIds = getRouterIdListforVpn(vpnName);
+ List<Uuid> routerIds = new ArrayList<>();
+ //Handle router specific V6 internet fallback flow else handle all V6 external routers
+ if (routerId != null) {
+ routerIds.add(routerId);
+ } else {
+ //This block will execute for ext-nw to Internet VPN association/disassociation event.
+ routerIds = getRouterIdListforVpn(vpnName);
+ }
if (routerIds == null || routerIds.isEmpty()) {
LOG.error("updateVpnInstanceWithFallback: router not found for vpn {}", vpnName);
return;
}
for (BigInteger dpnId : dpnIds) {
if (add) {
- ipV6InternetDefRt.installDefaultRoute(dpnId, internetBgpVpnId, vpnId);
+ ipV6InternetDefRt.installDefaultRoute(dpnId, rtrId.getValue(), internetBgpVpnId, vpnId);
} else {
- ipV6InternetDefRt.removeDefaultRoute(dpnId, internetBgpVpnId, vpnId);
+ ipV6InternetDefRt.removeDefaultRoute(dpnId, rtrId.getValue(), internetBgpVpnId, vpnId);
}
}
}
org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id
.VpnInstance::getVpnId).orElse(null);
}
+
+ protected boolean isV6SubnetPartOfRouter(Uuid routerId) {
+ List<Subnetmap> subnetList = getNeutronRouterSubnetMapList(routerId);
+ for (Subnetmap sm: subnetList) {
+ if (sm == null) {
+ continue;
+ }
+ IpVersionChoice ipVers = getIpVersionFromString(sm.getSubnetIp());
+ //skip further subnet processing once found first V6 subnet for the router
+ if (ipVers.isIpVersionChosen(IpVersionChoice.IPV6)) {
+ return true;
+ }
+ }
+ return false;
+ }
}