21->26 flow missing for NAT use case 70/74770/1
authorshaik <shaik.b@altencalsoftlabs.com>
Thu, 2 Aug 2018 14:55:26 +0000 (20:25 +0530)
committershaik <shaik.b@altencalsoftlabs.com>
Thu, 2 Aug 2018 14:57:50 +0000 (20:27 +0530)
Description
-----------
21->26 flow is missing with the below use case

Use case :

1. create network
2. create subnet
3. create vm
4. create router
5. add subnet to router
6. create external network and subnet
7. create external bgpvpn
8. associate external bgpvpn to external network
9. openstack router set router1 --external-gateway myextnet10
       --disable-snat
10. openstack router set router1 --external-gateway myextnet10
       --enable-snat

Notice that the 21->26 flow is missing

Changes are done to install the 21->26 flows when we disable and
enable SNAT

Issue : NETVIRT-1294

Change-Id: I39a2b4d20aec4694aa269c334dc5635e7d7acd7e
Signed-off-by: shaik <shaik.b@altencalsoftlabs.com>
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java

index 5aabff42513615faaf51ea443aeb7e24ba4268b8..fc62293aea708ddef1d7b2f396ce41bd8e5ecf2b 100644 (file)
@@ -1292,7 +1292,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         final long finalBgpVpnId = bgpVpnId;
         coordinator.enqueueJob(NatConstants.NAT_DJC_PREFIX + update.key(), () -> {
             List<ListenableFuture<Void>> futures = new ArrayList<>();
-            futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, writeFlowInvTx -> {
+            futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeFlowInvTx -> {
                 futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, removeFlowInvTx -> {
                     Uuid networkId = original.getNetworkId();
                     if (originalSNATEnabled != updatedSNATEnabled) {
@@ -1305,6 +1305,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                                     removeFlowInvTx);
                         } else {
                             LOG.info("update : SNAT enabled for Router {}", original.getRouterName());
+                            addOrDelDefFibRouteToSNAT(routerName, routerId, finalBgpVpnId, bgpVpnUuid,
+                                    true, writeFlowInvTx);
                             handleEnableSnat(original, routerId, dpnId, finalBgpVpnId, removeFlowInvTx);
                         }
                     }