unbind service not removing lport dispatcher flow 32/31932/1
authorFaseela K <faseela.k@ericsson.com>
Tue, 29 Dec 2015 13:13:50 +0000 (18:43 +0530)
committerFaseela K <faseela.k@ericsson.com>
Tue, 29 Dec 2015 13:13:50 +0000 (18:43 +0530)
Change-Id: I76e797c1307a34b4c0519c06bbf5cd0eb03c446f
Signed-off-by: Faseela K <faseela.k@ericsson.com>
interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java
interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigUnbindHelper.java
interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/statehelpers/FlowBasedServicesStateBindHelper.java
interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/statehelpers/FlowBasedServicesStateUnbindHelper.java
interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/utilities/FlowBasedServicesUtils.java

index de503d1112a6e97024592584f1737abaa0875f92..af22f84bf8fd9bac092b9ab37779964f41031297 100644 (file)
@@ -116,11 +116,11 @@ public class FlowBasedServicesConfigBindHelper {
         }
 
         if (!isCurrentServiceHighestPriority) {
-            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, iface, dataBroker,  t,
+            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, iface, t,
                     ifState.getIfIndex());
         } else {
             BoundServices serviceToReplace = tmpServicesMap.get(highestPriority);
-            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, serviceToReplace, iface, dataBroker, t,
+            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, serviceToReplace, iface, t,
                     ifState.getIfIndex());
             int vlanId = 0;
             List<MatchInfo> matches = null;
@@ -132,7 +132,7 @@ public class FlowBasedServicesConfigBindHelper {
             }
 
             if (matches != null) {
-                FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, dataBroker, t);
+                FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, t);
                 FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew, dataBroker, t,
                         matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
             }
index bfeed508e0907bc9eedc6bd55254d6396fba591a..cc57ff0e24bfe263d28dbcc4834585ce2050fb6a 100644 (file)
@@ -75,7 +75,7 @@ public class FlowBasedServicesConfigUnbindHelper {
         List<BoundServices> boundServices = servicesInfo.getBoundServices();
         if (boundServices.isEmpty()) {
             // Remove entry from Ingress Table.
-            FlowBasedServicesUtils.removeIngressFlow(iface, boundServiceOld, dpId, dataBroker, t);
+            FlowBasedServicesUtils.removeIngressFlow(iface, boundServiceOld, dpId, t);
             if (t != null) {
                 futures.add(t.submit());
             }
@@ -92,7 +92,7 @@ public class FlowBasedServicesConfigUnbindHelper {
         }
 
         if (highestPriority < boundServiceOld.getServicePriority()) {
-            FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, boundServiceOld, dataBroker, t);
+            FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, boundServiceOld, t);
             if (t != null) {
                 futures.add(t.submit());
             }
@@ -107,10 +107,10 @@ public class FlowBasedServicesConfigUnbindHelper {
         }
 
         BoundServices toBeMoved = tmpServicesMap.get(highestPriority);
-        FlowBasedServicesUtils.removeIngressFlow(iface, boundServiceOld, dpId, dataBroker, t);
+        FlowBasedServicesUtils.removeIngressFlow(iface, boundServiceOld, dpId, t);
         FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, toBeMoved, dataBroker, t,
                 matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
-        FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, toBeMoved, dataBroker, t);
+        FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, toBeMoved, t);
 
         if (t != null) {
             futures.add(t.submit());
index 916fc11a5cf2de797507878a2b760d2ebb9d7e21..2516304f233f2a9e0f90ab08548120c6385a26f4 100644 (file)
@@ -64,7 +64,6 @@ public class FlowBasedServicesStateBindHelper {
         NodeConnectorId nodeConnectorId = FlowBasedServicesUtils.getNodeConnectorIdFromInterface(iface, dataBroker);
         long portNo = Long.parseLong(IfmUtil.getPortNoFromNodeConnectorId(nodeConnectorId));
         BigInteger dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId));
