NETVIRT-1630 migrate to md-sal APIs
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / jobs / HwvtepDeviceMcastMacUpdateJob.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netvirt.elan.l2gw.jobs;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.Collections;
12 import java.util.List;
13 import java.util.concurrent.Callable;
14 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
15 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class HwvtepDeviceMcastMacUpdateJob implements Callable<List<? extends ListenableFuture<?>>> {
20     private static final Logger LOG = LoggerFactory.getLogger(HwvtepDeviceMcastMacUpdateJob.class);
21
22     private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
23     private final String elanName;
24     private final L2GatewayDevice l2GatewayDevice;
25
26     public HwvtepDeviceMcastMacUpdateJob(ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils, String elanName,
27                                          L2GatewayDevice l2GatewayDevice) {
28         this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
29         this.l2GatewayDevice = l2GatewayDevice;
30         this.elanName = elanName;
31     }
32
33     public String getJobKey() {
34         return elanName;
35     }
36
37     @Override
38     public List<ListenableFuture<Void>> call() {
39         LOG.info("running update mcast mac entry job for {} {}",
40                 elanName, l2GatewayDevice.getHwvtepNodeId());
41         elanL2GatewayMulticastUtils.updateRemoteMcastMacOnElanL2GwDevice(elanName, l2GatewayDevice);
42         return Collections.emptyList();
43     }
44
45 }