NETVIRT-1586
[netvirt.git] / ipv6service / impl / src / main / java / org / opendaylight / netvirt / ipv6service / VirtualNetwork.java
index e69737af82a08d05aed94d6e45c79d2c6780d382..5ab75328638971da67393dd5630e48269c9e4e7a 100644 (file)
@@ -37,16 +37,16 @@ public class VirtualNetwork implements IVirtualNetwork {
         return networkUUID;
     }
 
-    public void updateDpnPortInfo(Uint64 dpnId, Long ofPort, int addOrRemove) {
+    public void updateDpnPortInfo(Uint64 dpnId, Long ofPort,Uuid portId, int addOrRemove) {
         if (dpnId == null) {
             return;
         }
         synchronized (networkUUID.getValue()) {
             DpnInterfaceInfo dpnInterface = dpnIfaceList.computeIfAbsent(dpnId, key -> new DpnInterfaceInfo(dpnId));
             if (addOrRemove == Ipv6ServiceConstants.ADD_ENTRY) {
-                dpnInterface.updateofPortList(ofPort);
+                dpnInterface.updateofPortMap(ofPort, portId);
             } else {
-                dpnInterface.removeOfPortFromList(ofPort);
+                dpnInterface.removeOfPortFromMap(ofPort);
             }
         }
     }
@@ -102,9 +102,10 @@ public class VirtualNetwork implements IVirtualNetwork {
     public void removeSelf() {
         synchronized (networkUUID.getValue()) {
             dpnIfaceList.values().forEach(dpnInterfaceInfo -> {
-                dpnInterfaceInfo.clearOfPortList();
+                dpnInterfaceInfo.clearPortList();
                 dpnInterfaceInfo.clearNdTargetFlowInfo();
                 dpnInterfaceInfo.clearsubnetCidrPuntFlowInfo();
+                dpnInterfaceInfo.clearOvsNaResponderFlowConfigured();
             });
 
             clearDpnInterfaceList();
@@ -124,12 +125,15 @@ public class VirtualNetwork implements IVirtualNetwork {
         Uint64 dpId;
         int rsPuntFlowConfigured;
         final Set<Uuid> subnetCidrPuntFlowList = ConcurrentHashMap.newKeySet();
-        final Set<Long> ofPortList = ConcurrentHashMap.newKeySet();
         final Set<Ipv6Address> ndTargetFlowsPunted = ConcurrentHashMap.newKeySet();
+        ConcurrentMap<Long, Uuid> ofPortMap;
+        ConcurrentMap<Uuid, Integer> ovsNaResponderFlowConfigured;
 
         DpnInterfaceInfo(Uint64 dpnId) {
             dpId = dpnId;
+            ofPortMap = new ConcurrentHashMap();
             rsPuntFlowConfigured = Ipv6ServiceConstants.FLOWS_NOT_CONFIGURED;
+            ovsNaResponderFlowConfigured = new ConcurrentHashMap();
         }
 
         public void setDpId(Uint64 dpId) {
@@ -182,16 +186,28 @@ public class VirtualNetwork implements IVirtualNetwork {
             this.ndTargetFlowsPunted.clear();
         }
 
-        public void updateofPortList(Long ofPort) {
-            this.ofPortList.add(ofPort);
+        public void setOvsNaResponderFlowConfiguredStatus(Uuid interfaceName, int lportTag, int addOrRemove) {
+            if (addOrRemove == Ipv6ServiceConstants.ADD_ENTRY) {
+                this.ovsNaResponderFlowConfigured.put(interfaceName, lportTag);
+            } else {
+                this.ovsNaResponderFlowConfigured.remove(interfaceName);
+            }
+        }
+
+        public void clearOvsNaResponderFlowConfigured() {
+            this.ovsNaResponderFlowConfigured.clear();
+        }
+
+        public void updateofPortMap(Long ofPort, Uuid portId) {
+            this.ofPortMap.put(ofPort, portId);
         }
 
-        public void removeOfPortFromList(Long ofPort) {
-            this.ofPortList.remove(ofPort);
+        public void removeOfPortFromMap(Long ofPort) {
+            this.ofPortMap.remove(ofPort);
         }
 
-        public void clearOfPortList() {
-            this.ofPortList.clear();
+        public void clearPortList() {
+            this.ofPortMap.clear();
         }
 
         public void clearsubnetCidrPuntFlowInfo() {
@@ -201,8 +217,8 @@ public class VirtualNetwork implements IVirtualNetwork {
         @Override
         public String toString() {
             return "DpnInterfaceInfo [dpId=" + dpId + " rsPuntFlowConfigured=" + rsPuntFlowConfigured
-                    + "subnetCidrPuntFlowList=" + subnetCidrPuntFlowList + " ofPortList="
-                    + ofPortList + "]";
+                    + "subnetCidrPuntFlowList=" + subnetCidrPuntFlowList + " ofPortMap ="
+                    + ofPortMap  + "]";
         }
     }
 }