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;
}
@Override
- public List<ListenableFuture<Void>> unbindService(InstanceIdentifier<BoundServices> instanceIdentifier,
- BoundServices boundServiceOld) {
+ public List<ListenableFuture<Void>> unbindService(String interfaceName, BoundServices boundServiceOld,
+ List<BoundServices> boundServices) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
DataBroker dataBroker = interfaceMgrProvider.getDataBroker();
- String interfaceName =
- InstanceIdentifier.keyOf(instanceIdentifier.firstIdentifierOf(ServicesInfo.class)).getInterfaceName();
- Class<? extends ServiceModeBase> 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> 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<ListenableFuture<Void>> unbindServiceOnVlan(BoundServices boundServiceOld,
+ private static List<ListenableFuture<Void>> unbindService(BoundServices boundServiceOld,
List<BoundServices> 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<ListenableFuture<Void>> futures = new ArrayList<>();
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
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);
}