QR-Tap port update fix 34/49034/2
authorMichal Cmarada <mcmarada@cisco.com>
Thu, 8 Dec 2016 13:07:40 +0000 (14:07 +0100)
committerMichal Cmarada <mcmarada@cisco.com>
Thu, 8 Dec 2016 13:07:40 +0000 (14:07 +0100)
Change-Id: Ia44d12b2da8dda5811b3b108cd1acb6feee52ad7
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
neutron-mapper/src/main/java/org/opendaylight/groupbasedpolicy/neutron/mapper/mapping/NeutronPortAware.java

index 01b92e1e3889c1de3601ec5140b346800a893aab..e240de078eb5452bf67f5f1faed56e8033529f03 100644 (file)
@@ -544,15 +544,15 @@ public class NeutronPortAware implements NeutronAware<Port> {
     @Override
     public void onUpdated(Port oldPort, Port newPort, Neutron oldNeutron, Neutron newNeutron) {
         LOG.trace("updated port - OLD: {}\nNEW: {}", oldPort, newPort);
-        onDeleted(oldPort, oldNeutron, newNeutron, false);
+        onDeleted(oldPort, oldNeutron, false);
         onCreated(newPort, newNeutron, false);
     }
 
     @Override public void onDeleted(Port deletedItem, Neutron oldNeutron, Neutron newNeutron) {
-        onDeleted(deletedItem, oldNeutron, newNeutron, true);
+        onDeleted(deletedItem, oldNeutron, true);
     }
 
-    public void onDeleted(Port port, Neutron oldNeutron, Neutron newNeutron, boolean removeBaseEpMapping) {
+    public void onDeleted(Port port, Neutron oldNeutron, boolean removeBaseEpMapping) {
         LOG.trace("deleted port - {}", port);
         if (PortUtils.isRouterInterfacePort(port)) {
             LOG.trace("Port is router interface port: {}", port.getUuid().getValue());
@@ -591,7 +591,9 @@ public class NeutronPortAware implements NeutronAware<Port> {
             UniqueId portId = new UniqueId(port.getUuid().getValue());
             PortByBaseEndpointKey portByBaseEndpointKey = new PortByBaseEndpointKey(port.getMacAddress().getValue(),
                     MacAddressType.class, new ContextId(port.getNetworkId().getValue()), MappingUtils.L2_BRDIGE_DOMAIN);
-            removeBaseEndpointMappings(portByBaseEndpointKey, portId, rwTx);
+            if (removeBaseEpMapping) {
+                removeBaseEndpointMappings(portByBaseEndpointKey, portId, rwTx);
+            }
             DataStoreHelper.submitToDs(rwTx);
         } else if (PortUtils.isDhcpPort(port)) {
             LOG.trace("Port is DHCP port: {}", port.getUuid().getValue());