Added Comment operation as per RFC7047 section 5.2.9 04/7404/1
authorMadhu Venugopal <mavenugo@gmail.com>
Mon, 26 May 2014 17:30:08 +0000 (10:30 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Mon, 26 May 2014 17:30:08 +0000 (10:30 -0700)
Change-Id: I4adf77cf3823683c63a324a9ba690f99dc33e1fa
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Comment.java [new file with mode: 0644]
library/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java
library/src/test/java/org/opendaylight/ovsdb/lib/OvsDBClientTestIT.java

diff --git a/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Comment.java b/library/src/main/java/org/opendaylight/ovsdb/lib/operations/Comment.java
new file mode 100644 (file)
index 0000000..f2a6ba5
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.lib.operations;
+
+
+public class Comment extends Operation {
+
+    public static final String COMMENT = "comment";
+    String comment;
+
+    public Comment(String comment) {
+        super(null, COMMENT);
+        this.comment = comment;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+}
index e4102aaec81ecb512ac8802e6a9d6334d67f51e1..341d7780b0429be23240403c7ce46604d439f0c5 100644 (file)
@@ -41,4 +41,7 @@ public class Operations {
         return new Select<>(schema);
     }
 
+    public Comment comment(String comment) {
+        return new Comment(comment);
+    }
 }
\ No newline at end of file
index 1ea866e0a6b1ab0493ba96df9352c41ecb5718ed..bb1f20e2d4a98c6274648b8c20cb70c36126964e 100644 (file)
@@ -9,14 +9,12 @@
  */
 package org.opendaylight.ovsdb.lib;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
 
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -40,7 +38,9 @@ import org.opendaylight.ovsdb.lib.schema.TableSchema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Set;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
 
 
 public class OvsDBClientTestIT extends OvsdbTestBase {
@@ -65,18 +65,20 @@ public class OvsDBClientTestIT extends OvsdbTestBase {
 
         ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
                 .add(op.insert(bridge)
-                        .value(name, "br-int")
-                        .value(flood_vlans, Sets.newHashSet(100, 101, 4001))
-                )
+                        .value(name, "br-test")
+                        .value(flood_vlans, Sets.newHashSet(100, 101, 4001)))
+                .add(op.comment("Inserting Bridge br-int"))
                 .add(op.update(bridge)
                         .set(fail_mode, "secure")
                         .where(name.opEqual("br-int"))
                         .operation())
+                .add(op.comment("Updating fail_mode to secure on Bridge br-int"))
                 .add(op.select(bridge)
                         .column(name)
                         .where(name.opEqual("br-int"))
                         .operation())
                 .add(op.commit(true))
+                .add(op.comment("Commiting the operation"))
                 .execute();
 
         List<OperationResult> operationResults = results.get();
@@ -87,7 +89,9 @@ public class OvsDBClientTestIT extends OvsdbTestBase {
                 .add(op.delete(bridge)
                         .where(name.opEqual("br-int"))
                         .operation())
+                .add(op.comment("Deleting Bridge br-int"))
                 .add(op.commit(true))
+                .add(op.comment("Commiting the operation"))
                 .execute();
 
         operationResults = results.get();