unbind service not removing lport dispatcher flow
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / servicebindings / flowbased / confighelpers / FlowBasedServicesConfigBindHelper.java
index 0ea2819743f357c6e88ee081fd7cdba51ccb05d1..af22f84bf8fd9bac092b9ab37779964f41031297 100644 (file)
@@ -47,11 +47,12 @@ public class FlowBasedServicesConfigBindHelper {
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState =
                 InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceName, dataBroker);
         if (ifState == null || ifState.getOperStatus() == OperStatus.Down) {
-            LOG.info("Not Binding Service since for Interface: {}", interfaceName);
+            LOG.warn("Interface not up, not Binding Service for Interface: {}", interfaceName);
             return futures;
         }
 
         // Get the Parent ServiceInfo
+
         ServicesInfo servicesInfo = FlowBasedServicesUtils.getServicesInfoForInterface(interfaceName, dataBroker);
         if (servicesInfo == null) {
             LOG.error("Reached Impossible part 1 in the code during bind service for: {}", boundServiceNew);
@@ -71,7 +72,6 @@ public class FlowBasedServicesConfigBindHelper {
         long portNo = Long.parseLong(IfmUtil.getPortNoFromNodeConnectorId(nodeConnectorId));
         BigInteger dpId = new BigInteger(IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId));
 
-        Long lportTag = FlowBasedServicesUtils.getLPortTag(iface, dataBroker);
         if (allServices.size() == 1) {
             // If only one service present, install instructions in table 0.
             int vlanId = 0;
@@ -87,8 +87,8 @@ public class FlowBasedServicesConfigBindHelper {
             }
 
             if (matches != null) {
-                FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, vlanId, boundServiceNew,
-                        dataBroker, t, matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
+                FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew,
+                        dataBroker, t, matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
             }
 
             if (t != null) {
@@ -116,12 +116,12 @@ public class FlowBasedServicesConfigBindHelper {
         }
 
         if (!isCurrentServiceHighestPriority) {
-            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, iface, dataBroker,  t,
-                    lportTag.intValue());
+            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, iface, t,
+                    ifState.getIfIndex());
         } else {
             BoundServices serviceToReplace = tmpServicesMap.get(highestPriority);
-            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, serviceToReplace, iface, dataBroker, t,
-                    lportTag.intValue());
+            FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, serviceToReplace, iface, t,
+                    ifState.getIfIndex());
             int vlanId = 0;
             List<MatchInfo> matches = null;
             if (iface.getType().isAssignableFrom(L2vlan.class)) {
@@ -132,9 +132,9 @@ public class FlowBasedServicesConfigBindHelper {
             }
 
             if (matches != null) {
-                FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, dataBroker, t);
-                FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, vlanId, boundServiceNew, dataBroker, t,
-                        matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
+                FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, t);
+                FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew, dataBroker, t,
+                        matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE);
             }
         }