2 * Copyright (c) 2020 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.netvirt.elan.l2gw.jobs;
10 import javax.inject.Inject;
11 import javax.inject.Singleton;
12 import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
13 import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
14 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
15 import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
16 import org.opendaylight.netvirt.elan.utils.ElanDmacUtils;
17 import org.opendaylight.netvirt.elan.utils.Scheduler;
18 import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 public class DpnDmacJobUtil {
25 private static final Logger LOG = LoggerFactory.getLogger(DpnDmacJobUtil.class);
26 private ElanL2GatewayUtils elanL2GatewayUtils;
27 private ElanClusterUtils elanClusterUtils;
28 private ElanInstanceCache elanInstanceCache;
29 private ElanDmacUtils elanDmacUtils;
30 private Scheduler scheduler;
31 private JobCoordinator jobCoordinator;
34 public DpnDmacJobUtil(ElanL2GatewayUtils elanL2GatewayUtils, ElanClusterUtils elanClusterUtils,
35 ElanInstanceCache elanInstanceCache, ElanDmacUtils elanDmacUtils,
36 Scheduler scheduler, JobCoordinator jobCoordinator) {
37 this.elanL2GatewayUtils = elanL2GatewayUtils;
38 this.elanClusterUtils = elanClusterUtils;
39 this.elanInstanceCache = elanInstanceCache;
40 this.elanDmacUtils = elanDmacUtils;
41 this.scheduler = scheduler;
42 this.jobCoordinator = jobCoordinator;
45 public void installDmacFromL2gws(String elanName, DpnInterfaces dpnInterfaces) {
46 ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName).keySet().forEach(nodeId -> {
47 new DpnDmacJob(elanName, dpnInterfaces, nodeId, true, elanL2GatewayUtils, elanClusterUtils,
48 elanInstanceCache, elanDmacUtils, scheduler, jobCoordinator).submit();
52 public void uninstallDmacFromL2gws(String elanName, DpnInterfaces dpnInterfaces) {
53 ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName).keySet().forEach(nodeId -> {
54 new DpnDmacJob(elanName, dpnInterfaces, nodeId, false, elanL2GatewayUtils, elanClusterUtils,
55 elanInstanceCache, elanDmacUtils, scheduler, jobCoordinator).submit();