Bug 7445: Improve the performance on bulk create.
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / netvirt / openstack / netvirt / impl / TenantNetworkManagerImpl.java
index 4152a793d36e82615fbc38105e94b72d026febad..a354b8f9ff0ed08b8e780e52a63590a5196061f7 100644 (file)
@@ -128,11 +128,7 @@ public class TenantNetworkManagerImpl implements ConfigInterface, TenantNetworkM
         String neutronPortId = southbound.getInterfaceExternalIdsValue(terminationPointAugmentation,
                 Constants.EXTERNAL_ID_INTERFACE_ID);
         if (neutronPortId != null) {
-            NeutronPort neutronPort = neutronPortCache.getPort(neutronPortId);
-            if ( null == neutronPort) {
-                LOG.debug("neutronPort is null, checking the clean up cache.");
-                neutronPort = neutronL3Adapter.getPortFromCleanupCache(neutronPortId);
-            }
+            NeutronPort neutronPort = neutronL3Adapter.getPortPreferablyFromCleanupCache(neutronPortId);
             if (neutronPort != null) {
                 neutronNetwork = neutronNetworkCache.getNetwork(neutronPort.getNetworkUUID());
                 if (null == neutronNetwork) {
@@ -163,16 +159,7 @@ public class TenantNetworkManagerImpl implements ConfigInterface, TenantNetworkM
         String neutronPortId = southbound.getInterfaceExternalIdsValue(terminationPointAugmentation,
                 Constants.EXTERNAL_ID_INTERFACE_ID);
         if (neutronPortId != null) {
-            neutronPort = neutronPortCache.getPort(neutronPortId);
-            if (null == neutronPort) {
-                LOG.debug("neutronPort is null checking the clean up cache.");
-                neutronPort = neutronL3Adapter.getPortFromCleanupCache(neutronPortId);
-            }
-        }
-        if (neutronPort != null) {
-            LOG.debug("mapped to {}", neutronPort);
-        } else {
-            LOG.warn("getTenantPort did not find port for {}", terminationPointAugmentation.getName());
+            neutronPort = neutronL3Adapter.getPortPreferablyFromCleanupCache(neutronPortId);
         }
 
         return neutronPort;
@@ -189,11 +176,7 @@ public class TenantNetworkManagerImpl implements ConfigInterface, TenantNetworkM
     }
 
     private boolean isInterfacePresentInTenantNetwork (String portId, String networkId) {
-        NeutronPort neutronPort = neutronPortCache.getPort(portId);
-        if (null == neutronPort) {
-            LOG.debug("neutronPort is null checking the clean up cache.");
-            neutronPort = neutronL3Adapter.getPortFromCleanupCache(portId);
-        }
+        NeutronPort neutronPort = neutronL3Adapter.getPortPreferablyFromCleanupCache(portId);
         return neutronPort != null && neutronPort.getNetworkUUID().equalsIgnoreCase(networkId);
     }