2 * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.interfacemanager.servicebindings.flowbased.config.helpers;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
12 import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.config.factory.FlowBasedServicesConfigAddable;
13 import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.utilities.FlowBasedServicesUtils;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.L2vlan;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.bound.services.state.list.BoundServicesState;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * AbstractFlowBasedServicesConfigBindHelper to enable flow based ingress/egress service binding for interfaces.
24 public abstract class AbstractFlowBasedServicesConfigBindHelper implements FlowBasedServicesConfigAddable {
26 private static final Logger LOG = LoggerFactory.getLogger(AbstractFlowBasedServicesConfigBindHelper.class);
29 public final void bindService(List<ListenableFuture<Void>> futures, String interfaceName,
30 BoundServices boundServiceNew, List<BoundServices> allServices,
31 BoundServicesState interfaceBoundServicesState) {
33 if (allServices.isEmpty()) {
34 LOG.error("empty bound service list during bind service {}, for: {}", boundServiceNew, interfaceName);
38 if (FlowBasedServicesUtils.isInterfaceTypeBasedServiceBinding(interfaceName)) {
39 bindServiceOnInterfaceType(futures,boundServiceNew, allServices);
41 if (L2vlan.class.equals(interfaceBoundServicesState.getInterfaceType())
42 || Tunnel.class.equals(interfaceBoundServicesState.getInterfaceType())) {
43 bindServiceOnInterface(futures, boundServiceNew, allServices, interfaceBoundServicesState);
48 protected abstract void bindServiceOnInterface(List<ListenableFuture<Void>> futures, BoundServices boundServiceNew,
49 List<BoundServices> allServices,
50 BoundServicesState interfaceBoundServicesState);
52 protected abstract void bindServiceOnInterfaceType(List<ListenableFuture<Void>> futures,
53 BoundServices boundServiceNew, List<BoundServices> allServices);