From 18628cc267bf4a16e7fbdd22a78403a395a95d5a Mon Sep 17 00:00:00 2001 From: karthikeyan Date: Wed, 25 Jan 2017 13:35:05 +0530 Subject: [PATCH] Bug 7667: SNAT table 46&44 are not getting programmed when private BGPVPN Problem Description: ===================== SNAT: Table 46(OUTBOUND_NAPT) and table 44 (INBOUND_NAPT) are not getting programmed (SNAT Forward Traffic and SNAT Reverse Traffic) with NAT translation when router is associated with Private/Internal BGP-VPN.Due to this issue, SNAT traffic is getting failed when interval bgp-vpn is configured. Root Cause of the Problem: ========================== As part of bug (Bug 7478) fix SNAT traffic is used to send router-gw mac address instead of VM mac. With this code changes router gw-mac was getting from external-router Yang Model using router name as key. When private/internal bgp-vpn is configured router-id (Internal Private VPN ID) should be replaced with created private/internal bgp-vpn id. With this approach when querying external-router Yang model for getting router-gw mac address using new router-id (bgp-vpn id) will not match with router-name. Solution: =========== When querying external-router yang model for getting router-gw mac address it should use old router-id instead of bgp-vpn id. For doing this change in NAPTEventHandler re-aligned the router-gw mac address code to appropriate place to be working as expected. Change-Id: Ieefd799d6b2349464bfb737e3fcc8101036c3619 Signed-off-by: karthikeyan --- .../natservice/internal/NaptEventHandler.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java b/vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java index 59170eae2d..62eac43f58 100644 --- a/vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java +++ b/vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java @@ -94,14 +94,6 @@ public class NaptEventHandler { try { Long routerId = naptEntryEvent.getRouterId(); LOG.info("NAT Service : handleEvent() entry for IP {}, port {}, routerID {}", naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber(), routerId); - // Get the External Gateway MAC Address - String extGwMacAddress = NatUtil.getExtGwMacAddFromRouterId(dataBroker, routerId); - if (extGwMacAddress != null) { - LOG.debug("NAT Service : External Gateway MAC address {} found for External Router ID {}", extGwMacAddress, routerId); - } else { - LOG.error("NAT Service : No External Gateway MAC address found for External Router ID {}", routerId); - return; - } //Get the DPN ID BigInteger dpnId = NatUtil.getPrimaryNaptfromRouterId(dataBroker, routerId); long bgpVpnId = NatConstants.INVALID_ID; @@ -125,7 +117,14 @@ public class NaptEventHandler { } if(naptEntryEvent.getOperation() == NAPTEntryEvent.Operation.ADD) { LOG.debug("NAT Service : Inside Add operation of NaptEventHandler"); - + // Get the External Gateway MAC Address + String extGwMacAddress = NatUtil.getExtGwMacAddFromRouterId(dataBroker, routerId); + if (extGwMacAddress != null) { + LOG.debug("NAT Service : External Gateway MAC address {} found for External Router ID {}", extGwMacAddress, routerId); + } else { + LOG.error("NAT Service : No External Gateway MAC address found for External Router ID {}", routerId); + return; + } //Get the external network ID from the ExternalRouter model Uuid networkId = NatUtil.getNetworkIdFromRouterId(dataBroker, routerId); if(networkId == null ){ -- 2.36.6