X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=interfacemgr%2Finterfacemgr-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2Finterfacemgr%2Fservicebindings%2Fflowbased%2Fconfighelpers%2FFlowBasedServicesConfigBindHelper.java;h=e34e2b069a93d52a933e2a9a73b727994e090f5f;hb=refs%2Fchanges%2F50%2F31950%2F2;hp=1b02e87266bbbce07f2a8a2d55a2ea32ffa9ac75;hpb=c27f9ad4bdc259ff9709d433d3a1e8fc24fc215f;p=vpnservice.git diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java index 1b02e872..e34e2b06 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/servicebindings/flowbased/confighelpers/FlowBasedServicesConfigBindHelper.java @@ -40,7 +40,7 @@ public class FlowBasedServicesConfigBindHelper { public static List> bindService(InstanceIdentifier instanceIdentifier, BoundServices boundServiceNew, DataBroker dataBroker) { List> futures = new ArrayList<>(); - WriteTransaction t = dataBroker.newWriteOnlyTransaction(); + WriteTransaction transaction = dataBroker.newWriteOnlyTransaction(); String interfaceName = InstanceIdentifier.keyOf(instanceIdentifier.firstIdentifierOf(ServicesInfo.class)).getInterfaceName(); @@ -72,28 +72,23 @@ 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; List matches = null; if (iface.getType().isAssignableFrom(L2vlan.class)) { - IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class); - if( l2vlan != null){ - vlanId = l2vlan.getVlanId().getValue(); - } - matches = FlowBasedServicesUtils.getMatchInfoForVlanPortAtIngressTable(dpId, portNo, vlanId); + matches = FlowBasedServicesUtils.getMatchInfoForVlanPortAtIngressTable(dpId, portNo, iface); } else if (iface.getType().isAssignableFrom(Tunnel.class)){ matches = FlowBasedServicesUtils.getMatchInfoForTunnelPortAtIngressTable (dpId, portNo, iface); } if (matches != null) { - FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew, - dataBroker, t, matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, boundServiceNew, + transaction, matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); } - if (t != null) { - futures.add(t.submit()); + if (transaction != null) { + futures.add(transaction.submit()); } return futures; } @@ -112,35 +107,37 @@ public class FlowBasedServicesConfigBindHelper { highestPriority = boundService.getServicePriority(); } } - LOG.error("Reached unexpected part 1 of the code when handling bind service for interface: {}, when binding" + - "service: {}", iface, boundServiceNew); } if (!isCurrentServiceHighestPriority) { - FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, iface, dataBroker, t, - lportTag.intValue()); + FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, boundServiceNew, iface, transaction, + ifState.getIfIndex()); } else { BoundServices serviceToReplace = tmpServicesMap.get(highestPriority); - FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, serviceToReplace, iface, dataBroker, t, - lportTag.intValue()); - int vlanId = 0; + FlowBasedServicesUtils.installLPortDispatcherFlow(dpId, serviceToReplace, iface, transaction, + ifState.getIfIndex()); List matches = null; if (iface.getType().isAssignableFrom(L2vlan.class)) { - vlanId = iface.getAugmentation(IfL2vlan.class).getVlanId().getValue(); - matches = FlowBasedServicesUtils.getMatchInfoForVlanPortAtIngressTable(dpId, portNo, vlanId); + matches = FlowBasedServicesUtils.getMatchInfoForVlanPortAtIngressTable(dpId, portNo, iface); } else if (iface.getType().isAssignableFrom(Tunnel.class)){ matches = FlowBasedServicesUtils.getMatchInfoForTunnelPortAtIngressTable (dpId, portNo, iface); } if (matches != null) { - FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, dataBroker, t); - FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface.getName(), vlanId, boundServiceNew, dataBroker, t, - matches, lportTag.intValue(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + + WriteTransaction removeFlowTransaction = dataBroker.newWriteOnlyTransaction(); + FlowBasedServicesUtils.removeIngressFlow(iface, serviceToReplace, dpId, removeFlowTransaction); + futures.add(removeFlowTransaction.submit()); + + WriteTransaction installFlowTransaction = dataBroker.newWriteOnlyTransaction(); + FlowBasedServicesUtils.installInterfaceIngressFlow(dpId, iface, boundServiceNew, installFlowTransaction, + matches, ifState.getIfIndex(), IfmConstants.VLAN_INTERFACE_INGRESS_TABLE); + futures.add(installFlowTransaction.submit()); } } - if (t != null) { - futures.add(t.submit()); + if (transaction != null) { + futures.add(transaction.submit()); } return futures; }