-        Long lportTag = FlowBasedServicesUtils.getLPortTag(iface, dataBroker);
         int vlanId = 0;
         List<MatchInfo> matches = null;
         if (iface.getType().isAssignableFrom(L2vlan.class)) {
@@ -79,13 +78,12 @@ public class FlowBasedServicesStateBindHelper {
 
         if (matches != null) {
             FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, highestPriorityBoundService,
-                    dataBroker, t, matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
+                    dataBroker, t, matches, ifaceState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
         }
 
         for (BoundServices boundService : allServices) {
             if (!boundService.equals(highestPriorityBoundService)) {
-                FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundService, iface,
-                         dataBroker, t, lportTag.intValue());
+                FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundService, iface, t, ifaceState.getIfIndex());
             }
         }
 
index 362a3bdfcff4353ebe342feb33b75a1303e0c972..aa0b9bc29641e23ce0ff5566fa66668206a2b2fd 100644 (file)
@@ -61,12 +61,11 @@ public class FlowBasedServicesStateUnbindHelper {
             return futures;
         }
         BigInteger dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId));
-        FlowBasedServicesUtils.removeIngressFlow(iface, highestPriorityBoundService, dpId,
-                dataBroker, t);
+        FlowBasedServicesUtils.removeIngressFlow(iface, highestPriorityBoundService, dpId, t);
 
         for (BoundServices boundService : allServices) {
             if (!boundService.equals(highestPriorityBoundService)) {
-                FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, boundService, dataBroker, t);
+                FlowBasedServicesUtils.removeLPortDispatcherFlow(dpId, iface, boundService, t);
             }
         }
 
index 221bff99ae740fd048235b9b7ff07b156f930461..0feb834d8c3f44d6b629f27ac23917e19909e984 100644 (file)
@@ -190,7 +190,7 @@ public class FlowBasedServicesUtils {
     }
 
     public static void installLPortDispatcherFlow(BigInteger dpId, BoundServices boundService, Interface iface,
-                                                  DataBroker dataBroker, WriteTransaction t, int interfaceTag) {
+                                                  WriteTransaction t, int interfaceTag) {
         LOG.debug("Installing LPort Dispatcher Flows {}, {}", dpId, iface);
         short serviceIndex = boundService.getServicePriority();
         String serviceRef = boundService.getServiceName();
@@ -226,8 +226,7 @@ public class FlowBasedServicesUtils {
         installFlow(dpId, ingressFlow, t);
     }
 
-    public static void removeIngressFlow(Interface iface, BoundServices serviceOld, BigInteger dpId,
-                                         DataBroker dataBroker, WriteTransaction t) {
+    public static void removeIngressFlow(Interface iface, BoundServices serviceOld, BigInteger dpId, WriteTransaction t) {
         LOG.debug("Removing Ingress Flows");
         String flowKeyStr = getFlowRef(dpId, iface.getName(), serviceOld);
         FlowKey flowKey = new FlowKey(new FlowId(flowKeyStr));
@@ -239,15 +238,13 @@ public class FlowBasedServicesUtils {
         t.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
     }
 
-    public static void removeLPortDispatcherFlow(BigInteger dpId, Interface iface, BoundServices boundServicesOld,
-                                                 DataBroker dataBroker, WriteTransaction t) {
+    public static void removeLPortDispatcherFlow(BigInteger dpId, Interface iface, BoundServices boundServicesOld, WriteTransaction t) {
         LOG.debug("Removing LPort Dispatcher Flows {}, {}", dpId, iface);
-        Long interfaceTag = FlowBasedServicesUtils.getLPortTag(iface, dataBroker);
 
         StypeOpenflow stypeOpenFlow = boundServicesOld.getAugmentation(StypeOpenflow.class);
-        String flowKeyStr = iface.getName() + boundServicesOld.getServicePriority() +
-                boundServicesOld.getServiceName() + stypeOpenFlow.getDispatcherTableId();
-        FlowKey flowKey = new FlowKey(new FlowId(flowKeyStr));
+        // build the flow and install it
+        String flowRef = getFlowRef(dpId, iface.getName(), boundServicesOld);
+        FlowKey flowKey = new FlowKey(new FlowId(flowRef));
         Node nodeDpn = buildInventoryDpnNode(dpId);
         InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
                 .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class)