X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=interfacemanager%2Finterfacemanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fgenius%2Finterfacemanager%2Fservicebindings%2Fflowbased%2Fconfig%2Fhelpers%2FFlowBasedEgressServicesConfigUnbindHelper.java;h=57d2925a8fa2a78e3b23cb03c35ae1e3b683797e;hb=80a80017fcc372c3e6d3191f1054a0091587eac4;hp=84254ef777d87ec9ba6693bb8bc3d6e1f5302d69;hpb=580f76505bdd1aa772f1832dcce8fe706d3f3751;p=genius.git diff --git a/interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/servicebindings/flowbased/config/helpers/FlowBasedEgressServicesConfigUnbindHelper.java b/interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/servicebindings/flowbased/config/helpers/FlowBasedEgressServicesConfigUnbindHelper.java index 84254ef77..57d2925a8 100644 --- a/interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/servicebindings/flowbased/config/helpers/FlowBasedEgressServicesConfigUnbindHelper.java +++ b/interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/servicebindings/flowbased/config/helpers/FlowBasedEgressServicesConfigUnbindHelper.java @@ -21,11 +21,7 @@ import org.opendaylight.genius.mdsalutil.NwConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase; -import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo; import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,45 +54,30 @@ public class FlowBasedEgressServicesConfigUnbindHelper implements FlowBasedServi } @Override - public List> unbindService(InstanceIdentifier instanceIdentifier, - BoundServices boundServiceOld) { + public List> unbindService(String interfaceName, BoundServices boundServiceOld, + List boundServices) { List> futures = new ArrayList<>(); DataBroker dataBroker = interfaceMgrProvider.getDataBroker(); - String interfaceName = - InstanceIdentifier.keyOf(instanceIdentifier.firstIdentifierOf(ServicesInfo.class)).getInterfaceName(); - Class serviceMode = InstanceIdentifier - .keyOf(instanceIdentifier.firstIdentifierOf(ServicesInfo.class)).getServiceMode(); - - // Get the Parent ServiceInfo - ServicesInfo servicesInfo = FlowBasedServicesUtils.getServicesInfoForInterface(interfaceName, serviceMode, - dataBroker); - if (servicesInfo == null) { - LOG.error("Reached Impossible part in the code for bound service: {}", boundServiceOld); - return futures; - } org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface - ifState = InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(interfaceName, dataBroker); + ifState = InterfaceManagerCommonUtils.getInterfaceState(interfaceName, dataBroker); if (ifState == null) { LOG.info("Interface not operational, not unbinding Service for Interface: {}", interfaceName); return futures; } - List boundServices = servicesInfo.getBoundServices(); - // Split based on type of interface.... - if (L2vlan.class.equals(ifState.getType())) { - return unbindServiceOnVlan(boundServiceOld, boundServices, ifState, dataBroker); - } else if (Tunnel.class.equals(ifState.getType())) { - return unbindServiceOnTunnel(boundServiceOld, boundServices, ifState, dataBroker); + if (L2vlan.class.equals(ifState.getType()) + || Tunnel.class.equals(ifState.getType())) { + unbindService(boundServiceOld, boundServices, ifState, dataBroker); } return futures; } - private static List> unbindServiceOnVlan(BoundServices boundServiceOld, + private static List> unbindService(BoundServices boundServiceOld, List boundServices, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state .Interface ifaceState, DataBroker dataBroker) { - LOG.info("unbinding egress service {} for vlan port: {}", boundServiceOld.getServiceName(), ifaceState + LOG.info("unbinding egress service {} for interface: {}", boundServiceOld.getServiceName(), ifaceState .getName()); List> futures = new ArrayList<>(); WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); @@ -129,9 +110,10 @@ public class FlowBasedEgressServicesConfigUnbindHelper implements FlowBasedServi BoundServices lower = FlowBasedServicesUtils.getHighAndLowPriorityService(boundServices, low)[0]; short lowerServiceIndex = (short) (lower != null ? lower.getServicePriority() : low.getServicePriority() + 1); - LOG.trace("Installing new egress dispatcher table entry for lower service {}, match service index {}," + - " update service index {}", - low, NwConstants.DEFAULT_SERVICE_INDEX, lowerServiceIndex); + LOG.trace( + "Installing new egress dispatcher table entry for lower service {}, match service index {}," + + " update service index {}", + low, NwConstants.DEFAULT_SERVICE_INDEX, lowerServiceIndex); FlowBasedServicesUtils.installEgressDispatcherFlows(dpId, low, ifaceState.getName(), tx, ifaceState.getIfIndex(), NwConstants.DEFAULT_SERVICE_INDEX, lowerServiceIndex, iface); }