try {
List<OperationResult> got = result.get();
LOG.debug("OVSDB transaction result: {}", got);
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Transact execution exception: ", e);
}
LOG.trace("invoke exit tb: {}", txBuilder);
LOG.warn("Found non-topological node {} on path {}",optional);
return null;
}
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Failed to get Ovsdb Node {}",nodePath, e);
return null;
}
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
} else {
transaction.cancel();
}
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.error("Error initializing ovsdb topology", e);
}
}
} else {
transaction.cancel();
}
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.error("Error initializing ovsdb topology", e);
}
}
import com.google.common.util.concurrent.CheckedFuture;
import java.net.InetAddress;
import java.net.NetworkInterface;
+import java.net.SocketException;
import java.util.Enumeration;
+import java.util.concurrent.ExecutionException;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
LOG.warn("Cannot find client for OvsdbManagedNode without a specified ManagedBy {}", mn);
return Optional.absent();
}
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Failed to get OvsdbNode that manages OvsdbManagedNode {}", mn, e);
return Optional.absent();
}
private static String getLocalControllerHostIpAddress() {
String ipaddress = null;
try {
- for (Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
- ifaces.hasMoreElements();) {
- NetworkInterface iface = ifaces.nextElement();
-
- for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
- InetAddress inetAddr = inetAddrs.nextElement();
- if (!inetAddr.isLoopbackAddress() && inetAddr.isSiteLocalAddress()) {
- ipaddress = inetAddr.getHostAddress();
- break;
+ Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
+ if (ifaces != null) {
+ while (ifaces.hasMoreElements()) {
+ NetworkInterface iface = ifaces.nextElement();
+
+ for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
+ InetAddress inetAddr = inetAddrs.nextElement();
+ if (!inetAddr.isLoopbackAddress() && inetAddr.isSiteLocalAddress()) {
+ ipaddress = inetAddr.getHostAddress();
+ break;
+ }
}
}
+ } else {
+ LOG.warn("Local Host don't have any associated IP address");
}
- } catch (Exception e) {
+ } catch (SocketException e) {
LOG.warn("Exception while fetching local host ip address ",e);
}
return ipaddress;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.ExecutionException;
+
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.ovsdb.lib.operations.OperationResult;
try {
List<OperationResult> got = result.get();
LOG.debug("OVSDB transaction result: {}", got);
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Transact execution exception: ", e);
}
LOG.trace("invoke exit command: {}, tb: {}", command, tb);
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.ovsdb.lib.message.TableUpdates;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
// Uri uri = new Uri(getAutoAttachId(autoAttach));
Autoattach currentAutoattach = null;
- try {
- final InstanceIdentifier<Autoattach> currentIid = nodeIId
- .augmentation(OvsdbNodeAugmentation.class)
- .child(Autoattach.class, new AutoattachKey(new Uri(oldAutoAttach
- .getUuidColumn().getData().toString())));
- // FIXME: To be uncommented and replaced to currentIid when
- // Open vSwitch supports external_ids column
+ if (oldAutoAttach.getUuidColumn() != null) {
+ try {
+ final InstanceIdentifier<Autoattach> currentIid = nodeIId
+ .augmentation(OvsdbNodeAugmentation.class)
+ .child(Autoattach.class, new AutoattachKey(new Uri(oldAutoAttach
+ .getUuidColumn().getData().toString())));
+ // FIXME: To be uncommented and replaced to currentIid when
+ // Open vSwitch supports external_ids column
// InstanceIdentifier<Autoattach> currentIid = nodeIId
// .augmentation(OvsdbNodeAugmentation.class)
// .child(Autoattach.class, new AutoattachKey(new Uri(oldAutoAttach
// .getExternalIdsColumn().getData()
// .get(SouthboundConstants.AUTOATTACH_ID_EXTERNAL_ID_KEY))));
- final Optional<Autoattach> optionalAutoattach =
- transaction.read(LogicalDatastoreType.OPERATIONAL, currentIid).checkedGet();
- if (optionalAutoattach.isPresent()) {
- currentAutoattach = optionalAutoattach.get();
+ final Optional<Autoattach> optionalAutoattach =
+ transaction.read(LogicalDatastoreType.OPERATIONAL, currentIid).checkedGet();
+ if (optionalAutoattach.isPresent()) {
+ currentAutoattach = optionalAutoattach.get();
+ }
+ } catch (final ReadFailedException e) {
+ LOG.debug("AutoAttach table entries not found in operational datastore, need to create it.", e);
}
- } catch (final Exception e) {
- LOG.debug("AutoAttach table entries not found in operational datastore, need to create it.", e);
}
final AutoattachBuilder autoAttachBuilder =
import com.google.common.net.InetAddresses;
import java.net.InetAddress;
import java.net.NetworkInterface;
+import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
}
}
}
- } catch (Exception e) {
+ } catch (SocketException e) {
LOG.warn("Error getting local ip address", e);
}
}
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+ " not deleting OvsdbNode from operational data store.");
}
}
- } catch (Exception e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Failure to delete ovsdbNode", e);
}
}
}
});
}
- } catch (Exception e) {
+ } catch (InterruptedException e) {
LOG.warn("Exception invoking Transaction: ", e);
}
}