aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations')
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Abort.java43
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Assert.java57
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Comment.java57
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Commit.java57
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Delete.java77
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Insert.java110
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Mutate.java91
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Operation.java60
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Select.java89
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Update.java111
-rw-r--r--framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/package-info.java20
11 files changed, 772 insertions, 0 deletions
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Abort.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Abort.java
new file mode 100644
index 00000000..8751f70e
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Abort.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+/**
+ * assert operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Abort implements Operation {
+
+ private final String op;
+
+ /**
+ * Constructs a Abort object.
+ */
+ public Abort() {
+ this.op = Operations.ABORT.op();
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return null;
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Assert.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Assert.java
new file mode 100644
index 00000000..92a63361
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Assert.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+/**
+ * assert operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Assert implements Operation {
+
+ private final String op;
+ private final String lock;
+
+ /**
+ * Constructs a Assert object.
+ * @param lock the lock member of assert operation
+ */
+ public Assert(String lock) {
+ checkNotNull(lock, "lock cannot be null");
+ this.op = Operations.ASSERT.op();
+ this.lock = lock;
+ }
+
+ /**
+ * Returns the lock member of assert operation.
+ * @return the lock member of assert operation
+ */
+ public String getLock() {
+ return lock;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return null;
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Comment.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Comment.java
new file mode 100644
index 00000000..2853e1ff
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Comment.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+/**
+ * comment operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Comment implements Operation {
+
+ private final String op;
+ private final String comment;
+
+ /**
+ * Constructs a Comment object.
+ * @param comment the comment member of comment operation
+ */
+ public Comment(String comment) {
+ checkNotNull(comment, "comment cannot be null");
+ this.op = Operations.COMMENT.op();
+ this.comment = comment;
+ }
+
+ /**
+ * Returns the comment member of comment operation.
+ * @return the comment member of comment operation
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return null;
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Commit.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Commit.java
new file mode 100644
index 00000000..c87fb6e9
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Commit.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+/**
+ * commit operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Commit implements Operation {
+
+ private final String op;
+ private final Boolean durable;
+
+ /**
+ * Constructs a Commit object.
+ * @param durable the durable member of commit operation
+ */
+ public Commit(Boolean durable) {
+ checkNotNull(durable, "durable cannot be null");
+ this.op = Operations.COMMIT.op();
+ this.durable = durable;
+ }
+
+ /**
+ * Returns the durable member of commit operation.
+ * @return the durable member of commit operation
+ */
+ public Boolean isDurable() {
+ return durable;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return null;
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Delete.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Delete.java
new file mode 100644
index 00000000..08b5e522
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Delete.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.notation.Condition;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * delete operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Delete implements Operation {
+
+ @JsonIgnore
+ private final TableSchema tableSchema;
+ private final String op;
+ private final List<Condition> where;
+
+ /**
+ * Constructs a Delete object.
+ * @param schema TableSchema entity
+ * @param where the List of Condition entity
+ */
+ public Delete(TableSchema schema, List<Condition> where) {
+ checkNotNull(schema, "TableSchema cannot be null");
+ checkNotNull(where, "where is not null");
+ this.tableSchema = schema;
+ this.op = Operations.DELETE.op();
+ this.where = where;
+ }
+
+ /**
+ * Returns the where member of delete operation.
+ * @return the where member of delete operation
+ */
+ public List<Condition> getWhere() {
+ return where;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return tableSchema;
+ }
+
+ /**
+ * For the use of serialization.
+ * @return the table member of update operation
+ */
+ @JsonProperty
+ public String getTable() {
+ return tableSchema.name();
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Insert.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Insert.java
new file mode 100644
index 00000000..8545b43a
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Insert.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+import org.onosproject.ovsdb.rfc.utils.TransValueUtil;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.collect.Maps;
+
+/**
+ * insert operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Insert implements Operation {
+
+ @JsonIgnore
+ private final TableSchema tableSchema;
+ private final String op;
+ @JsonProperty("uuid-name")
+ private final String uuidName;
+ private final Map<String, Object> row;
+
+ /**
+ * Constructs a Insert object.
+ * @param schema TableSchema entity
+ * @param uuidName uuid-name
+ * @param row Row entity
+ */
+ public Insert(TableSchema schema, String uuidName, Row row) {
+ checkNotNull(schema, "TableSchema cannot be null");
+ checkNotNull(uuidName, "uuid name cannot be null");
+ checkNotNull(row, "row cannot be null");
+ this.tableSchema = schema;
+ this.op = Operations.INSERT.op();
+ this.uuidName = uuidName;
+ this.row = Maps.newHashMap();
+ generateOperationRow(row);
+ }
+
+ /**
+ * Row entity convert into the row format of insert operation. Refer to RFC
+ * 7047 Section 5.2.
+ * @param row Row entity
+ */
+ private void generateOperationRow(Row row) {
+ Collection<Column> columns = row.getColumns();
+ for (Column column : columns) {
+ String columnName = column.columnName();
+ Object value = column.data();
+ Object formatValue = TransValueUtil.getFormatData(value);
+ this.row.put(columnName, formatValue);
+ }
+ }
+
+ /**
+ * Returns the uuid-name member of insert operation.
+ * @return the uuid-name member of insert operation
+ */
+ public String getUuidName() {
+ return uuidName;
+ }
+
+ /**
+ * Returns the row member of insert operation.
+ * @return the row member of insert operation
+ */
+ public Map<String, Object> getRow() {
+ return row;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return tableSchema;
+ }
+
+ /**
+ * For the use of serialization.
+ * @return the table member of update operation
+ */
+ @JsonProperty
+ public String getTable() {
+ return tableSchema.name();
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Mutate.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Mutate.java
new file mode 100644
index 00000000..b2827797
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Mutate.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.notation.Condition;
+import org.onosproject.ovsdb.rfc.notation.Mutation;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * mutate operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Mutate implements Operation {
+
+ @JsonIgnore
+ private final TableSchema tableSchema;
+ private final String op;
+ private final List<Condition> where;
+ private final List<Mutation> mutations;
+
+ /**
+ * Constructs a Mutate object.
+ * @param schema TableSchema entity
+ * @param where the List of Condition entity
+ * @param mutations the List of Mutation entity
+ */
+ public Mutate(TableSchema schema, List<Condition> where,
+ List<Mutation> mutations) {
+ checkNotNull(schema, "TableSchema cannot be null");
+ checkNotNull(mutations, "mutations cannot be null");
+ checkNotNull(where, "where cannot be null");
+ this.tableSchema = schema;
+ this.op = Operations.MUTATE.op();
+ this.where = where;
+ this.mutations = mutations;
+ }
+
+ /**
+ * Returns the mutations member of mutate operation.
+ * @return the mutations member of mutate operation
+ */
+ public List<Mutation> getMutations() {
+ return mutations;
+ }
+
+ /**
+ * Returns the where member of mutate operation.
+ * @return the where member of mutate operation
+ */
+ public List<Condition> getWhere() {
+ return where;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return tableSchema;
+ }
+
+ /**
+ * For the use of serialization.
+ * @return the table member of update operation
+ */
+ @JsonProperty
+ public String getTable() {
+ return tableSchema.name();
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Operation.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Operation.java
new file mode 100644
index 00000000..3e2dff1f
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Operation.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+/**
+ * Operation interface.
+ */
+public interface Operation {
+
+ /**
+ * Returns the op member of update operation.
+ * @return the op member of update operation
+ */
+ String getOp();
+
+ /**
+ * Returns TableSchema entity.
+ * @return TableSchema entity
+ */
+ TableSchema getTableSchema();
+
+ /**
+ * Operations must be "insert", "select", "update", "mutate", "delete",
+ * "commit", "abort", "comment", "assert". Refer to RFC 7047 Section 5.2.
+ */
+ public enum Operations {
+ INSERT("insert"), SELECT("select"), UPDATE("update"), MUTATE("mutate"),
+ DELETE("delete"), COMMIT("commit"), ABORT("abort"), COMMENT("comment"),
+ ASSERT("assert");
+
+ private String op;
+
+ private Operations(String op) {
+ this.op = op;
+ }
+
+ /**
+ * Returns the op for Operations.
+ * @return the op
+ */
+ public String op() {
+ return op;
+ }
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Select.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Select.java
new file mode 100644
index 00000000..ba1ec74f
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Select.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.notation.Condition;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * select operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Select implements Operation {
+
+ @JsonIgnore
+ private final TableSchema tableSchema;
+ private final String op;
+ private final List<Condition> where;
+ private final List<String> columns;
+
+ /**
+ * Constructs a Select object.
+ * @param schema TableSchema entity
+ * @param where the List of Condition entity
+ * @param columns the List of column name
+ */
+ public Select(TableSchema schema, List<Condition> where, List<String> columns) {
+ checkNotNull(schema, "TableSchema cannot be null");
+ checkNotNull(where, "where cannot be null");
+ checkNotNull(columns, "columns cannot be null");
+ this.tableSchema = schema;
+ this.op = Operations.SELECT.op();
+ this.where = where;
+ this.columns = columns;
+ }
+
+ /**
+ * Returns the columns member of select operation.
+ * @return the columns member of select operation
+ */
+ public List<String> getColumns() {
+ return columns;
+ }
+
+ /**
+ * Returns the where member of select operation.
+ * @return the where member of select operation
+ */
+ public List<Condition> getWhere() {
+ return where;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return tableSchema;
+ }
+
+ /**
+ * For the use of serialization.
+ * @return the table member of update operation
+ */
+ @JsonProperty
+ public String getTable() {
+ return tableSchema.name();
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Update.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Update.java
new file mode 100644
index 00000000..81a1cab1
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Update.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ovsdb.rfc.operations;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Condition;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+import org.onosproject.ovsdb.rfc.utils.TransValueUtil;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.collect.Maps;
+
+/**
+ * update operation.Refer to RFC 7047 Section 5.2.
+ */
+public final class Update implements Operation {
+
+ @JsonIgnore
+ private final TableSchema tableSchema;
+ private final String op;
+ private final Map<String, Object> row;
+ private final List<Condition> where;
+
+ /**
+ * Constructs a Update object.
+ * @param schema TableSchema entity
+ * @param row Row entity
+ * @param where the List of Condition entity
+ */
+ public Update(TableSchema schema, Row row, List<Condition> where) {
+ checkNotNull(schema, "TableSchema cannot be null");
+ checkNotNull(row, "row cannot be null");
+ checkNotNull(where, "where cannot be null");
+ this.tableSchema = schema;
+ this.op = Operations.UPDATE.op();
+ this.row = Maps.newHashMap();
+ this.where = where;
+ generateOperationRow(row);
+ }
+
+ /**
+ * Row entity convert into the row format of update operation. Refer to RFC
+ * 7047 Section 5.2.
+ * @param row Row entity
+ */
+ private void generateOperationRow(Row row) {
+ Collection<Column> columns = row.getColumns();
+ for (Column column : columns) {
+ String columnName = column.columnName();
+ Object value = column.data();
+ Object formatValue = TransValueUtil.getFormatData(value);
+ this.row.put(columnName, formatValue);
+ }
+ }
+
+ /**
+ * Returns the row member of update operation.
+ * @return the row member of update operation
+ */
+ public Map<String, Object> getRow() {
+ return row;
+ }
+
+ /**
+ * Returns the where member of update operation.
+ * @return the where member of update operation
+ */
+ public List<Condition> getWhere() {
+ return where;
+ }
+
+ @Override
+ public String getOp() {
+ return op;
+ }
+
+ @Override
+ public TableSchema getTableSchema() {
+ return tableSchema;
+ }
+
+ /**
+ * For the use of serialization.
+ * @return the table member of update operation
+ */
+ @JsonProperty
+ public String getTable() {
+ return tableSchema.name();
+ }
+}
diff --git a/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/package-info.java b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/package-info.java
new file mode 100644
index 00000000..77fb9f3c
--- /dev/null
+++ b/framework/src/onos/protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * OVSDB operations.
+ */
+package org.onosproject.ovsdb.rfc.operations;