aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/ovsdb/rfc/src
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/ovsdb/rfc/src')
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java43
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java9
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java1
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java31
4 files changed, 57 insertions, 27 deletions
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
index 33269223..00609602 100644
--- a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
@@ -15,20 +15,21 @@
*/
package org.onosproject.ovsdb.rfc.notation;
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.Maps;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
-import com.google.common.collect.Maps;
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Row is the basic element of the OpenVswitch's table.
*/
public final class Row {
private String tableName;
+ private UUID uuid;
private Map<String, Column> columns;
/**
@@ -40,9 +41,11 @@ public final class Row {
/**
* Row constructor.
+ *
* @param tableName table name
*/
- public Row(String tableName) {
+ @Deprecated
+ private Row(String tableName) {
checkNotNull(tableName, "tableName cannot be null");
this.tableName = tableName;
this.columns = Maps.newHashMap();
@@ -50,18 +53,22 @@ public final class Row {
/**
* Row constructor.
+ *
* @param tableName table name
- * @param columns Map of Column entity
+ * @param columns Map of Column entity
*/
- public Row(String tableName, Map<String, Column> columns) {
+ public Row(String tableName, UUID uuid, Map<String, Column> columns) {
checkNotNull(tableName, "table name cannot be null");
+ checkNotNull(uuid, "uuid cannot be null");
checkNotNull(columns, "columns cannot be null");
this.tableName = tableName;
+ this.uuid = uuid;
this.columns = columns;
}
/**
* Returns tableName.
+ *
* @return tableName
*/
public String tableName() {
@@ -70,6 +77,7 @@ public final class Row {
/**
* Set tableName value.
+ *
* @param tableName table name
*/
public void setTableName(String tableName) {
@@ -77,7 +85,26 @@ public final class Row {
}
/**
+ * Returns uuid.
+ *
+ * @return uuid
+ */
+ public UUID uuid() {
+ return uuid;
+ }
+
+ /**
+ * Sets uuid value.
+ *
+ * @param uuid new uuid
+ */
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
* Returns Column by ColumnSchema.
+ *
* @param columnName column name
* @return Column
*/
@@ -87,6 +114,7 @@ public final class Row {
/**
* Returns Collection of Column.
+ *
* @return Collection of Column
*/
public Collection<Column> getColumns() {
@@ -95,8 +123,9 @@ public final class Row {
/**
* add Column.
+ *
* @param columnName column name
- * @param data Column entity
+ * @param data Column entity
*/
public void addColumn(String columnName, Column data) {
this.columns.put(columnName, data);
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
index bd589f03..0b5ffeff 100644
--- a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
@@ -15,16 +15,17 @@
*/
package org.onosproject.ovsdb.rfc.table;
-import java.util.Map;
-import java.util.Set;
-
import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+import java.util.Map;
+import java.util.Set;
+
/**
* This class provides operations of Bridge Table.
*/
@@ -351,7 +352,7 @@ public class Bridge extends AbstractOvsdbTableService {
* of attributes.
* @param controller the column data which column name is "controller"
*/
- public void setController(Set<UUID> controller) {
+ public void setController(OvsdbSet controller) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.CONTROLLER
.columnName(),
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
index c1ae7c79..f5bd860d 100644
--- a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
@@ -37,6 +37,7 @@ public final class TableGenerator {
* @param tableName table name
* @return Object table entity
*/
+ //FIXME change the name, it creates a row object, such as a controller.
public static Object createTable(DatabaseSchema dbSchema,
OvsdbTable tableName) {
Row row = new Row();
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
index 9744fb49..1dcf48f3 100644
--- a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
@@ -15,12 +15,11 @@
*/
package org.onosproject.ovsdb.rfc.utils;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.onosproject.ovsdb.rfc.exception.AbnormalJsonNodeException;
import org.onosproject.ovsdb.rfc.exception.UnsupportedException;
import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
@@ -41,11 +40,11 @@ import org.onosproject.ovsdb.rfc.schema.type.ColumnTypeFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
/**
* JsonNode utility class. convert JsonNode into Object.
@@ -247,7 +246,7 @@ public final class FromJsonUtil {
validateJsonNode(rowsNode, "rows");
ArrayList<Row> rows = Lists.newArrayList();
for (JsonNode rowNode : rowsNode.get("rows")) {
- rows.add(createRow(tableSchema, rowNode));
+ rows.add(createRow(tableSchema, null, rowNode)); //FIXME null will throw exception
}
return rows;
}
@@ -285,8 +284,8 @@ public final class FromJsonUtil {
UUID uuid = UUID.uuid(uuidStr);
JsonNode newR = oldNewRow.getValue().get("new");
JsonNode oldR = oldNewRow.getValue().get("old");
- Row newRow = newR != null ? createRow(tableSchema, newR) : null;
- Row oldRow = oldR != null ? createRow(tableSchema, oldR) : null;
+ Row newRow = newR != null ? createRow(tableSchema, uuid, newR) : null;
+ Row oldRow = oldR != null ? createRow(tableSchema, uuid, oldR) : null;
RowUpdate rowUpdate = new RowUpdate(uuid, oldRow, newRow);
rows.put(uuid, rowUpdate);
}
@@ -299,7 +298,7 @@ public final class FromJsonUtil {
* @param rowNode JsonNode
* @return Row
*/
- private static Row createRow(TableSchema tableSchema, JsonNode rowNode) {
+ private static Row createRow(TableSchema tableSchema, UUID uuid, JsonNode rowNode) {
if (tableSchema == null) {
return null;
}
@@ -314,7 +313,7 @@ public final class FromJsonUtil {
columns.put(columnName, new Column(columnName, obj));
}
}
- return new Row(tableSchema.name(), columns);
+ return new Row(tableSchema.name(), uuid, columns);
}
}