Add multiple options to port via MDSAL 01/17401/1
authorEric Multanen <eric.w.multanen@intel.com>
Mon, 30 Mar 2015 23:29:15 +0000 (16:29 -0700)
committerEric Multanen <eric.w.multanen@intel.com>
Mon, 30 Mar 2015 23:29:15 +0000 (16:29 -0700)
Only one option was getting added to the port when
multiple options were supplied in the MDSAL config
operation.  This patch adds all of them to the
port.

Change-Id: Iee139510d6d396c410641130b5aeee1fedca4c72
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java

index 1126cb5c4be3967a26ec51ad6eae0702113c97ca..9743182c503862d2baad04a14390218d972fec1b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
 
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -64,8 +65,14 @@ public class TerminationPointCreateCommand implements TransactCommand {
 
             //Configure optional input
             if (terminationPoint.getOptions() != null) {
+                HashMap<String, String> optionsMap = new HashMap<String, String>();
                 for (Options option : terminationPoint.getOptions()) {
-                    ovsInterface.setOptions(ImmutableMap.of(option.getOption(),option.getValue()));
+                    optionsMap.put(option.getOption(), option.getValue());
+                }
+                try {
+                    ovsInterface.setOptions(ImmutableMap.copyOf(optionsMap));
+                } catch (NullPointerException e) {
+                    LOG.warn("Incomplete OVSDB interface options");
                 }
             }
             transaction.add(op.insert(ovsInterface).withId(interfaceUuid));