Merge "Upgrade ietf-{inet,yang}-types to 2013-07-15"
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 13 Jul 2016 16:49:49 +0000 (16:49 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 13 Jul 2016 16:49:49 +0000 (16:49 +0000)
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactInvokerImpl.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbAutoAttachUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/TransactionInvokerImpl.java

index f9a75f4fc8117ba2ed6d9fe227c39c93ed31f643..d29fabe972dec308e42381dd3d750f48e4281f76 100644 (file)
@@ -240,7 +240,7 @@ public class OvsdbConnectionInstance implements OvsdbClient {
             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);
index 0a43dc60363e4624c39530170d13eecb0b15c00e..929b658e7aad0fadf8aade9a30fb7bb1ab3df45d 100644 (file)
@@ -317,7 +317,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos
                 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;
         }
index a5a6df82d396ff33c319c607acc0fefdc3878c64..1124922e13c452c250e343bf140cad975dca703a 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.ovsdb.southbound;
 
 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;
@@ -126,7 +127,7 @@ public class SouthboundProvider implements AutoCloseable {
             } else {
                 transaction.cancel();
             }
-        } catch (Exception e) {
+        } catch (InterruptedException | ExecutionException e) {
             LOG.error("Error initializing ovsdb topology", e);
         }
     }
@@ -143,7 +144,7 @@ public class SouthboundProvider implements AutoCloseable {
             } else {
                 transaction.cancel();
             }
-        } catch (Exception e) {
+        } catch (InterruptedException | ExecutionException e) {
             LOG.error("Error initializing ovsdb topology", e);
         }
     }
index a796cc6c732446f73188062142fa085d735f67e2..ccee632878f27013b554f0b6af327e2ad0b2480d 100644 (file)
@@ -12,7 +12,10 @@ import com.google.common.base.Preconditions;
 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;
@@ -101,7 +104,7 @@ public class SouthboundUtil {
                 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();
         }
@@ -121,19 +124,23 @@ public class SouthboundUtil {
     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;
index 0ab60549d142860d0a8a050444893ebed76bc0d7..80462a686d9768553070c91c6ec7eccd2a704bb1 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact;
 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;
@@ -55,7 +57,7 @@ public class TransactInvokerImpl implements TransactInvoker {
             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);
index f5158349428f342c28bb469cd352de8f679a8406..57bb97001004a5e65181b83302adc20744f4eaf3 100644 (file)
@@ -16,6 +16,7 @@ import java.util.Map.Entry;
 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;
@@ -74,25 +75,27 @@ public class OvsdbAutoAttachUpdateCommand extends AbstractTransactionCommand {
 //                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 =
index 6d7cd284c77073cf253e7ad039479268fe14eec2..01abf5cd325e336da71a635e3896eee120c7132f 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.base.Preconditions;
 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;
@@ -370,7 +371,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
                             }
                         }
                     }
-                } catch (Exception e) {
+                } catch (SocketException e) {
                     LOG.warn("Error getting local ip address", e);
                 }
             }
index 96e6965da5c87a51095ed7e9b462a64bbdb90475..a5187f25a72afb66d339bc7079b2acdb439d813c 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.ovsdb.southbound.transactions.md;
 
 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;
@@ -62,7 +63,7 @@ public class OvsdbNodeRemoveCommand extends AbstractTransactionCommand {
                             + " not deleting OvsdbNode from operational data store.");
                 }
             }
-        } catch (Exception e) {
+        } catch (InterruptedException | ExecutionException e) {
             LOG.warn("Failure to delete ovsdbNode", e);
         }
     }
index f826a728f3fa32093b1b55112046da8351bad579..ae8ea401ac50f5755e1a98610ef00571a0867dcd 100644 (file)
@@ -95,7 +95,7 @@ public class TransactionInvokerImpl implements TransactionInvoker,TransactionCha
                         }
                     });
                 }
-            } catch (Exception e) {
+            } catch (InterruptedException e) {
                 LOG.warn("Exception invoking Transaction: ", e);
             }
         }