2 * Copyright (c) 2016 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.vpnservice.elan.l2gw.jobs;
10 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.vpnservice.utils.hwvtep.HwvtepUtils;
14 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.concurrent.Callable;
23 * The Class LogicalSwitchDeletedJob.
25 public class LogicalSwitchDeletedJob implements Callable<List<ListenableFuture<Void>>> {
26 private DataBroker broker;
28 /** The logical switch name. */
29 private String logicalSwitchName;
31 /** The physical device. */
32 private NodeId hwvtepNodeId;
34 private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchDeletedJob.class);
36 public LogicalSwitchDeletedJob(DataBroker broker, NodeId hwvtepNodeId, String logicalSwitchName) {
38 this.hwvtepNodeId = hwvtepNodeId;
39 this.logicalSwitchName = logicalSwitchName;
40 LOG.debug("created logical switch deleted job for {} on {}", logicalSwitchName, hwvtepNodeId);
43 public String getJobKey() {
44 return logicalSwitchName;
50 * @see java.util.concurrent.Callable#call()
53 public List<ListenableFuture<Void>> call() throws Exception {
55 LOG.debug("running logical switch deleted job for {} in {}", logicalSwitchName, hwvtepNodeId);
56 List<ListenableFuture<Void>> futures = new ArrayList<>();
57 futures.add(HwvtepUtils.deleteLogicalSwitch(broker, hwvtepNodeId, logicalSwitchName));
59 } catch (Throwable e) {
60 LOG.error("failed to delete ls ", e);