this.natOverVxlanUtil = natOverVxlanUtil;
}
- protected void removeSnatFlowsInOldNaptSwitch(String routerName, Uint32 routerId, Uint64 naptSwitch,
+ protected void removeSnatFlowsInOldNaptSwitch(Routers extRouter, Uint32 routerId, Uint64 naptSwitch,
@Nullable Map<String, Uint32> externalIpmap, String externalVpnName,
TypedReadWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException {
//remove SNAT flows in old NAPT SWITCH
- Uuid extNetworkId = NatUtil.getNetworkIdFromRouterName(dataBroker, routerName);
- String vpnName = getExtNetworkVpnName(routerName, extNetworkId);
+ String routerName = extRouter.getRouterName();
+ Uuid networkId = NatUtil.getNetworkIdFromRouterName(dataBroker, routerName);
+ String vpnName = getExtNetworkVpnName(routerName, networkId);
if (vpnName == null) {
LOG.error("removeSnatFlowsInOldNaptSwitch : Vpn is not associated to externalN/w of router {}",
routerName);
return;
}
- ProviderTypes extNwProvType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerName, extNetworkId);
+ ProviderTypes extNwProvType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerName, networkId);
if (extNwProvType == null) {
LOG.error("removeSnatFlowsInOldNaptSwitch : Unable to retrieve the External Network Provider Type "
+ "for Router {}", routerName);
// Remove the NAPT_PFIB_TABLE(47) flow entry forwards the packet to Fib Table for outbound traffic
// matching on the vpn ID.
boolean switchSharedByRouters = false;
+ Uuid extNetworkId = extRouter.getNetworkId();
if (extNetworkId != null && !NatUtil.checkForRoutersWithSameExtNetAndNaptSwitch(
dataBroker, extNetworkId, routerName, naptSwitch)) {
List<String> routerNamesAssociated = getRouterIdsForExtNetwork(extNetworkId);
return routerUuidsAsString;
}
- public boolean isNaptSwitchDown(String routerName, Uint32 routerId, Uint64 dpnId, Uint64 naptSwitch,
+ public boolean isNaptSwitchDown(Routers extRouter, Uint32 routerId, Uint64 dpnId, Uint64 naptSwitch,
Uint32 routerVpnId, Collection<String> externalIpCache,
TypedReadWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException {
- return isNaptSwitchDown(routerName, routerId, dpnId, naptSwitch, routerVpnId, externalIpCache, true,
+ return isNaptSwitchDown(extRouter, routerId, dpnId, naptSwitch, routerVpnId, externalIpCache, true,
confTx);
}
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
- public boolean isNaptSwitchDown(String routerName, Uint32 routerId, Uint64 dpnId, Uint64 naptSwitch,
+ public boolean isNaptSwitchDown(Routers extRouter, Uint32 routerId, Uint64 dpnId, Uint64 naptSwitch,
Uint32 routerVpnId, Collection<String> externalIpCache, boolean isClearBgpRts,
TypedReadWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException {
externalIpsCache = externalIpCache;
+ String routerName = extRouter.getRouterName();
if (!naptSwitch.equals(dpnId)) {
LOG.debug("isNaptSwitchDown : DpnId {} is not a naptSwitch {} for Router {}",
dpnId, naptSwitch, routerName);
LOG.error("isNaptSwitchDown : Invalid routerId returned for routerName {}", routerName);
return true;
}
- Uuid networkId = NatUtil.getNetworkIdFromRouterName(dataBroker, routerName);
+ Uuid networkId = extRouter.getNetworkId();
String vpnName = getExtNetworkVpnName(routerName, networkId);
//elect a new NaptSwitch
naptSwitch = naptSwitchSelector.selectNewNAPTSwitch(routerName, Arrays.asList(naptSwitch));
if (vpnName != null) {
//NAPT PFIB point to FIB table for outbound traffic
- Uint32 vpnId = NatUtil.getVpnId(dataBroker, vpnName);
+ org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn
+ .instance.to.vpn.id.VpnInstance vpnInstance = NatUtil.getVpnIdToVpnInstance(dataBroker, vpnName);
+ if (vpnInstance == null) {
+ LOG.error("NAT Service : installNaptPfibEntry vpnInstance not found for {}", vpnName);
+ return;
+ }
+ Uint32 vpnId = vpnInstance.getVpnId();
if (vpnName.equals(networkId.getValue())) {
// below condition valid only for flat/vlan use-case
boolean shouldInstallNaptPfibWithExtNetworkVpnId = true;
}
//Install Fib entries for ExternalIps & program 36 -> 44
Collection<String> externalIps = NatUtil.getExternalIpsForRouter(dataBroker, routerId);
- String rd = NatUtil.getVpnRd(dataBroker, vpnName);
+ String rd = vpnInstance.getVrfId();
for (String externalIp : externalIps) {
removeFibEntry(rd, externalIp);
LOG.debug("installSnatFlows : advToBgpAndInstallFibAndTsFlows in naptswitch id {} "