aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/ovsdb
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-09-09 22:15:21 -0700
committerAshlee Young <ashlee@onosfw.com>2015-09-09 22:15:21 -0700
commit13d05bc8458758ee39cb829098241e89616717ee (patch)
tree22a4d1ce65f15952f07a3df5af4b462b4697cb3a /framework/src/onos/ovsdb
parent6139282e1e93c2322076de4b91b1c85d0bc4a8b3 (diff)
ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60
Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd
Diffstat (limited to 'framework/src/onos/ovsdb')
-rw-r--r--framework/src/onos/ovsdb/api/pom.xml56
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/DefaultEventSubject.java126
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/EventSubject.java23
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java87
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java71
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbClientService.java231
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java68
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbController.java68
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java68
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEvent.java74
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventListener.java28
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventSubject.java75
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java68
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java83
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeListener.java36
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPort.java86
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java70
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java68
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java70
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbRowStore.java69
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbStore.java71
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTableStore.java67
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnel.java125
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java69
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java1188
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbAgent.java42
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbProviderService.java81
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/package-info.java20
-rw-r--r--framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/package-info.java20
-rw-r--r--framework/src/onos/ovsdb/ctl/pom.xml65
-rw-r--r--framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/ChannelConnectionListener.java43
-rw-r--r--framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/Controller.java201
-rw-r--r--framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/MessageDecoder.java55
-rw-r--r--framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java413
-rw-r--r--framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbJsonRpcHandler.java131
-rw-r--r--framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/package-info.java20
-rw-r--r--framework/src/onos/ovsdb/pom.xml69
-rw-r--r--framework/src/onos/ovsdb/rfc/pom.xml42
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/AbnormalJsonNodeException.java41
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/ColumnSchemaNotFoundException.java55
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/TableSchemaNotFoundException.java56
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/UnsupportedException.java41
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/VersionMismatchException.java66
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/Callback.java50
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonReadContext.java86
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcRequest.java111
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcResponse.java122
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/OvsdbRPC.java74
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorRequest.java101
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorSelect.java106
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/OperationResult.java158
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/RowUpdate.java97
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java107
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java89
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/UpdateNotification.java90
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java81
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java123
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java124
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java83
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java85
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java84
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java128
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java84
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java41
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java41
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java49
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java46
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java32
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.java43
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java46
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Abort.java43
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Assert.java57
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Comment.java57
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Commit.java57
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Delete.java77
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Insert.java110
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Mutate.java91
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Operation.java60
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Select.java89
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Update.java111
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/ColumnSchema.java83
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/DatabaseSchema.java135
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/TableSchema.java129
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/AtomicColumnType.java104
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseType.java24
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseTypeFactory.java214
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BooleanBaseType.java33
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnType.java24
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnTypeFactory.java123
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/IntegerBaseType.java103
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/KeyValuedColumnType.java108
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/RealBaseType.java103
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/StringBaseType.java103
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/UuidBaseType.java110
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java559
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Controller.java556
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowSampleCollectorSet.java151
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowTable.java196
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Interface.java1024
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ipfix.java220
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Manager.java243
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Mirror.java277
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Netflow.java197
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OpenVSwitch.java451
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OvsdbTable.java41
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Port.java575
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Qos.java149
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Queue.java126
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Sflow.java193
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ssl.java172
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java102
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/VersionNum.java47
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java284
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/ColumnDescription.java117
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/OvsdbTableService.java70
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/TableDescription.java108
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ConditionUtil.java122
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java320
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcReaderUtil.java165
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcWriterUtil.java114
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/MutationUtil.java92
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ObjectMapperUtil.java98
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ParamUtil.java86
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/StringEncoderUtil.java42
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/TransValueUtil.java172
-rw-r--r--framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/VersionUtil.java69
126 files changed, 16073 insertions, 0 deletions
diff --git a/framework/src/onos/ovsdb/api/pom.xml b/framework/src/onos/ovsdb/api/pom.xml
new file mode 100644
index 00000000..c1808794
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<!--
+ ~ 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.
+ -->
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-ovsdb</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>onos-ovsdb-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS OVSDB plugin API</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-pool</groupId>
+ <artifactId>commons-pool</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport-native-epoll</artifactId>
+ <version>${netty4.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-ovsdb-rfc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/DefaultEventSubject.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/DefaultEventSubject.java
new file mode 100644
index 00000000..5d9134b4
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/DefaultEventSubject.java
@@ -0,0 +1,126 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+import java.util.Set;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+
+/**
+ * This class is default event subject that implements OvsdbEventSubject.
+ */
+public class DefaultEventSubject implements OvsdbEventSubject {
+ private final MacAddress mac;
+ private final Set<IpAddress> ips;
+ private final OvsdbPortName portname;
+ private final OvsdbPortNumber portnumber;
+ private final OvsdbDatapathId dpid;
+ private final OvsdbPortType portType;
+ private final OvsdbIfaceId ifaceid;
+
+ /**
+ * Creates an end-station event subject using the supplied information.
+ *
+ * @param mac host MAC address
+ * @param ips host MAC ips
+ * @param portname port name
+ * @param portnumber port number
+ * @param dpid ovs dpid
+ * @param portType port type
+ * @param ifaceid vm ifaceid
+ */
+ public DefaultEventSubject(MacAddress mac, Set<IpAddress> ips,
+ OvsdbPortName portname, OvsdbPortNumber portnumber, OvsdbDatapathId dpid,
+ OvsdbPortType portType, OvsdbIfaceId ifaceid) {
+ super();
+ this.mac = mac;
+ this.ips = ips;
+ this.portname = portname;
+ this.portnumber = portnumber;
+ this.dpid = dpid;
+ this.portType = portType;
+ this.ifaceid = ifaceid;
+ }
+
+ @Override
+ public MacAddress hwAddress() {
+ return mac;
+ }
+
+ @Override
+ public Set<IpAddress> ipAddress() {
+ return ips;
+ }
+
+ @Override
+ public OvsdbPortName portName() {
+ return portname;
+ }
+
+ @Override
+ public OvsdbPortNumber portNumber() {
+ return portnumber;
+ }
+
+ @Override
+ public OvsdbPortType portType() {
+ return portType;
+ }
+
+ @Override
+ public OvsdbDatapathId dpid() {
+ return dpid;
+ }
+
+ @Override
+ public OvsdbIfaceId ifaceid() {
+ return ifaceid;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mac, portname, portnumber, dpid, portType, ifaceid);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultEventSubject) {
+ final DefaultEventSubject other = (DefaultEventSubject) obj;
+ return Objects.equals(this.mac, other.mac)
+ && Objects.equals(this.portname, other.portname)
+ && Objects.equals(this.portnumber, other.portnumber)
+ && Objects.equals(this.dpid, other.dpid)
+ && Objects.equals(this.portType, other.portType)
+ && Objects.equals(this.ifaceid, other.ifaceid);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("mac", mac).add("portname", portname)
+ .add("portnumber", portnumber).add("portType", portType)
+ .add("ipAddresses", ips).add("dpid", dpid).add("ifaceid", ifaceid)
+ .toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/EventSubject.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/EventSubject.java
new file mode 100644
index 00000000..6a067244
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/EventSubject.java
@@ -0,0 +1,23 @@
+/*
+ * 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.controller;
+
+/**
+ * Represents for a entity that carry important information for listener.
+ */
+public interface EventSubject {
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java
new file mode 100644
index 00000000..1ee0a367
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java
@@ -0,0 +1,87 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The class representing a ovsdb bridge. This class is immutable.
+ */
+public final class OvsdbBridge {
+
+ private final OvsdbBridgeName bridgeName;
+ private final OvsdbDatapathId datapathId;
+
+ /**
+ * Constructor from a OvsdbBridgeName bridgeName and a OvsdbDatapathId
+ * datapathId.
+ *
+ * @param bridgeName the bridgeName to use
+ * @param datapathId the datapathId to use
+ */
+ public OvsdbBridge(OvsdbBridgeName bridgeName, OvsdbDatapathId datapathId) {
+ checkNotNull(bridgeName, "bridgeName is not null");
+ checkNotNull(datapathId, "datapathId is not null");
+ this.bridgeName = bridgeName;
+ this.datapathId = datapathId;
+ }
+
+ /**
+ * Gets the bridge name of the bridge.
+ *
+ * @return the bridge name of the bridge
+ */
+ public OvsdbBridgeName bridgeName() {
+ return bridgeName;
+ }
+
+ /**
+ * Gets the datapathId of the bridge.
+ *
+ * @return datapathId the datapathId to use
+ */
+ public OvsdbDatapathId datapathId() {
+ return datapathId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(bridgeName, datapathId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbBridge) {
+ final OvsdbBridge otherOvsdbBridge = (OvsdbBridge) obj;
+ return Objects.equals(this.bridgeName, otherOvsdbBridge.bridgeName)
+ && Objects.equals(this.datapathId,
+ otherOvsdbBridge.datapathId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("bridgeName", bridgeName.value())
+ .add("datapathId", datapathId.value()).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java
new file mode 100644
index 00000000..daedff5f
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java
@@ -0,0 +1,71 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The class representing a bridge name. This class is immutable.
+ */
+public final class OvsdbBridgeName {
+
+ private final String value;
+
+ /**
+ * Constructor from a String bridge name.
+ *
+ * @param value the bridge name to use
+ */
+ public OvsdbBridgeName(String value) {
+ checkNotNull(value, "value is not null");
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the bridge name.
+ *
+ * @return the value of the bridge name
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbBridgeName) {
+ final OvsdbBridgeName otherBridgeName = (OvsdbBridgeName) obj;
+ return Objects.equals(this.value, otherBridgeName.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbClientService.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbClientService.java
new file mode 100644
index 00000000..ab88a24e
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbClientService.java
@@ -0,0 +1,231 @@
+/*
+ * 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.controller;
+
+import java.util.List;
+import java.util.Set;
+
+import org.onlab.packet.IpAddress;
+
+import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRPC;
+import org.onosproject.ovsdb.rfc.message.OperationResult;
+import org.onosproject.ovsdb.rfc.message.TableUpdates;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.operations.Operation;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * Represents to provider facing side of a node.
+ */
+public interface OvsdbClientService extends OvsdbRPC {
+ /**
+ * Gets the node identifier.
+ *
+ * @return node identifier
+ */
+ OvsdbNodeId nodeId();
+
+ /**
+ * Creates the configuration for the tunnel.
+ *
+ * @param srcIp source IP address
+ * @param dstIp destination IP address
+ */
+ void createTunnel(IpAddress srcIp, IpAddress dstIp);
+
+ /**
+ * Drops the configuration for the tunnel.
+ *
+ * @param srcIp source IP address
+ * @param dstIp destination IP address
+ */
+ void dropTunnel(IpAddress srcIp, IpAddress dstIp);
+
+ /**
+ * Gets tunnels of the node.
+ *
+ * @return set of tunnels; empty if no tunnel is find
+ */
+ Set<OvsdbTunnel> getTunnels();
+
+ /**
+ * Creates a bridge.
+ *
+ * @param bridgeName bridge name
+ */
+ void createBridge(String bridgeName);
+
+ /**
+ * Drops a bridge.
+ *
+ * @param bridgeName bridge name
+ */
+ void dropBridge(String bridgeName);
+
+ /**
+ * Gets bridges of the node.
+ *
+ * @return set of bridges; empty if no bridge is find
+ */
+ Set<OvsdbBridge> getBridges();
+
+ /**
+ * Creates a port.
+ *
+ * @param bridgeName bridge name
+ * @param portName port name
+ */
+ void createPort(String bridgeName, String portName);
+
+ /**
+ * Drops a port.
+ *
+ * @param bridgeName bridge name
+ * @param portName port name
+ */
+ void dropPort(String bridgeName, String portName);
+
+ /**
+ * Gets ports of the bridge.
+ *
+ * @return set of ports; empty if no ports is find
+ */
+ Set<OvsdbPort> getPorts();
+
+ /**
+ * Checks if the node is still connected.
+ *
+ * @return true if the node is still connected
+ */
+ boolean isConnected();
+
+ /**
+ * Gets the Bridge uuid.
+ *
+ * @param bridgeName bridge name
+ * @return bridge uuid, empty if no uuid is find
+ */
+ String getBridgeUuid(String bridgeName);
+
+ /**
+ * Gets the Port uuid.
+ *
+ * @param portName port name
+ * @param bridgeUuid bridge uuid
+ * @return port uuid, empty if no uuid is find
+ */
+ String getPortUuid(String portName, String bridgeUuid);
+
+ /**
+ * Gets the Interface uuid.
+ *
+ * @param portUuid port uuid
+ * @param portName port name
+ * @return interface uuid, empty if no uuid is find
+ */
+ String getInterfaceUuid(String portUuid, String portName);
+
+ /**
+ * Gets the Controller uuid.
+ *
+ * @param controllerName controller name
+ * @param controllerTarget controller target
+ * @return controller uuid, empty if no uuid is find
+ */
+ String getControllerUuid(String controllerName, String controllerTarget);
+
+ /**
+ * Gets the Ovs uuid.
+ *
+ * @param dbName database name
+ * @return ovs uuid, empty if no uuid is find
+ */
+ String getOvsUuid(String dbName);
+
+ /**
+ * Gets the ovsdb database schema.
+ *
+ * @param dbName database name
+ * @return database schema
+ */
+ ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName);
+
+ /**
+ * Gets the ovsdb table updates.
+ *
+ * @param dbName database name
+ * @param id random uuid
+ * @return table updates
+ */
+ ListenableFuture<TableUpdates> monitorTables(String dbName, String id);
+
+ /**
+ * Gets the ovsdb config operation result.
+ *
+ * @param dbName database name
+ * @param operations the list of operations
+ * @return operation results
+ */
+ ListenableFuture<List<OperationResult>> transactConfig(String dbName,
+ List<Operation> operations);
+
+ /**
+ * Gets the ovsdb database schema from local.
+ *
+ * @param dbName database name
+ * @return database schema
+ */
+ DatabaseSchema getDatabaseSchema(String dbName);
+
+ /**
+ * Gets the ovsdb row from the local ovsdb store.
+ *
+ * @param dbName database name
+ * @param tableName table name
+ * @param uuid row uuid
+ * @return row ovsdb row
+ */
+ Row getRow(String dbName, String tableName, String uuid);
+
+ /**
+ * Removes the ovsdb row from the local ovsdb store.
+ *
+ * @param dbName database name
+ * @param tableName table name
+ * @param uuid row uuid
+ */
+ void removeRow(String dbName, String tableName, String uuid);
+
+ /**
+ * Updates the local ovsdb store.
+ *
+ * @param dbName database name
+ * @param tableName table name
+ * @param uuid row uuid
+ * @param row ovsdb row
+ */
+ void updateOvsdbStore(String dbName, String tableName, String uuid, Row row);
+
+ /**
+ * Gets ovsdb local ports.
+ *
+ * @param ifaceids the ifaceid that needed
+ * @return ovsdb ports
+ */
+ Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids);
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java
new file mode 100644
index 00000000..c1133bbd
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbConstant.java
@@ -0,0 +1,68 @@
+/*
+ * 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.controller;
+
+/**
+ * Ovsdb related constants.
+ */
+public final class OvsdbConstant {
+
+ /**
+ * Default constructor.
+ *
+ * The constructor is private to prevent creating an instance of this
+ * utility class.
+ */
+ private OvsdbConstant() {
+ }
+
+ /** Ovsdb database Open_vSwitch. */
+ public static final String DATABASENAME = "Open_vSwitch";
+
+ /** Ovsdb table Bridge. */
+ public static final String BRIDGE = "Bridge";
+
+ /** Ovsdb table Interface. */
+ public static final String INTERFACE = "Interface";
+
+ /** Ovsdb table Controller. */
+ public static final String CONTROLLER = "Controller";
+
+ /** Ovsdb table Port. */
+ public static final String PORT = "Port";
+
+ /** Ovsdb bridge name. */
+ public static final String INTEGRATION_BRIDGE = "br-int";
+
+ /** Ovsdb vxlan tunnel type. */
+ public static final String TYPEVXLAN = "vxlan";
+
+ /** Openflow version. */
+ public static final String OPENFLOW13 = "OpenFlow13";
+
+ /** Ovsdb external_id_interface_id.. */
+ public static final String EXTERNAL_ID_INTERFACE_ID = "iface-id";
+
+ /** Ovsdb external_id_vm_mac. */
+ public static final String EXTERNAL_ID_VM_MAC = "attached-mac";
+
+ /** Openflow port. */
+ public static final int OFPORT = 6633;
+
+ /** Ovsdb port. */
+ public static final int OVSDBPORT = 6640;
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbController.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbController.java
new file mode 100644
index 00000000..9e245240
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbController.java
@@ -0,0 +1,68 @@
+/*
+ * 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.controller;
+
+import java.util.List;
+
+/**
+ * Abstraction of an ovsdb controller. Serves as a one stop shop for obtaining
+ * OvsdbNode and (un)register listeners on ovsdb events and ovsdb node events.
+ */
+public interface OvsdbController {
+
+ /**
+ * Adds Node Event Listener.
+ *
+ * @param listener node listener
+ */
+ void addNodeListener(OvsdbNodeListener listener);
+
+ /**
+ * Removes Node Event Listener.
+ *
+ * @param listener node listener
+ */
+ void removeNodeListener(OvsdbNodeListener listener);
+
+ /**
+ * Adds ovsdb event listener.
+ *
+ * @param listener event listener
+ */
+ void addOvsdbEventListener(OvsdbEventListener listener);
+
+ /**
+ * Removes ovsdb event listener.
+ *
+ * @param listener event listener
+ */
+ void removeOvsdbEventListener(OvsdbEventListener listener);
+
+ /**
+ * Gets all the nodes information.
+ *
+ * @return the list of node id
+ */
+ List<OvsdbNodeId> getNodeIds();
+
+ /**
+ * Gets a ovsdb client by node identifier.
+ *
+ * @param nodeId node identifier
+ * @return OvsdbClient ovsdb node information
+ */
+ OvsdbClientService getOvsdbClient(OvsdbNodeId nodeId);
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java
new file mode 100644
index 00000000..1a2d8366
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java
@@ -0,0 +1,68 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Objects;
+
+/**
+ * The class representing a datapathid. This class is immutable.
+ */
+public final class OvsdbDatapathId {
+ private final String value;
+
+ /**
+ * Constructor from a String datapathid.
+ *
+ * @param value the datapathid to use
+ */
+ public OvsdbDatapathId(String value) {
+ checkNotNull(value, "value is not null");
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the datapathid.
+ *
+ * @return the value of the datapathid
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbDatapathId) {
+ final OvsdbDatapathId otherDatapathId = (OvsdbDatapathId) obj;
+ return Objects.equals(this.value, otherDatapathId.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEvent.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEvent.java
new file mode 100644
index 00000000..35fac7bc
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEvent.java
@@ -0,0 +1,74 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * The abstract event of ovsdb.
+ */
+public final class OvsdbEvent<S> {
+
+ public enum Type {
+ /**
+ * Signifies that a new ovs port update has been detected.
+ */
+ PORT_ADDED,
+ /**
+ * Signifies that a ovs port has been removed.
+ */
+ PORT_REMOVED
+ }
+
+ private final Type type;
+ private final S subject;
+
+ /**
+ * Creates an event of a given type and for the specified event subject.
+ *
+ * @param type event type
+ * @param subject event subject
+ */
+ public OvsdbEvent(Type type, S subject) {
+ this.type = type;
+ this.subject = subject;
+ }
+
+ /**
+ * Returns the type of the event.
+ *
+ * @return event type
+ */
+ public Type type() {
+ return type;
+ }
+
+ /**
+ * Returns the subject of the event.
+ *
+ * @return subject to which this event pertains
+ */
+ public S subject() {
+ return subject;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("type", type())
+ .add("subject", subject()).toString();
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventListener.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventListener.java
new file mode 100644
index 00000000..b7bf2b55
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventListener.java
@@ -0,0 +1,28 @@
+/*
+ * 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.controller;
+
+/**
+ * Allows for providers interested in ovsdb events to be notified.
+ */
+public interface OvsdbEventListener {
+ /**
+ * Handles the ovsdb event.
+ *
+ * @param event ovsdb event
+ */
+ void handle(OvsdbEvent<EventSubject> event);
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventSubject.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventSubject.java
new file mode 100644
index 00000000..263027f2
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbEventSubject.java
@@ -0,0 +1,75 @@
+/*
+ * 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.controller;
+
+import java.util.Set;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+
+/**
+ * Represents for a entity that carry important information for listener.
+ */
+public interface OvsdbEventSubject extends EventSubject {
+ /**
+ * Returns the MAC address associated with this host (NIC).
+ *
+ * @return the MAC address of this host
+ */
+ MacAddress hwAddress();
+
+ /**
+ * Returns the IP address associated with this host's MAC.
+ *
+ * @return host IP address
+ */
+ Set<IpAddress> ipAddress();
+
+ /**
+ * Returns the Port name associated with the host.
+ *
+ * @return port name
+ */
+ OvsdbPortName portName();
+
+ /**
+ * Returns the Port number associated with the host.
+ *
+ * @return port number
+ */
+ OvsdbPortNumber portNumber();
+
+ /**
+ * Returns the Port type associated with the host.
+ *
+ * @return port type
+ */
+ OvsdbPortType portType();
+
+ /**
+ * Returns the Ovs dpid associated with the host.
+ *
+ * @return Ovs dpid
+ */
+ OvsdbDatapathId dpid();
+
+ /**
+ * Returns the vm ifaceid associated with the host.
+ *
+ * @return vm ifaceid
+ */
+ OvsdbIfaceId ifaceid();
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java
new file mode 100644
index 00000000..b0535d21
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java
@@ -0,0 +1,68 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Objects;
+
+/**
+ * The class representing a ifaceid. This class is immutable.
+ */
+public class OvsdbIfaceId {
+ private final String value;
+
+ /**
+ * Constructor from a String ifaceid.
+ *
+ * @param value the ifaceid to use
+ */
+ public OvsdbIfaceId(String value) {
+ checkNotNull(value, "value is not null");
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the ifaceid.
+ *
+ * @return the value of the ifaceid
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbIfaceId) {
+ final OvsdbIfaceId otherIfaceId = (OvsdbIfaceId) obj;
+ return Objects.equals(this.value, otherIfaceId.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java
new file mode 100644
index 00000000..2c1a440b
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java
@@ -0,0 +1,83 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onlab.packet.IpAddress;
+
+/**
+ * The class representing a OpenStack Compute or Network nodeId. This class is
+ * immutable.
+ */
+public final class OvsdbNodeId {
+ private static final String SCHEME = "ovsdb";
+ private final String nodeId;
+ private final String ipAddress;
+
+ /**
+ * Creates a new node identifier from a IpAddress ipAddress, a long port.
+ *
+ * @param ipAddress node IP address
+ * @param port node port
+ */
+ public OvsdbNodeId(IpAddress ipAddress, long port) {
+ checkNotNull(ipAddress, "ipAddress is not null");
+ this.ipAddress = ipAddress.toString();
+ this.nodeId = ipAddress + ":" + port;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(nodeId);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof OvsdbNodeId)) {
+ return false;
+ }
+
+ OvsdbNodeId otherNodeId = (OvsdbNodeId) other;
+
+ return Objects.equals(otherNodeId.nodeId, this.nodeId);
+ }
+
+ @Override
+ public String toString() {
+ return SCHEME + ":" + nodeId;
+ }
+
+ /**
+ * Gets the value of the NodeId.
+ *
+ * @return the value of the NodeId.
+ */
+ public String nodeId() {
+ return SCHEME + ":" + nodeId;
+ }
+
+ /**
+ * Get the IP address of the node.
+ *
+ * @return the IP address of the node
+ */
+ public String getIpAddress() {
+ return ipAddress;
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeListener.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeListener.java
new file mode 100644
index 00000000..ca732ef9
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeListener.java
@@ -0,0 +1,36 @@
+/*
+ * 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.controller;
+
+/**
+ * Allows for providers interested in node events to be notified.
+ */
+public interface OvsdbNodeListener {
+
+ /**
+ * Notifies that the node was added.
+ *
+ * @param nodeId the node where the event occurred
+ */
+ void nodeAdded(OvsdbNodeId nodeId);
+
+ /**
+ * Notifies that the node was removed.
+ *
+ * @param nodeId the node where the event occurred
+ */
+ void nodeRemoved(OvsdbNodeId nodeId);
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPort.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPort.java
new file mode 100644
index 00000000..3c04f6a5
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPort.java
@@ -0,0 +1,86 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The class representing a ovsdb port. This class is immutable.
+ */
+public final class OvsdbPort {
+
+ private final OvsdbPortNumber portNumber;
+ private final OvsdbPortName portName;
+
+ /**
+ * Constructor from a OvsdbPortNumber portNumber, OvsdbPortName portName.
+ *
+ * @param portNumber the portNumber to use
+ * @param portName the portName to use
+ */
+ public OvsdbPort(OvsdbPortNumber portNumber, OvsdbPortName portName) {
+ checkNotNull(portNumber, "portNumber is not null");
+ checkNotNull(portName, "portName is not null");
+ this.portNumber = portNumber;
+ this.portName = portName;
+ }
+
+ /**
+ * Gets the port number of the port.
+ *
+ * @return the port number of the port
+ */
+ public OvsdbPortNumber portNumber() {
+ return portNumber;
+ }
+
+ /**
+ * Gets the port name of the port.
+ *
+ * @return the port name of the port
+ */
+ public OvsdbPortName portName() {
+ return portName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(portNumber, portName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbPort) {
+ final OvsdbPort otherOvsdbPort = (OvsdbPort) obj;
+ return Objects.equals(this.portNumber, otherOvsdbPort.portNumber)
+ && Objects.equals(this.portName, otherOvsdbPort.portName);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("portNumber", String.valueOf(portNumber.value()))
+ .add("portName", portName.value()).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java
new file mode 100644
index 00000000..aa0f55b0
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java
@@ -0,0 +1,70 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The class representing a port number. This class is immutable.
+ */
+public final class OvsdbPortName {
+
+ private final String value;
+
+ /**
+ * Constructor from a String port name.
+ *
+ * @param value the port name to use
+ */
+ public OvsdbPortName(String value) {
+ checkNotNull(value, "value is not null");
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the port name.
+ *
+ * @return the value of the port name
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbPortName) {
+ final OvsdbPortName otherOvsdbPortName = (OvsdbPortName) obj;
+ return Objects.equals(this.value, otherOvsdbPortName.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java
new file mode 100644
index 00000000..9c57b5df
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java
@@ -0,0 +1,68 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+/**
+ * The class representing a port number. This class is immutable.
+ */
+public final class OvsdbPortNumber {
+
+ private final long value;
+
+ /**
+ * Constructor from a long port number.
+ *
+ * @param value the port number to use
+ */
+ public OvsdbPortNumber(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the port number.
+ *
+ * @return the value of the port number
+ */
+ public long value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbPortNumber) {
+ final OvsdbPortNumber ovsdbPortNumber = (OvsdbPortNumber) obj;
+ return Objects.equals(this.value, ovsdbPortNumber.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java
new file mode 100644
index 00000000..bf05fc73
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java
@@ -0,0 +1,70 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The class representing a port type. This class is immutable.
+ */
+public class OvsdbPortType {
+
+ private final String value;
+
+ /**
+ * Constructor from a String port type.
+ *
+ * @param value the port type to use
+ */
+ public OvsdbPortType(String value) {
+ checkNotNull(value, "value is not null");
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the port type.
+ *
+ * @return the value of the port type
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbPortType) {
+ final OvsdbPortType otherOvsdbPortType = (OvsdbPortType) obj;
+ return Objects.equals(this.value, otherOvsdbPortType.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbRowStore.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbRowStore.java
new file mode 100644
index 00000000..bec0e2e9
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbRowStore.java
@@ -0,0 +1,69 @@
+/*
+ * 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.controller;
+
+import java.util.concurrent.ConcurrentMap;
+
+import org.onosproject.ovsdb.rfc.notation.Row;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The class representing a table data.
+ */
+public class OvsdbRowStore {
+
+ private final ConcurrentMap<String, Row> rowStore = Maps.newConcurrentMap();
+
+ /**
+ * Gets the row.
+ *
+ * @param uuid the key of the rowStore
+ * @return row the row of the rowStore
+ */
+ public Row getRow(String uuid) {
+ return rowStore.get(uuid);
+ }
+
+ /**
+ * Inserts a row to rowStore.
+ *
+ * @param uuid key of the row
+ * @param row a row of the table
+ */
+ public void insertRow(String uuid, Row row) {
+ rowStore.put(uuid, row);
+ }
+
+ /**
+ * Deletes a row to rowStore.
+ *
+ * @param uuid key of the row
+ */
+ public void deleteRow(String uuid) {
+ rowStore.remove(uuid);
+ }
+
+ /**
+ * Gets the rowStore.
+ *
+ * @return rowStore
+ */
+ public ConcurrentMap<String, Row> getRowStore() {
+ return rowStore;
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbStore.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbStore.java
new file mode 100644
index 00000000..56704908
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbStore.java
@@ -0,0 +1,71 @@
+/*
+ * 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.controller;
+
+import java.util.concurrent.ConcurrentMap;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The cache for local ovsdb database.
+ */
+public class OvsdbStore {
+
+ private final ConcurrentMap<String, OvsdbTableStore> ovsdbStore = Maps.newConcurrentMap();
+
+ /**
+ * Gets the OvsdbTableStore.
+ *
+ * @param dbName ovsdb database name
+ * @return tableStore OvsdbTableStore
+ */
+ public OvsdbTableStore getOvsdbTableStore(String dbName) {
+ OvsdbTableStore tableStore = ovsdbStore.get(dbName);
+ if (tableStore == null) {
+ return null;
+ }
+ return tableStore;
+ }
+
+ /**
+ * Create or Update a value to ovsdbStore.
+ *
+ * @param dbName ovsdb database name
+ * @param tableStore a database tableStore.
+ */
+ public void createOrUpdateOvsdbStore(String dbName, OvsdbTableStore tableStore) {
+ ovsdbStore.put(dbName, tableStore);
+ }
+
+ /**
+ * Drops a value to rowStore.
+ *
+ * @param dbName ovsdb database name
+ */
+ public void dropOvsdbStore(String dbName) {
+ ovsdbStore.remove(dbName);
+ }
+
+ /**
+ * Gets the ovsdbStore.
+ *
+ * @return ovsdbStore
+ */
+ public ConcurrentMap<String, OvsdbTableStore> getOvsdbStore() {
+ return ovsdbStore;
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTableStore.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTableStore.java
new file mode 100644
index 00000000..1d9146eb
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTableStore.java
@@ -0,0 +1,67 @@
+/*
+ * 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.controller;
+
+import java.util.concurrent.ConcurrentMap;
+
+import com.google.common.collect.Maps;
+
+/**
+ * The class representing a database data.
+ */
+public class OvsdbTableStore {
+
+ private final ConcurrentMap<String, OvsdbRowStore> tableStore = Maps.newConcurrentMap();
+
+ /**
+ * Gets the ovsdbRowStore.
+ *
+ * @param tableName a ovsdb table name
+ * @return OvsdbRowStore the data of the table
+ */
+ public OvsdbRowStore getRows(String tableName) {
+ return tableStore.get(tableName);
+ }
+
+ /**
+ * Create or update a value to tableStore.
+ *
+ * @param tableName key of the tableName
+ * @param rowStore a row of the table
+ */
+ public void createOrUpdateTable(String tableName, OvsdbRowStore rowStore) {
+ tableStore.put(tableName, rowStore);
+ }
+
+ /**
+ * Drops a value to table data.
+ *
+ * @param tableName key of the tableName
+ */
+ public void dropTable(String tableName) {
+ tableStore.remove(tableName);
+ }
+
+ /**
+ * Gets the tableStore.
+ *
+ * @return tableStore
+ */
+ public ConcurrentMap<String, OvsdbRowStore> getTableStore() {
+ return tableStore;
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnel.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnel.java
new file mode 100644
index 00000000..e1c5c7fd
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnel.java
@@ -0,0 +1,125 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onlab.packet.IpAddress;
+
+/**
+ * The class representing a ovsdb tunnel. This class is immutable.
+ */
+public final class OvsdbTunnel {
+
+ private final IpAddress localIp;
+ private final IpAddress remoteIp;
+
+ public enum Type {
+ VXLAN, GRE
+ }
+
+ private final Type tunnelType;
+ private final OvsdbTunnelName tunnelName;
+
+ /**
+ * Constructor from a IpAddress localIp, IpAddress remoteIp Type tunnelType,
+ * OvsdbTunnelName tunnelName.
+ *
+ * @param localIp the localIp to use
+ * @param remoteIp the remoteIp to use
+ * @param tunnelType the tunnelType to use
+ * @param tunnelName the tunnelName to use
+ */
+ public OvsdbTunnel(IpAddress localIp, IpAddress remoteIp, Type tunnelType,
+ OvsdbTunnelName tunnelName) {
+ checkNotNull(localIp, "portName is not null");
+ checkNotNull(remoteIp, "portName is not null");
+ checkNotNull(tunnelName, "portName is not null");
+ this.localIp = localIp;
+ this.remoteIp = remoteIp;
+ this.tunnelType = tunnelType;
+ this.tunnelName = tunnelName;
+ }
+
+ /**
+ * Gets the local IP of the tunnel.
+ *
+ * @return the local IP of the tunnel
+ */
+ public IpAddress localIp() {
+ return localIp;
+ }
+
+ /**
+ * Gets the remote IP of the tunnel.
+ *
+ * @return the remote IP of the tunnel
+ */
+ public IpAddress remoteIp() {
+ return remoteIp;
+ }
+
+ /**
+ * Gets the tunnel type of the tunnel.
+ *
+ * @return the tunnel type of the tunnel
+ */
+ public Type tunnelType() {
+ return tunnelType;
+ }
+
+ /**
+ * Gets the tunnel name of the tunnel.
+ *
+ * @return the tunnel name of the tunnel
+ */
+ public OvsdbTunnelName tunnelName() {
+ return tunnelName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(localIp, remoteIp, tunnelType, tunnelName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbTunnel) {
+ final OvsdbTunnel otherOvsdbTunnel = (OvsdbTunnel) obj;
+ return Objects.equals(this.localIp, otherOvsdbTunnel.localIp)
+ && Objects.equals(this.remoteIp, otherOvsdbTunnel.remoteIp)
+ && Objects.equals(this.tunnelType,
+ otherOvsdbTunnel.tunnelType)
+ && Objects.equals(this.tunnelName,
+ otherOvsdbTunnel.tunnelName);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("localIp", localIp.toString())
+ .add("remoteIp", remoteIp.toString())
+ .add("tunnelType", tunnelType).add("tunnelName", tunnelName)
+ .toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java
new file mode 100644
index 00000000..116f6217
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java
@@ -0,0 +1,69 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The class representing a tunnel name. This class is immutable.
+ */
+public final class OvsdbTunnelName {
+ private final String value;
+
+ /**
+ * Constructor from a String tunnel name.
+ *
+ * @param value the tunnel name to use
+ */
+ public OvsdbTunnelName(String value) {
+ checkNotNull(value, "value is not null");
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the tunnel name.
+ *
+ * @return the value of the tunnel name
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbTunnelName) {
+ final OvsdbTunnelName otherOvsdbTunnelName = (OvsdbTunnelName) obj;
+ return Objects.equals(this.value, otherOvsdbTunnelName.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java
new file mode 100644
index 00000000..0c64cc0e
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java
@@ -0,0 +1,1188 @@
+/*
+ * 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.controller.driver;
+
+import io.netty.channel.Channel;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.ovsdb.controller.OvsdbBridge;
+import org.onosproject.ovsdb.controller.OvsdbBridgeName;
+import org.onosproject.ovsdb.controller.OvsdbClientService;
+import org.onosproject.ovsdb.controller.OvsdbConstant;
+import org.onosproject.ovsdb.controller.OvsdbDatapathId;
+import org.onosproject.ovsdb.controller.OvsdbNodeId;
+import org.onosproject.ovsdb.controller.OvsdbPort;
+import org.onosproject.ovsdb.controller.OvsdbPortName;
+import org.onosproject.ovsdb.controller.OvsdbPortNumber;
+import org.onosproject.ovsdb.controller.OvsdbRowStore;
+import org.onosproject.ovsdb.controller.OvsdbStore;
+import org.onosproject.ovsdb.controller.OvsdbTableStore;
+import org.onosproject.ovsdb.controller.OvsdbTunnel;
+import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
+import org.onosproject.ovsdb.rfc.message.OperationResult;
+import org.onosproject.ovsdb.rfc.message.TableUpdates;
+import org.onosproject.ovsdb.rfc.notation.Condition;
+import org.onosproject.ovsdb.rfc.notation.Mutation;
+import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
+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.operations.Delete;
+import org.onosproject.ovsdb.rfc.operations.Insert;
+import org.onosproject.ovsdb.rfc.operations.Mutate;
+import org.onosproject.ovsdb.rfc.operations.Operation;
+import org.onosproject.ovsdb.rfc.operations.Update;
+import org.onosproject.ovsdb.rfc.schema.ColumnSchema;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+import org.onosproject.ovsdb.rfc.table.Bridge;
+import org.onosproject.ovsdb.rfc.table.Controller;
+import org.onosproject.ovsdb.rfc.table.Interface;
+import org.onosproject.ovsdb.rfc.table.OvsdbTable;
+import org.onosproject.ovsdb.rfc.table.Port;
+import org.onosproject.ovsdb.rfc.table.TableGenerator;
+import org.onosproject.ovsdb.rfc.utils.ConditionUtil;
+import org.onosproject.ovsdb.rfc.utils.FromJsonUtil;
+import org.onosproject.ovsdb.rfc.utils.JsonRpcWriterUtil;
+import org.onosproject.ovsdb.rfc.utils.MutationUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+
+/**
+ * An representation of an ovsdb client.
+ */
+public class DefaultOvsdbClient
+ implements OvsdbProviderService, OvsdbClientService {
+
+ private final Logger log = LoggerFactory
+ .getLogger(DefaultOvsdbClient.class);
+
+ private Channel channel;
+
+ private OvsdbAgent agent;
+ private boolean connected;
+ private OvsdbNodeId nodeId;
+ private Callback monitorCallBack;
+
+ private OvsdbStore ovsdbStore = new OvsdbStore();
+
+ private final Map<String, String> requestMethod = Maps.newHashMap();
+ private final Map<String, SettableFuture<? extends Object>> requestResult = Maps
+ .newHashMap();
+
+ private final Map<String, DatabaseSchema> schema = Maps.newHashMap();
+ private final Set<OvsdbTunnel> ovsdbTunnels = new HashSet<OvsdbTunnel>();
+
+ /**
+ * Creates an OvsdbClient.
+ *
+ * @param nodeId ovsdb node id
+ */
+ public DefaultOvsdbClient(OvsdbNodeId nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ @Override
+ public OvsdbNodeId nodeId() {
+ return nodeId;
+ }
+
+ @Override
+ public void setAgent(OvsdbAgent agent) {
+ if (this.agent == null) {
+ this.agent = agent;
+ }
+ }
+
+ @Override
+ public void setChannel(Channel channel) {
+ this.channel = channel;
+ }
+
+ @Override
+ public void setConnection(boolean connected) {
+ this.connected = connected;
+ }
+
+ @Override
+ public boolean isConnected() {
+ return this.connected;
+ }
+
+ @Override
+ public void nodeAdded() {
+ this.agent.addConnectedNode(nodeId, this);
+ }
+
+ @Override
+ public void nodeRemoved() {
+ this.agent.removeConnectedNode(nodeId);
+ channel.disconnect();
+ }
+
+ /**
+ * Gets the ovsdb table store.
+ *
+ * @param dbName the ovsdb database name
+ * @return ovsTableStore, empty if table store is find
+ */
+ private OvsdbTableStore getTableStore(String dbName) {
+ if (ovsdbStore == null) {
+ return null;
+ }
+ return ovsdbStore.getOvsdbTableStore(dbName);
+ }
+
+ /**
+ * Gets the ovsdb row store.
+ *
+ * @param dbName the ovsdb database name
+ * @param tableName the ovsdb table name
+ *
+ * @return ovsRowStore, empty if row store is find
+ */
+ private OvsdbRowStore getRowStore(String dbName, String tableName) {
+ OvsdbTableStore tableStore = getTableStore(dbName);
+ if (tableStore == null) {
+ return null;
+ }
+ return tableStore.getRows(tableName);
+ }
+
+ /**
+ * Gets the ovsdb row.
+ *
+ * @param dbName the ovsdb database name
+ * @param tableName the ovsdb table name
+ * @param uuid the key of the row
+ * @return row, empty if row is find
+ */
+ @Override
+ public Row getRow(String dbName, String tableName, String uuid) {
+ OvsdbTableStore tableStore = getTableStore(dbName);
+ if (tableStore == null) {
+ return null;
+ }
+ OvsdbRowStore rowStore = tableStore.getRows(tableName);
+ if (rowStore == null) {
+ return null;
+ }
+ return rowStore.getRow(uuid);
+ }
+
+ @Override
+ public void removeRow(String dbName, String tableName, String uuid) {
+ OvsdbTableStore tableStore = getTableStore(dbName);
+ if (tableStore == null) {
+ return;
+ }
+ OvsdbRowStore rowStore = tableStore.getRows(tableName);
+ if (rowStore == null) {
+ return;
+ }
+ rowStore.deleteRow(uuid);
+ }
+
+ @Override
+ public void updateOvsdbStore(String dbName, String tableName, String uuid,
+ Row row) {
+ OvsdbTableStore tableStore = ovsdbStore.getOvsdbTableStore(dbName);
+ if (tableStore == null) {
+ tableStore = new OvsdbTableStore();
+ }
+ OvsdbRowStore rowStore = tableStore.getRows(tableName);
+ if (rowStore == null) {
+ rowStore = new OvsdbRowStore();
+ }
+ rowStore.insertRow(uuid, row);
+ tableStore.createOrUpdateTable(tableName, rowStore);
+ ovsdbStore.createOrUpdateOvsdbStore(dbName, tableStore);
+ }
+
+ @Override
+ public String getPortUuid(String portName, String bridgeUuid) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+
+ Row bridgeRow = getRow(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.BRIDGE, bridgeUuid);
+
+ Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow,
+ OvsdbTable.BRIDGE);
+ if (bridge != null) {
+ OvsdbSet setPorts = (OvsdbSet) bridge.getPortsColumn().data();
+ @SuppressWarnings("unchecked")
+ Set<UUID> ports = setPorts.set();
+ if (ports == null || ports.size() == 0) {
+ log.warn("The port uuid is null");
+ return null;
+ }
+
+ for (UUID uuid : ports) {
+ Row portRow = getRow(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.PORT, uuid.value());
+ Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
+ OvsdbTable.PORT);
+ if (port != null && portName.equalsIgnoreCase(port.getName())) {
+ return uuid.value();
+ }
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ public String getInterfaceUuid(String portUuid, String portName) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+
+ Row portRow = getRow(OvsdbConstant.DATABASENAME, OvsdbConstant.PORT,
+ portUuid);
+ Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
+ OvsdbTable.PORT);
+
+ if (port != null) {
+ OvsdbSet setInterfaces = (OvsdbSet) port.getInterfacesColumn().data();
+ @SuppressWarnings("unchecked")
+ Set<UUID> interfaces = setInterfaces.set();
+
+ if (interfaces == null || interfaces.size() == 0) {
+ log.warn("The interface uuid is null");
+ return null;
+ }
+
+ for (UUID uuid : interfaces) {
+ Row intfRow = getRow(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.INTERFACE, uuid.value());
+ Interface intf = (Interface) TableGenerator
+ .getTable(dbSchema, intfRow, OvsdbTable.INTERFACE);
+ if (intf != null && portName.equalsIgnoreCase(intf.getName())) {
+ return uuid.value();
+ }
+ }
+
+ }
+
+ return null;
+ }
+
+ @Override
+ public String getBridgeUuid(String bridgeName) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+
+ OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.BRIDGE);
+ if (rowStore == null) {
+ log.debug("The bridge uuid is null");
+ return null;
+ }
+
+ ConcurrentMap<String, Row> bridgeTableRows = rowStore.getRowStore();
+ if (bridgeTableRows == null) {
+ log.debug("The bridge uuid is null");
+ return null;
+ }
+
+ for (String uuid : bridgeTableRows.keySet()) {
+ Bridge bridge = (Bridge) TableGenerator
+ .getTable(dbSchema, bridgeTableRows.get(uuid),
+ OvsdbTable.BRIDGE);
+
+ if (bridge.getName().equals(bridgeName)) {
+ return uuid;
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ public String getControllerUuid(String controllerName,
+ String controllerTarget) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.CONTROLLER);
+ if (rowStore == null) {
+ log.debug("The controller uuid is null");
+ return null;
+ }
+
+ ConcurrentMap<String, Row> controllerTableRows = rowStore.getRowStore();
+ if (controllerTableRows != null) {
+ for (String uuid : controllerTableRows.keySet()) {
+
+ Controller controller = (Controller) TableGenerator
+ .getTable(dbSchema, controllerTableRows.get(uuid),
+ OvsdbTable.CONTROLLER);
+ String target = (String) controller.getTargetColumn().data();
+ if (target.equalsIgnoreCase(controllerTarget)) {
+ return uuid;
+ }
+
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getOvsUuid(String dbName) {
+ OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.DATABASENAME);
+ if (rowStore == null) {
+ log.debug("The bridge uuid is null");
+ return null;
+ }
+ ConcurrentMap<String, Row> ovsTableRows = rowStore.getRowStore();
+ if (ovsTableRows != null) {
+ for (String uuid : ovsTableRows.keySet()) {
+ Row row = ovsTableRows.get(uuid);
+ String tableName = row.tableName();
+ if (tableName.equals(dbName)) {
+ return uuid;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void createPort(String bridgeName, String portName) {
+ String bridgeUuid = getBridgeUuid(bridgeName);
+ if (bridgeUuid == null) {
+ log.error("Can't find bridge {} in {}", bridgeName,
+ nodeId.getIpAddress());
+ return;
+ }
+
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ String portUuid = getPortUuid(portName, bridgeUuid);
+
+ Port port = (Port) TableGenerator
+ .createTable(dbSchema, OvsdbTable.PORT);
+
+ port.setName(portName);
+ if (portUuid == null) {
+ insertConfig(OvsdbConstant.PORT, "_uuid", OvsdbConstant.BRIDGE,
+ "ports", bridgeUuid, port.getRow());
+ } else {
+ updateConfig(OvsdbConstant.PORT, "_uuid", portUuid, port.getRow());
+ }
+
+ return;
+ }
+
+ @Override
+ public void dropPort(String bridgeName, String portName) {
+ String bridgeUuid = getBridgeUuid(bridgeName);
+ if (bridgeUuid == null) {
+ log.error("Could not find Bridge {} in {}", bridgeName, nodeId);
+ return;
+ }
+
+ String portUuid = getPortUuid(portName, bridgeUuid);
+ if (portUuid != null) {
+ log.info("Port {} delete", portName);
+ deleteConfig(OvsdbConstant.PORT, "_uuid", portUuid,
+ OvsdbConstant.BRIDGE, "ports");
+ }
+ }
+
+ @Override
+ public void createBridge(String bridgeName) {
+ log.debug("create bridge {}", bridgeName);
+
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ if (dbSchema == null) {
+ log.warn("The schema is null");
+ return;
+ }
+
+ Bridge bridge = (Bridge) TableGenerator.createTable(dbSchema,
+ OvsdbTable.BRIDGE);
+ if (bridge == null) {
+ log.debug("Can not create bridge");
+ return;
+ }
+
+ Set<String> failModes = new HashSet<>();
+ failModes.add("secure");
+ bridge.setFailMode(failModes);
+
+ Set<String> protocols = new HashSet<>();
+ protocols.add(OvsdbConstant.OPENFLOW13);
+ bridge.setProtocols(protocols);
+
+ String ovsUuid = getOvsUuid(OvsdbConstant.DATABASENAME);
+ if (ovsUuid == null) {
+ log.warn("The Open_vSwitch is null");
+ return;
+ }
+
+ String bridgeUuid = getBridgeUuid(bridgeName);
+ if (bridgeUuid == null) {
+ log.debug("Create a new bridge");
+
+ bridge.setName(bridgeName);
+ bridgeUuid = insertConfig(OvsdbConstant.BRIDGE, "_uuid",
+ OvsdbConstant.DATABASENAME, "bridges",
+ ovsUuid, bridge.getRow());
+
+ if (bridgeUuid != null) {
+ Port port = (Port) TableGenerator.createTable(dbSchema,
+ OvsdbTable.PORT);
+ if (port != null) {
+ log.debug("the port is not null");
+ port.setName(bridgeName);
+
+ insertConfig(OvsdbConstant.PORT, "_uuid", "Bridge", "ports", bridgeUuid,
+ port.getRow());
+ }
+ }
+
+ } else {
+ log.info("Update a bridge");
+ updateConfig(OvsdbConstant.BRIDGE, "_uuid", bridgeUuid, bridge.getRow());
+ }
+
+ setController(bridgeUuid);
+ log.info("Create bridge success");
+ }
+
+ /**
+ * Sets the Controller.
+ *
+ * @param bridgeUuid bridge uuid
+ */
+ private void setController(String bridgeUuid) {
+ String controllerUuid = null;
+ String iPAddress = IpAddress.valueOf(((InetSocketAddress) channel
+ .localAddress())
+ .getAddress()
+ .getHostAddress())
+ .toString();
+
+ String target = "tcp:" + iPAddress + ":" + OvsdbConstant.OFPORT;
+ log.debug("controller IP {}: port {}", iPAddress, OvsdbConstant.OFPORT);
+
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ Controller controller = (Controller) TableGenerator
+ .createTable(dbSchema, OvsdbTable.CONTROLLER);
+
+ if (controller != null) {
+ controller.setTarget(target);
+ controllerUuid = getControllerUuid(OvsdbConstant.CONTROLLER, target);
+ if (controllerUuid == null) {
+
+ insertConfig(OvsdbConstant.CONTROLLER, "_uuid",
+ OvsdbConstant.BRIDGE, "controller", bridgeUuid,
+ controller.getRow());
+
+ } else {
+
+ Bridge bridge = (Bridge) TableGenerator
+ .createTable(dbSchema, OvsdbTable.BRIDGE);
+ Set<UUID> controllerUuids = new HashSet<>();
+ controllerUuids.add(UUID.uuid(controllerUuid));
+ bridge.setController(controllerUuids);
+ updateConfig(OvsdbConstant.CONTROLLER, "_uuid", bridgeUuid, bridge.getRow());
+
+ }
+ }
+
+ }
+
+ @Override
+ public void dropBridge(String bridgeName) {
+ String bridgeUUID = getBridgeUuid(bridgeName);
+ if (bridgeUUID == null) {
+ log.warn("Could not find bridge in node", nodeId.getIpAddress());
+ return;
+ }
+ deleteConfig(OvsdbConstant.BRIDGE, "_uuid", bridgeUUID,
+ OvsdbConstant.DATABASENAME, "bridges");
+ }
+
+ @Override
+ public void createTunnel(IpAddress srcIp, IpAddress dstIp) {
+ String bridgeUuid = getBridgeUuid(OvsdbConstant.INTEGRATION_BRIDGE);
+ if (bridgeUuid == null) {
+ log.warn("Could not find bridge {} and Could not create tunnel. ",
+ OvsdbConstant.INTEGRATION_BRIDGE);
+ return;
+ }
+
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ String portName = getTunnelName(OvsdbConstant.TYPEVXLAN, dstIp);
+ String portUuid = getPortUuid(portName, bridgeUuid);
+
+ Port port = (Port) TableGenerator
+ .createTable(dbSchema, OvsdbTable.PORT);
+ if (port != null) {
+ port.setName(portName);
+ }
+
+ if (portUuid == null) {
+ portUuid = insertConfig(OvsdbConstant.PORT, "_uuid", OvsdbConstant.BRIDGE,
+ "ports", bridgeUuid, port.getRow());
+ } else {
+ updateConfig(OvsdbConstant.PORT, "_uuid", portUuid, port.getRow());
+ }
+
+ // When a tunnel is created, A row is inserted into port table and
+ // interface table of the ovsdb node.
+ // and the following step is to get the interface uuid from local store
+ // in controller node.
+ // but it need spend some time synchronising data between node and
+ // controller.
+ // so loop to judge if interfaceUUid is null is necessary.
+ String interfaceUuid = null;
+ for (int i = 0; i < 10; i++) {
+ interfaceUuid = getInterfaceUuid(portUuid, portName);
+ if (interfaceUuid == null) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ log.warn("Interrupted while waiting to get interfaceUuid");
+ Thread.currentThread().interrupt();
+ }
+ } else {
+ break;
+ }
+ }
+
+ if (interfaceUuid != null) {
+
+ Interface tunInterface = (Interface) TableGenerator
+ .createTable(dbSchema, OvsdbTable.INTERFACE);
+
+ if (tunInterface != null) {
+
+ tunInterface.setType(OvsdbConstant.TYPEVXLAN);
+ Map<String, String> options = Maps.newHashMap();
+ options.put("key", "flow");
+ options.put("local_ip", srcIp.toString());
+ options.put("remote_ip", dstIp.toString());
+ tunInterface.setOptions(options);
+ updateConfig(OvsdbConstant.INTERFACE, "_uuid", interfaceUuid,
+ tunInterface.getRow());
+ log.info("Tunnel added success", tunInterface);
+
+ }
+ }
+
+ return;
+ }
+
+ @Override
+ public void dropTunnel(IpAddress srcIp, IpAddress dstIp) {
+ String bridgeName = OvsdbConstant.INTEGRATION_BRIDGE;
+ String portName = getTunnelName(OvsdbConstant.TYPEVXLAN, dstIp);
+ String bridgeUuid = getBridgeUuid(OvsdbConstant.INTEGRATION_BRIDGE);
+ if (bridgeUuid == null) {
+ log.warn("Could not find bridge {} in {}", bridgeName,
+ nodeId.getIpAddress());
+ return;
+ }
+
+ String portUUID = getPortUuid(portName, bridgeUuid);
+ if (portUUID != null) {
+ log.info("Delete tunnel");
+ deleteConfig(OvsdbConstant.PORT, "_uuid", portUUID,
+ OvsdbConstant.BRIDGE, "ports");
+ }
+
+ return;
+ }
+
+ /**
+ * Delete transact config.
+ *
+ * @param childTableName child table name
+ * @param childColumnName child column name
+ * @param childUuid child row uuid
+ * @param parentTableName parent table name
+ * @param parentColumnName parent column
+ *
+ */
+ private void deleteConfig(String childTableName, String childColumnName,
+ String childUuid, String parentTableName,
+ String parentColumnName) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ TableSchema childTableSchema = dbSchema.getTableSchema(childTableName);
+
+ ArrayList<Operation> operations = Lists.newArrayList();
+ if (parentTableName != null && parentColumnName != null) {
+ TableSchema parentTableSchema = dbSchema
+ .getTableSchema(parentTableName);
+ ColumnSchema parentColumnSchema = parentTableSchema
+ .getColumnSchema(parentColumnName);
+ List<Mutation> mutations = Lists.newArrayList();
+ Mutation mutation = MutationUtil.delete(parentColumnSchema.name(),
+ UUID.uuid(childUuid));
+ mutations.add(mutation);
+ List<Condition> conditions = Lists.newArrayList();
+ Condition condition = ConditionUtil.includes(parentColumnName,
+ UUID.uuid(childUuid));
+ conditions.add(condition);
+ Mutate op = new Mutate(parentTableSchema, conditions, mutations);
+ operations.add(op);
+ }
+
+ List<Condition> conditions = Lists.newArrayList();
+ Condition condition = ConditionUtil.equals(childColumnName, UUID.uuid(childUuid));
+ conditions.add(condition);
+ Delete del = new Delete(childTableSchema, conditions);
+ operations.add(del);
+ transactConfig(OvsdbConstant.DATABASENAME, operations);
+
+ return;
+ }
+
+ /**
+ * Update transact config.
+ *
+ * @param tableName table name
+ * @param columnName column name
+ * @param uuid uuid
+ * @param row the config data
+ *
+ */
+ private void updateConfig(String tableName, String columnName, String uuid,
+ Row row) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ TableSchema tableSchema = dbSchema.getTableSchema(tableName);
+
+ List<Condition> conditions = Lists.newArrayList();
+ Condition condition = ConditionUtil.equals(columnName, UUID.uuid(uuid));
+ conditions.add(condition);
+
+ Update update = new Update(tableSchema, row, conditions);
+
+ ArrayList<Operation> operations = Lists.newArrayList();
+ operations.add(update);
+
+ transactConfig(OvsdbConstant.DATABASENAME, operations);
+ }
+
+ /**
+ * Insert transact config.
+ *
+ * @param childTableName child table name
+ * @param childColumnName child column name
+ * @param parentTableName parent table name
+ * @param parentColumnName parent column
+ * @param parentUuid parent uuid
+ * @param row the config data
+ *
+ * @return uuid, empty if no uuid is find
+ */
+ private String insertConfig(String childTableName, String childColumnName,
+ String parentTableName, String parentColumnName,
+ String parentUuid, Row row) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+ TableSchema tableSchema = dbSchema.getTableSchema(childTableName);
+
+ String namedUuid = childTableName;
+ Insert insert = new Insert(tableSchema, namedUuid, row);
+
+ ArrayList<Operation> operations = Lists.newArrayList();
+ operations.add(insert);
+
+ if (parentTableName != null && parentColumnName != null) {
+ TableSchema parentTableSchema = dbSchema
+ .getTableSchema(parentTableName);
+ ColumnSchema parentColumnSchema = parentTableSchema
+ .getColumnSchema(parentColumnName);
+
+ List<Mutation> mutations = Lists.newArrayList();
+ Mutation mutation = MutationUtil.insert(parentColumnSchema.name(),
+ UUID.uuid(namedUuid));
+ mutations.add(mutation);
+
+ List<Condition> conditions = Lists.newArrayList();
+ Condition condition = ConditionUtil.equals("_uuid",
+ UUID.uuid(parentUuid));
+ conditions.add(condition);
+
+ Mutate op = new Mutate(parentTableSchema, conditions, mutations);
+ operations.add(op);
+ }
+ if (childTableName.equalsIgnoreCase(OvsdbConstant.PORT)) {
+ log.info("Handle port insert");
+ Insert intfInsert = handlePortInsertTable(OvsdbConstant.INTERFACE,
+ row);
+
+ if (intfInsert != null) {
+ operations.add(intfInsert);
+ }
+
+ Insert ins = (Insert) operations.get(0);
+ ins.getRow().put("interfaces",
+ UUID.uuid(OvsdbConstant.INTERFACE));
+ }
+
+ List<OperationResult> results;
+ try {
+ results = transactConfig(OvsdbConstant.DATABASENAME, operations)
+ .get();
+
+ return results.get(0).getUuid().value();
+ } catch (InterruptedException e) {
+ log.warn("Interrupted while waiting to get result");
+ Thread.currentThread().interrupt();
+ } catch (ExecutionException e) {
+ log.error("Exception thrown while to get result");
+ }
+
+ return null;
+ }
+
+ /**
+ * Handles port insert.
+ *
+ * @param tableName ovsdb table interface
+ * @param portRow row of port
+ *
+ * @return insert, empty if null
+ */
+ private Insert handlePortInsertTable(String tableName, Row portRow) {
+ DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
+
+ TableSchema portTableSchema = dbSchema
+ .getTableSchema(OvsdbConstant.PORT);
+ ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");
+
+ String portName = (String) portRow.getColumn(portColumnSchema.name()).data();
+
+ Interface inf = (Interface) TableGenerator
+ .createTable(dbSchema, OvsdbTable.INTERFACE);
+
+ inf.setName(portName);
+
+ TableSchema intfTableSchema = dbSchema
+ .getTableSchema(OvsdbConstant.INTERFACE);
+ Insert insert = new Insert(intfTableSchema, OvsdbConstant.INTERFACE,
+ inf.getRow());
+ return insert;
+ }
+
+ /**
+ * Gets tunnel name.
+ *
+ * @param tunnelType
+ * @param dstIp the remote ip address
+ *
+ * @return tunnel name
+ */
+ private String getTunnelName(String tunnelType, IpAddress dstIp) {
+ return tunnelType + "-" + dstIp.toString();
+ }
+
+ @Override
+ public ListenableFuture<DatabaseSchema> getOvsdbSchema(String dbName) {
+ if (dbName == null) {
+ return null;
+ }
+ DatabaseSchema databaseSchema = schema.get(dbName);
+ if (databaseSchema == null) {
+ List<String> dbNames = new ArrayList<String>();
+ dbNames.add(dbName);
+ Function<JsonNode, DatabaseSchema> rowFunction = new Function<JsonNode, DatabaseSchema>() {
+ @Override
+ public DatabaseSchema apply(JsonNode input) {
+ log.info("Get ovsdb database schema", dbName);
+ DatabaseSchema dbSchema = FromJsonUtil
+ .jsonNodeToDbSchema(dbName, input);
+ if (dbSchema == null) {
+ log.debug("Get ovsdb database schema error");
+ return null;
+ }
+ schema.put(dbName, dbSchema);
+
+ return dbSchema;
+ }
+ };
+
+ ListenableFuture<JsonNode> input = getSchema(dbNames);
+ if (input != null) {
+ return Futures.transform(input, rowFunction);
+ }
+ return null;
+ } else {
+ return Futures.immediateFuture(databaseSchema);
+ }
+ }
+
+ @Override
+ public ListenableFuture<TableUpdates> monitorTables(String dbName, String id) {
+ if (dbName == null) {
+ return null;
+ }
+ DatabaseSchema dbSchema = schema.get(dbName);
+ if (dbSchema != null) {
+ Function<JsonNode, TableUpdates> rowFunction = new Function<JsonNode, TableUpdates>() {
+ @Override
+ public TableUpdates apply(JsonNode input) {
+ log.info("Get table updates");
+ TableUpdates updates = FromJsonUtil
+ .jsonNodeToTableUpdates(input, dbSchema);
+ if (updates == null) {
+ log.debug("Get table updates error");
+ return null;
+ }
+ return updates;
+ }
+ };
+ return Futures.transform(monitor(dbSchema, id), rowFunction);
+ }
+ return null;
+ }
+
+ @Override
+ public ListenableFuture<List<OperationResult>> transactConfig(String dbName,
+ List<Operation> operations) {
+ if (dbName == null) {
+ return null;
+ }
+ DatabaseSchema dbSchema = schema.get(dbName);
+ if (dbSchema != null) {
+ Function<List<JsonNode>, List<OperationResult>> rowFunction =
+ new Function<List<JsonNode>, List<OperationResult>>() {
+ @Override
+ public List<OperationResult> apply(List<JsonNode> input) {
+ log.info("Get ovsdb operation result");
+ List<OperationResult> result = FromJsonUtil
+ .jsonNodeToOperationResult(input, operations);
+
+ if (result == null) {
+ log.debug("The operation result is null");
+ return null;
+ }
+ return result;
+ }
+ };
+ return Futures.transform(transact(dbSchema, operations),
+ rowFunction);
+ }
+ return null;
+ }
+
+ @Override
+ public ListenableFuture<JsonNode> getSchema(List<String> dbnames) {
+ String id = java.util.UUID.randomUUID().toString();
+ String getSchemaString = JsonRpcWriterUtil.getSchemaStr(id, dbnames);
+
+ SettableFuture<JsonNode> sf = SettableFuture.create();
+ requestResult.put(id, sf);
+ requestMethod.put(id, "getSchema");
+
+ channel.writeAndFlush(getSchemaString);
+ return sf;
+
+ }
+
+ @Override
+ public ListenableFuture<List<String>> echo() {
+ String id = java.util.UUID.randomUUID().toString();
+ String echoString = JsonRpcWriterUtil.echoStr(id);
+
+ SettableFuture<List<String>> sf = SettableFuture.create();
+ requestResult.put(id, sf);
+ requestMethod.put(id, "echo");
+
+ channel.writeAndFlush(echoString);
+ return sf;
+
+ }
+
+ @Override
+ public ListenableFuture<JsonNode> monitor(DatabaseSchema dbSchema,
+ String monitorId) {
+ String id = java.util.UUID.randomUUID().toString();
+ String monitorString = JsonRpcWriterUtil.monitorStr(id, monitorId,
+ dbSchema);
+
+ SettableFuture<JsonNode> sf = SettableFuture.create();
+ requestResult.put(id, sf);
+ requestMethod.put(id, "monitor");
+
+ channel.writeAndFlush(monitorString);
+ return sf;
+
+ }
+
+ @Override
+ public ListenableFuture<List<String>> listDbs() {
+ String id = java.util.UUID.randomUUID().toString();
+ String listDbsString = JsonRpcWriterUtil.listDbsStr(id);
+
+ SettableFuture<List<String>> sf = SettableFuture.create();
+ requestResult.put(id, sf);
+ requestMethod.put(id, "listDbs");
+
+ channel.writeAndFlush(listDbsString);
+ return sf;
+
+ }
+
+ @Override
+ public ListenableFuture<List<JsonNode>> transact(DatabaseSchema dbSchema,
+ List<Operation> operations) {
+ String id = java.util.UUID.randomUUID().toString();
+ String transactString = JsonRpcWriterUtil.transactStr(id, dbSchema,
+ operations);
+
+ SettableFuture<List<JsonNode>> sf = SettableFuture.create();
+ requestResult.put(id, sf);
+ requestMethod.put(id, "transact");
+
+ channel.writeAndFlush(transactString);
+ return sf;
+
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public void processResult(JsonNode response) {
+ log.debug("Handle result");
+ String requestId = response.get("id").asText();
+ SettableFuture sf = requestResult.get(requestId);
+ if (sf == null) {
+ log.debug("No such future to process");
+ return;
+ }
+ String methodName = requestMethod.get(requestId);
+
+ Object result;
+ result = FromJsonUtil.jsonResultParser(response, methodName);
+
+ sf.set(result);
+ return;
+ }
+
+ @Override
+ public void processRequest(JsonNode requestJson) {
+ log.debug("Handle request");
+ if (requestJson.get("method").asText().equalsIgnoreCase("echo")) {
+ log.debug("handle echo request");
+
+ String replyString = FromJsonUtil.getEchoRequestStr(requestJson);
+ channel.writeAndFlush(replyString);
+
+ return;
+ } else {
+ FromJsonUtil
+ .jsonCallbackRequestParser(requestJson, monitorCallBack);
+ return;
+ }
+ }
+
+ @Override
+ public void setCallback(Callback monitorCallback) {
+ this.monitorCallBack = monitorCallback;
+ }
+
+ @Override
+ public Set<OvsdbTunnel> getTunnels() {
+ return ovsdbTunnels;
+ }
+
+ @Override
+ public Set<OvsdbBridge> getBridges() {
+ Set<OvsdbBridge> ovsdbBridges = new HashSet<OvsdbBridge>();
+ OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
+ if (tableStore == null) {
+ return null;
+ }
+ OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.BRIDGE);
+ if (rowStore == null) {
+ return null;
+ }
+ ConcurrentMap<String, Row> rows = rowStore.getRowStore();
+ for (String uuid : rows.keySet()) {
+ Row row = getRow(OvsdbConstant.DATABASENAME, OvsdbConstant.BRIDGE,
+ uuid);
+ OvsdbBridge ovsdbBridge = getOvsdbBridge(row);
+ if (ovsdbBridge != null) {
+ ovsdbBridges.add(ovsdbBridge);
+ }
+ }
+ return ovsdbBridges;
+ }
+
+ @Override
+ public Set<OvsdbPort> getPorts() {
+ Set<OvsdbPort> ovsdbPorts = new HashSet<OvsdbPort>();
+ OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
+ if (tableStore == null) {
+ return null;
+ }
+ OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.INTERFACE);
+ if (rowStore == null) {
+ return null;
+ }
+ ConcurrentMap<String, Row> rows = rowStore.getRowStore();
+ for (String uuid : rows.keySet()) {
+ Row row = getRow(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.INTERFACE, uuid);
+ OvsdbPort ovsdbPort = getOvsdbPort(row);
+ if (ovsdbPort != null) {
+ ovsdbPorts.add(ovsdbPort);
+ }
+ }
+ return ovsdbPorts;
+ }
+
+ @Override
+ public DatabaseSchema getDatabaseSchema(String dbName) {
+ return schema.get(dbName);
+ }
+
+ //Gets ovsdb port.
+ private OvsdbPort getOvsdbPort(Row row) {
+ DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
+ Interface intf = (Interface) TableGenerator
+ .getTable(dbSchema, row, OvsdbTable.INTERFACE);
+ if (intf == null) {
+ return null;
+ }
+ long ofPort = getOfPort(intf);
+ String portName = intf.getName();
+ if ((ofPort < 0) || (portName == null)) {
+ return null;
+ }
+
+ OvsdbPort ovsdbPort = new OvsdbPort(new OvsdbPortNumber(ofPort),
+ new OvsdbPortName(portName));
+ return ovsdbPort;
+ }
+
+ ////Gets ovsdb bridge.
+ private OvsdbBridge getOvsdbBridge(Row row) {
+ DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
+ Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, row,
+ OvsdbTable.BRIDGE);
+ if (bridge == null) {
+ return null;
+ }
+
+ OvsdbSet datapathIdSet = (OvsdbSet) bridge.getDatapathIdColumn().data();
+ @SuppressWarnings("unchecked")
+ Set<String> datapathIds = datapathIdSet.set();
+ if (datapathIds == null || datapathIds.size() == 0) {
+ return null;
+ }
+ String datapathId = (String) datapathIds.toArray()[0];
+ String bridgeName = bridge.getName();
+ if ((datapathId == null) || (bridgeName == null)) {
+ return null;
+ }
+
+ OvsdbBridge ovsdbBridge = new OvsdbBridge(new OvsdbBridgeName(bridgeName),
+ new OvsdbDatapathId(datapathId));
+ return ovsdbBridge;
+ }
+
+ //Gets ofPort in the interface.
+ private long getOfPort(Interface intf) {
+ OvsdbSet ofPortSet = (OvsdbSet) intf.getOpenFlowPortColumn().data();
+ @SuppressWarnings("unchecked")
+ Set<Integer> ofPorts = ofPortSet.set();
+ while (ofPorts == null || ofPorts.size() <= 0) {
+ log.debug("The ofport is null in {}", intf.getName());
+ return -1;
+ }
+ // return (long) ofPorts.toArray()[0];
+ Iterator<Integer> it = ofPorts.iterator();
+ return Long.parseLong(it.next().toString());
+ }
+
+ @Override
+ public Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids) {
+ Set<OvsdbPort> ovsdbPorts = new HashSet<OvsdbPort>();
+ OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
+ if (tableStore == null) {
+ return null;
+ }
+ OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.INTERFACE);
+ if (rowStore == null) {
+ return null;
+ }
+ ConcurrentMap<String, Row> rows = rowStore.getRowStore();
+ for (String uuid : rows.keySet()) {
+ Row row = getRow(OvsdbConstant.DATABASENAME,
+ OvsdbConstant.INTERFACE, uuid);
+ DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
+ Interface intf = (Interface) TableGenerator
+ .getTable(dbSchema, row, OvsdbTable.INTERFACE);
+ if (intf == null || getIfaceid(intf) == null) {
+ continue;
+ }
+ String portName = intf.getName();
+ Set<String> ifaceidSet = Sets.newHashSet(ifaceids);
+ if (portName.startsWith("vxlan")
+ || !ifaceidSet.contains(getIfaceid(intf))) {
+ continue;
+ }
+ long ofPort = getOfPort(intf);
+ if ((ofPort < 0) || (portName == null)) {
+ continue;
+ }
+
+ OvsdbPort ovsdbPort = new OvsdbPort(new OvsdbPortNumber(ofPort),
+ new OvsdbPortName(portName));
+ if (ovsdbPort != null) {
+ ovsdbPorts.add(ovsdbPort);
+ }
+ }
+ return ovsdbPorts;
+ }
+
+ private String getIfaceid(Interface intf) {
+ OvsdbMap ovsdbMap = (OvsdbMap) intf.getExternalIdsColumn().data();
+ @SuppressWarnings("unchecked")
+ Map<String, String> externalIds = ovsdbMap.map();
+ if (externalIds.isEmpty()) {
+ log.warn("The external_ids is null");
+ return null;
+ }
+ String ifaceid = externalIds
+ .get(OvsdbConstant.EXTERNAL_ID_INTERFACE_ID);
+ if (ifaceid == null) {
+ log.warn("The ifaceid is null");
+ return null;
+ }
+ return ifaceid;
+ }
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbAgent.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbAgent.java
new file mode 100644
index 00000000..70ffae8b
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbAgent.java
@@ -0,0 +1,42 @@
+/*
+ * 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.controller.driver;
+
+import org.onosproject.ovsdb.controller.OvsdbNodeId;
+import org.onosproject.ovsdb.controller.OvsdbClientService;
+
+/**
+ * Responsible for keeping track of the current set of nodes connected to the
+ * system.
+ */
+public interface OvsdbAgent {
+ /**
+ * Add a node that has just connected to the system.
+ *
+ * @param nodeId the nodeId to add
+ * @param ovsdbClient the actual node object.
+ */
+ void addConnectedNode(OvsdbNodeId nodeId, OvsdbClientService ovsdbClient);
+
+ /**
+ * Clear all state in controller node maps for a node that has disconnected
+ * from the local controller. Also release control for that node from the
+ * global repository. Notify node listeners.
+ *
+ * @param nodeId the node id to be removed.
+ */
+ void removeConnectedNode(OvsdbNodeId nodeId);
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbProviderService.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbProviderService.java
new file mode 100644
index 00000000..48f58d02
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/OvsdbProviderService.java
@@ -0,0 +1,81 @@
+/*
+ * 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.controller.driver;
+
+import io.netty.channel.Channel;
+
+import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Represents the driver side of an ovsdb node. This interface should never be
+ * exposed to consumers.
+ */
+public interface OvsdbProviderService {
+ /**
+ * Sets the ovsdb agent to be used. This method can only be called once.
+ *
+ * @param agent the agent to set.
+ */
+ void setAgent(OvsdbAgent agent);
+
+ /**
+ * Sets the associated Netty channel for this node.
+ *
+ * @param channel the Netty channel
+ */
+ void setChannel(Channel channel);
+
+ /**
+ * Announces to the ovsdb agent that this node has added.
+ */
+ void nodeAdded();
+
+ /**
+ * Announces to the ovsdb agent that this node has removed.
+ */
+ void nodeRemoved();
+
+ /**
+ * Sets whether the node is connected.
+ *
+ * @param connected whether the node is connected
+ */
+ void setConnection(boolean connected);
+
+ /**
+ * Processes result from ovsdb.
+ *
+ * @param response JsonNode response from ovsdb
+ */
+ void processResult(JsonNode response);
+
+ /**
+ * processes request from ovsdb.
+ *
+ * @param request JsonNode request from ovsdb
+ */
+ void processRequest(JsonNode request);
+
+ /**
+ * Sets call back.
+ *
+ * @param monitorCallback the callback to set
+ */
+ void setCallback(Callback monitorCallback);
+
+}
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/package-info.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/package-info.java
new file mode 100644
index 00000000..b14afdfb
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/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 controller node driver API.
+ */
+package org.onosproject.ovsdb.controller.driver; \ No newline at end of file
diff --git a/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/package-info.java b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/package-info.java
new file mode 100644
index 00000000..d6fb434c
--- /dev/null
+++ b/framework/src/onos/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/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 controller API.
+ */
+package org.onosproject.ovsdb.controller; \ No newline at end of file
diff --git a/framework/src/onos/ovsdb/ctl/pom.xml b/framework/src/onos/ovsdb/ctl/pom.xml
new file mode 100644
index 00000000..60c1b439
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-ovsdb</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-ovsdb-ctl</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-ovsdb-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-ovsdb-rfc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/ChannelConnectionListener.java b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/ChannelConnectionListener.java
new file mode 100644
index 00000000..f17c25f7
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/ChannelConnectionListener.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.controller.impl;
+
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+
+import org.onosproject.ovsdb.controller.driver.OvsdbProviderService;
+
+/**
+ * The listener class. Handles when the node disconnect.
+ */
+public class ChannelConnectionListener implements ChannelFutureListener {
+
+ private final OvsdbProviderService providerService;
+
+ /**
+ * Constructor from a OvsdbProviderService providerService.
+ *
+ * @param providerService the providerService to use
+ */
+ public ChannelConnectionListener(OvsdbProviderService providerService) {
+ this.providerService = providerService;
+ }
+
+ @Override
+ public void operationComplete(ChannelFuture arg0) {
+ providerService.nodeRemoved();
+ }
+}
diff --git a/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/Controller.java b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/Controller.java
new file mode 100644
index 00000000..07582327
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/Controller.java
@@ -0,0 +1,201 @@
+/*
+ * 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.controller.impl;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.ServerChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.codec.string.StringEncoder;
+import io.netty.util.CharsetUtil;
+
+import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.ovsdb.controller.OvsdbConstant;
+import org.onosproject.ovsdb.controller.OvsdbNodeId;
+import org.onosproject.ovsdb.controller.driver.DefaultOvsdbClient;
+import org.onosproject.ovsdb.controller.driver.OvsdbAgent;
+import org.onosproject.ovsdb.controller.driver.OvsdbProviderService;
+import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The main controller class. Handles all setup and network listeners -
+ * Distributed ovsdbClient.
+ */
+public class Controller {
+ protected static final Logger log = LoggerFactory
+ .getLogger(Controller.class);
+
+ private int ovsdbPort = OvsdbConstant.OVSDBPORT;
+
+ private OvsdbAgent agent;
+ private Callback monitorCallback;
+
+ private final ExecutorService executorService = Executors
+ .newFixedThreadPool(10);
+
+ private EventLoopGroup bossGroup;
+ private EventLoopGroup workerGroup;
+ private Class<? extends ServerChannel> serverChannelClass;
+
+ /**
+ * Initialization.
+ */
+ private void initEventLoopGroup() {
+ bossGroup = new NioEventLoopGroup();
+ workerGroup = new NioEventLoopGroup();
+ serverChannelClass = NioServerSocketChannel.class;
+ }
+
+ /**
+ * Accepts incoming connections.
+ */
+ private void startAcceptingConnections() throws InterruptedException {
+ ServerBootstrap b = new ServerBootstrap();
+
+ b.group(bossGroup, workerGroup).channel(serverChannelClass)
+ .childHandler(new OnosCommunicationChannelInitializer());
+ b.option(ChannelOption.SO_BACKLOG, 128);
+ b.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 32 * 1024);
+ b.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 8 * 1024);
+ b.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
+ b.childOption(ChannelOption.SO_KEEPALIVE, true);
+ b.bind(ovsdbPort).sync();
+ }
+
+ /**
+ * Tells controller that we're ready to accept ovsdb node loop.
+ * @throws InterruptedException if thread is interrupted
+ */
+ public void run() throws InterruptedException {
+ initEventLoopGroup();
+ startAcceptingConnections();
+ }
+
+ /**
+ * Adds channel pipiline to handle a new connected node.
+ */
+ private class OnosCommunicationChannelInitializer
+ extends ChannelInitializer<SocketChannel> {
+ protected void initChannel(SocketChannel channel) throws Exception {
+ log.info("New channel created");
+ channel.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8));
+ channel.pipeline().addLast(new MessageDecoder());
+ handleNewNodeConnection(channel);
+
+ }
+ }
+
+ /**
+ * Handles the new connection of a node.
+ *
+ * @param channel the channel to use.
+ */
+ private void handleNewNodeConnection(final Channel channel) {
+ executorService.execute(new Runnable() {
+ @Override
+ public void run() {
+ log.info("Handle new node connection");
+
+ IpAddress ipAddress = IpAddress
+ .valueOf(((InetSocketAddress) channel.remoteAddress())
+ .getAddress().getHostAddress());
+ long port = ((InetSocketAddress) channel.remoteAddress())
+ .getPort();
+
+ log.info("Get connection from ip address {} : {}",
+ ipAddress.toString(), port);
+
+ OvsdbNodeId nodeId = new OvsdbNodeId(ipAddress, port);
+ OvsdbProviderService ovsdbProviderService = getNodeInstance(nodeId,
+ agent,
+ monitorCallback,
+ channel);
+ ovsdbProviderService.setConnection(true);
+ OvsdbJsonRpcHandler ovsdbJsonRpcHandler = new OvsdbJsonRpcHandler(
+ nodeId);
+ ovsdbJsonRpcHandler
+ .setOvsdbProviderService(ovsdbProviderService);
+ channel.pipeline().addLast(ovsdbJsonRpcHandler);
+
+ ovsdbProviderService.nodeAdded();
+ ChannelFuture closeFuture = channel.closeFuture();
+ closeFuture
+ .addListener(new ChannelConnectionListener(
+ ovsdbProviderService));
+ }
+ });
+ }
+
+ /**
+ * Gets an ovsdb client instance.
+ *
+ * @param nodeId data ovsdb node id
+ * @param agent OvsdbAgent
+ * @param monitorCallback Callback
+ * @param channel Channel
+ * @return OvsdbProviderService instance
+ */
+ protected OvsdbProviderService getNodeInstance(OvsdbNodeId nodeId,
+ OvsdbAgent agent,
+ Callback monitorCallback,
+ Channel channel) {
+ OvsdbProviderService ovsdbProviderService = new DefaultOvsdbClient(
+ nodeId);
+ ovsdbProviderService.setAgent(agent);
+ ovsdbProviderService.setCallback(monitorCallback);
+ ovsdbProviderService.setChannel(channel);
+ return ovsdbProviderService;
+ }
+
+ /**
+ * Starts controller.
+ *
+ * @param agent OvsdbAgent
+ * @param monitorCallback Callback
+ */
+ public void start(OvsdbAgent agent, Callback monitorCallback) {
+ this.agent = agent;
+ this.monitorCallback = monitorCallback;
+ try {
+ this.run();
+ } catch (InterruptedException e) {
+ log.warn("Interrupted while waiting to start");
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ /**
+ * Stops controller.
+ *
+ */
+ public void stop() {
+ workerGroup.shutdownGracefully();
+ bossGroup.shutdownGracefully();
+ }
+}
diff --git a/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/MessageDecoder.java b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/MessageDecoder.java
new file mode 100644
index 00000000..e0e22753
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/MessageDecoder.java
@@ -0,0 +1,55 @@
+/*
+ * 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.controller.impl;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.jsonrpc.JsonReadContext;
+import org.onosproject.ovsdb.rfc.utils.JsonRpcReaderUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Decoder for inbound messages.
+ */
+public class MessageDecoder extends ByteToMessageDecoder {
+
+ private final Logger log = LoggerFactory.getLogger(MessageDecoder.class);
+ private final JsonReadContext context = new JsonReadContext();
+
+ /**
+ * Default constructor.
+ */
+ public MessageDecoder() {
+ }
+
+ @Override
+ protected void decode(ChannelHandlerContext ctx, ByteBuf buf,
+ List<Object> out) throws Exception {
+ log.debug("Message decoder");
+ JsonRpcReaderUtil.readToJsonNode(buf, out, context);
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext context, Throwable cause) {
+ log.error("Exception inside channel handling pipeline.", cause);
+ context.close();
+ }
+}
diff --git a/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java
new file mode 100644
index 00000000..9b482968
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbControllerImpl.java
@@ -0,0 +1,413 @@
+/*
+ * 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.controller.impl;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.math.BigInteger;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.ExecutionException;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.ovsdb.controller.DefaultEventSubject;
+import org.onosproject.ovsdb.controller.EventSubject;
+import org.onosproject.ovsdb.controller.OvsdbClientService;
+import org.onosproject.ovsdb.controller.OvsdbConstant;
+import org.onosproject.ovsdb.controller.OvsdbController;
+import org.onosproject.ovsdb.controller.OvsdbDatapathId;
+import org.onosproject.ovsdb.controller.OvsdbEvent;
+import org.onosproject.ovsdb.controller.OvsdbEvent.Type;
+import org.onosproject.ovsdb.controller.OvsdbEventListener;
+import org.onosproject.ovsdb.controller.OvsdbIfaceId;
+import org.onosproject.ovsdb.controller.OvsdbNodeId;
+import org.onosproject.ovsdb.controller.OvsdbNodeListener;
+import org.onosproject.ovsdb.controller.OvsdbPortName;
+import org.onosproject.ovsdb.controller.OvsdbPortNumber;
+import org.onosproject.ovsdb.controller.OvsdbPortType;
+import org.onosproject.ovsdb.controller.driver.OvsdbAgent;
+import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
+import org.onosproject.ovsdb.rfc.message.TableUpdate;
+import org.onosproject.ovsdb.rfc.message.TableUpdates;
+import org.onosproject.ovsdb.rfc.message.UpdateNotification;
+import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
+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.table.Bridge;
+import org.onosproject.ovsdb.rfc.table.Interface;
+import org.onosproject.ovsdb.rfc.table.OvsdbTable;
+import org.onosproject.ovsdb.rfc.table.TableGenerator;
+import org.onosproject.ovsdb.rfc.utils.FromJsonUtil;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * The implementation of OvsdbController.
+ */
+@Component(immediate = true)
+@Service
+public class OvsdbControllerImpl implements OvsdbController {
+
+ public static final Logger log = LoggerFactory
+ .getLogger(OvsdbControllerImpl.class);
+
+ protected ConcurrentHashMap<OvsdbNodeId, OvsdbClientService> ovsdbClients =
+ new ConcurrentHashMap<OvsdbNodeId, OvsdbClientService>();
+
+ protected OvsdbAgent agent = new InternalOvsdbNodeAgent();
+ protected InternalMonitorCallBack updateCallback = new InternalMonitorCallBack();
+
+ protected Set<OvsdbNodeListener> ovsdbNodeListener = new CopyOnWriteArraySet<>();
+ protected Set<OvsdbEventListener> ovsdbEventListener = new CopyOnWriteArraySet<>();
+
+ protected ConcurrentHashMap<String, OvsdbClientService> requestNotification =
+ new ConcurrentHashMap<String, OvsdbClientService>();
+
+ protected ConcurrentHashMap<String, String> requestDbName = new ConcurrentHashMap<String, String>();
+
+ private final Controller controller = new Controller();
+
+ @Activate
+ public void activate(ComponentContext context) {
+ controller.start(agent, updateCallback);
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ controller.stop();
+ log.info("Stoped");
+ }
+
+ @Override
+ public void addNodeListener(OvsdbNodeListener listener) {
+ if (!ovsdbNodeListener.contains(listener)) {
+ this.ovsdbNodeListener.add(listener);
+ }
+ }
+
+ @Override
+ public void removeNodeListener(OvsdbNodeListener listener) {
+ this.ovsdbNodeListener.remove(listener);
+ }
+
+ @Override
+ public void addOvsdbEventListener(OvsdbEventListener listener) {
+ if (!ovsdbEventListener.contains(listener)) {
+ this.ovsdbEventListener.add(listener);
+ }
+ }
+
+ @Override
+ public void removeOvsdbEventListener(OvsdbEventListener listener) {
+ this.ovsdbEventListener.remove(listener);
+ }
+
+ @Override
+ public List<OvsdbNodeId> getNodeIds() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public OvsdbClientService getOvsdbClient(OvsdbNodeId nodeId) {
+ return ovsdbClients.get(nodeId);
+ }
+
+ /**
+ * Implementation of an Ovsdb Agent which is responsible for keeping track
+ * of connected node and the state in which they are.
+ */
+ private class InternalOvsdbNodeAgent implements OvsdbAgent {
+ @Override
+ public void addConnectedNode(OvsdbNodeId nodeId,
+ OvsdbClientService ovsdbClient) {
+
+ if (ovsdbClients.get(nodeId) != null) {
+ return;
+ } else {
+ ovsdbClients.put(nodeId, ovsdbClient);
+
+ try {
+ List<String> dbNames = ovsdbClient.listDbs().get();
+ for (String dbName : dbNames) {
+ DatabaseSchema dbSchema;
+ dbSchema = ovsdbClient.getOvsdbSchema(dbName).get();
+
+ log.debug("Begin to monitor tables");
+ String id = java.util.UUID.randomUUID().toString();
+ TableUpdates updates = ovsdbClient
+ .monitorTables(dbName, id).get();
+
+ requestDbName.put(id, dbName);
+ requestNotification.put(id, ovsdbClient);
+
+ if (updates != null) {
+ processTableUpdates(ovsdbClient, updates,
+ dbSchema.name());
+ }
+ }
+ } catch (InterruptedException e) {
+ log.warn("Interrupted while waiting to get message from ovsdb");
+ Thread.currentThread().interrupt();
+ } catch (ExecutionException e) {
+ log.error("Exception thrown while to get message from ovsdb");
+ }
+
+ log.debug("Add node to north");
+ for (OvsdbNodeListener l : ovsdbNodeListener) {
+ l.nodeAdded(nodeId);
+ }
+ return;
+ }
+ }
+
+ @Override
+ public void removeConnectedNode(OvsdbNodeId nodeId) {
+ ovsdbClients.remove(nodeId);
+ log.debug("Node connection is removed");
+ for (OvsdbNodeListener l : ovsdbNodeListener) {
+ l.nodeRemoved(nodeId);
+ }
+ }
+ }
+
+ /**
+ * Processes table updates.
+ *
+ * @param clientService OvsdbClientService instance
+ * @param updates TableUpdates instance
+ * @param dbName ovsdb database name
+ */
+ private void processTableUpdates(OvsdbClientService clientService,
+ TableUpdates updates, String dbName)
+ throws InterruptedException {
+ checkNotNull(clientService, "OvsdbClientService is not null");
+
+ DatabaseSchema dbSchema = clientService.getDatabaseSchema(dbName);
+
+ for (String tableName : updates.result().keySet()) {
+ TableUpdate update = updates.result().get(tableName);
+ for (UUID uuid : (Set<UUID>) update.rows().keySet()) {
+ log.debug("Begin to process table updates uuid: {}, databaseName: {}, tableName: {}",
+ uuid.value(), dbName, tableName);
+
+ Row newRow = update.getNew(uuid);
+ if (newRow != null) {
+ clientService.updateOvsdbStore(dbName, tableName,
+ uuid.value(), newRow);
+
+ if (OvsdbConstant.INTERFACE.equals(tableName)) {
+ dispatchInterfaceEvent(clientService,
+ newRow,
+ OvsdbEvent.Type.PORT_ADDED,
+ dbSchema);
+ }
+ } else if (update.getOld(uuid) != null) {
+ if (OvsdbConstant.INTERFACE.equals(tableName)) {
+ Row row = clientService.getRow(OvsdbConstant.DATABASENAME, tableName, uuid.value());
+ dispatchInterfaceEvent(clientService,
+ row,
+ OvsdbEvent.Type.PORT_REMOVED,
+ dbSchema);
+ }
+ clientService.removeRow(dbName, tableName, uuid.value());
+ }
+ }
+ }
+ }
+
+ /**
+ * Dispatches event to the north.
+ *
+ * @param clientService OvsdbClientService instance
+ * @param newRow a new row
+ * @param oldRow an old row
+ * @param eventType type of event
+ * @param dbSchema ovsdb database schema
+ */
+ private void dispatchInterfaceEvent(OvsdbClientService clientService,
+ Row row,
+ Type eventType,
+ DatabaseSchema dbSchema) {
+
+ long dpid = getDataPathid(clientService, dbSchema);
+ Interface intf = (Interface) TableGenerator
+ .getTable(dbSchema, row, OvsdbTable.INTERFACE);
+ if (intf == null) {
+ return;
+ }
+
+ String portType = (String) intf.getTypeColumn().data();
+ long localPort = getOfPort(intf);
+ if (localPort < 0) {
+ return;
+ }
+ String[] macAndIfaceId = getMacAndIfaceid(intf);
+ if (macAndIfaceId == null) {
+ return;
+ }
+
+ EventSubject eventSubject = new DefaultEventSubject(MacAddress.valueOf(
+ macAndIfaceId[0]),
+ new HashSet<IpAddress>(),
+ new OvsdbPortName(intf
+ .getName()),
+ new OvsdbPortNumber(localPort),
+ new OvsdbDatapathId(Long
+ .toString(dpid)),
+ new OvsdbPortType(portType),
+ new OvsdbIfaceId(macAndIfaceId[1]));
+ for (OvsdbEventListener listener : ovsdbEventListener) {
+ listener.handle(new OvsdbEvent<EventSubject>(eventType,
+ eventSubject));
+ }
+ }
+
+ /**
+ * Gets mac and iface from the table Interface.
+ *
+ * @param intf Interface instance
+ * @return attachedMac, ifaceid
+ */
+ private String[] getMacAndIfaceid(Interface intf) {
+ OvsdbMap ovsdbMap = (OvsdbMap) intf.getExternalIdsColumn().data();
+ @SuppressWarnings("unchecked")
+ Map<String, String> externalIds = ovsdbMap.map();
+ if (externalIds == null) {
+ log.warn("The external_ids is null");
+ return null;
+ }
+
+ String attachedMac = externalIds.get(OvsdbConstant.EXTERNAL_ID_VM_MAC);
+ if (attachedMac == null) {
+ log.warn("The attachedMac is null");
+ return null;
+ }
+ String ifaceid = externalIds
+ .get(OvsdbConstant.EXTERNAL_ID_INTERFACE_ID);
+ if (ifaceid == null) {
+ log.warn("The ifaceid is null");
+ return null;
+ }
+ return new String[] {attachedMac, ifaceid};
+ }
+
+ /**
+ * Gets ofPorts number from table Interface.
+ *
+ * @param intf Interface instance
+ * @return ofport the ofport number
+ */
+ private long getOfPort(Interface intf) {
+ OvsdbSet ofPortSet = (OvsdbSet) intf.getOpenFlowPortColumn().data();
+ @SuppressWarnings("unchecked")
+ Set<Integer> ofPorts = ofPortSet.set();
+ while (ofPorts == null || ofPorts.size() <= 0) {
+ log.debug("The ofport is null in {}", intf.getName());
+ return -1;
+ }
+ Iterator<Integer> it = ofPorts.iterator();
+ return Long.parseLong(it.next().toString());
+ }
+
+ /**
+ * Gets datapathid from table bridge.
+ *
+ * @param clientService OvsdbClientService instance
+ * @param dbSchema ovsdb database schema
+ * @return datapathid the bridge datapathid
+ */
+ private long getDataPathid(OvsdbClientService clientService,
+ DatabaseSchema dbSchema) {
+ String bridgeUuid = clientService
+ .getBridgeUuid(OvsdbConstant.INTEGRATION_BRIDGE);
+ if (bridgeUuid == null) {
+ log.debug("Unable to spot bridge uuid for {} in {}",
+ OvsdbConstant.INTEGRATION_BRIDGE, clientService);
+ return 0;
+ }
+
+ Row bridgeRow = clientService.getRow(OvsdbConstant.DATABASENAME,
+ "Bridge", bridgeUuid);
+ Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow,
+ OvsdbTable.BRIDGE);
+ OvsdbSet dpidSet = (OvsdbSet) bridge.getDatapathIdColumn().data();
+ @SuppressWarnings("unchecked")
+ Set<String> dpids = dpidSet.set();
+ if (dpids == null || dpids.size() == 0) {
+ return 0;
+ }
+ return stringToLong((String) dpids.toArray()[0]);
+ }
+
+ private long stringToLong(String values) {
+ long value = (new BigInteger(values.replaceAll(":", ""), 16))
+ .longValue();
+ return value;
+ }
+
+ /**
+ * Implementation of an Callback which is responsible for receiving request
+ * infomation from ovsdb.
+ */
+ private class InternalMonitorCallBack implements Callback {
+ @Override
+ public void update(UpdateNotification updateNotification) {
+ Object key = updateNotification.jsonValue();
+ OvsdbClientService ovsdbClient = requestNotification.get(key);
+
+ String dbName = requestDbName.get(key);
+ JsonNode updatesJson = updateNotification.tbUpdatesJsonNode();
+ DatabaseSchema dbSchema = ovsdbClient.getDatabaseSchema(dbName);
+ TableUpdates updates = FromJsonUtil
+ .jsonNodeToTableUpdates(updatesJson, dbSchema);
+ try {
+ processTableUpdates(ovsdbClient, updates, dbName);
+ } catch (InterruptedException e) {
+ log.warn("Interrupted while processing table updates");
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ @Override
+ public void locked(List<String> ids) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void stolen(List<String> ids) {
+ // TODO Auto-generated method stub
+ }
+
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbJsonRpcHandler.java b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbJsonRpcHandler.java
new file mode 100644
index 00000000..37942c24
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/OvsdbJsonRpcHandler.java
@@ -0,0 +1,131 @@
+/*
+ * 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.controller.impl;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+
+import org.onosproject.ovsdb.controller.OvsdbNodeId;
+import org.onosproject.ovsdb.controller.driver.OvsdbProviderService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Strings;
+
+/**
+ * Channel handler deals with the node connection and dispatches
+ * ovsdb messages to the appropriate locations.
+ */
+public final class OvsdbJsonRpcHandler extends ChannelInboundHandlerAdapter {
+ protected static final Logger log = LoggerFactory
+ .getLogger(OvsdbJsonRpcHandler.class);
+ private OvsdbNodeId ovsdbNodeId;
+ private OvsdbProviderService ovsdbProviderService;
+
+ /**
+ * Constructor from a OvsdbNodeId ovsdbNodeId.
+ *
+ * @param ovsdbNodeId the ovsdbNodeId to use
+ */
+ public OvsdbJsonRpcHandler(OvsdbNodeId ovsdbNodeId) {
+ super();
+ this.ovsdbNodeId = ovsdbNodeId;
+ }
+
+ /**
+ * Gets the ovsdbProviderService instance.
+ *
+ * @return the instance of the ovsdbProviderService
+ */
+ public OvsdbProviderService getOvsdbProviderService() {
+ return ovsdbProviderService;
+ }
+
+ /**
+ * Sets the ovsdbProviderService instance.
+ *
+ * @param ovsdbNodeDriver the ovsdbNodeDriver to use
+ */
+ public void setOvsdbProviderService(OvsdbProviderService ovsdbNodeDriver) {
+ this.ovsdbProviderService = ovsdbNodeDriver;
+ }
+
+ /**
+ * Gets the OvsdbNodeId instance.
+ *
+ * @return the instance of the OvsdbNodeId
+ */
+ public OvsdbNodeId getNodeId() {
+ return ovsdbNodeId;
+ }
+
+ /**
+ * Sets the ovsdb node id.
+ *
+ * @param ovsdbNodeId the ovsdbNodeId to use
+ */
+ public void setNodeId(OvsdbNodeId ovsdbNodeId) {
+ this.ovsdbNodeId = ovsdbNodeId;
+ }
+
+ /**
+ * Processes an JsonNode message received on the channel.
+ *
+ * @param jsonNode The OvsdbJsonRpcHandler that received the message
+ */
+ private void processOvsdbMessage(JsonNode jsonNode) {
+
+ log.info("Handle ovsdb message");
+
+ if (jsonNode.has("result")) {
+
+ log.debug("Handle ovsdb result");
+ ovsdbProviderService.processResult(jsonNode);
+
+ } else if (jsonNode.hasNonNull("method")) {
+
+ log.debug("Handle ovsdb request");
+ if (jsonNode.has("id")
+ && !Strings.isNullOrEmpty(jsonNode.get("id").asText())) {
+ ovsdbProviderService.processRequest(jsonNode);
+ }
+
+ }
+ return;
+ }
+
+ @Override
+ public void channelRead(ChannelHandlerContext ctx, Object msg)
+ throws Exception {
+ log.debug("Receive message from ovsdb");
+ if (msg instanceof JsonNode) {
+ JsonNode jsonNode = (JsonNode) msg;
+ processOvsdbMessage(jsonNode);
+ }
+ }
+
+ @Override
+ public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
+ ctx.flush();
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext context, Throwable cause) {
+ log.error("Exception inside channel handling pipeline.", cause);
+ context.close();
+ }
+}
diff --git a/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/package-info.java b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/package-info.java
new file mode 100644
index 00000000..379e947a
--- /dev/null
+++ b/framework/src/onos/ovsdb/ctl/src/main/java/org/onosproject/ovsdb/controller/impl/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.
+ */
+
+/**
+ * Implementation of the OVSDB controller IO subsystem.
+ */
+package org.onosproject.ovsdb.controller.impl; \ No newline at end of file
diff --git a/framework/src/onos/ovsdb/pom.xml b/framework/src/onos/ovsdb/pom.xml
new file mode 100644
index 00000000..e7a7ffcc
--- /dev/null
+++ b/framework/src/onos/ovsdb/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>onos-ovsdb</artifactId>
+ <name>onos-ovsdb</name>
+ <packaging>pom</packaging>
+
+ <description>ONOS OVSDB southbound plugin</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-handler</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <modules>
+ <module>api</module>
+ <module>rfc</module>
+ <module>ctl</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/framework/src/onos/ovsdb/rfc/pom.xml b/framework/src/onos/ovsdb/rfc/pom.xml
new file mode 100644
index 00000000..856ddf07
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ~ Copyright 2014 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-ovsdb</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>onos-ovsdb-rfc</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/AbnormalJsonNodeException.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/AbnormalJsonNodeException.java
new file mode 100644
index 00000000..d6c3357e
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/AbnormalJsonNodeException.java
@@ -0,0 +1,41 @@
+/*
+ * 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.exception;
+
+/**
+ * AbnormalJsonNodeException exception is thrown when the received JsonNode is invalid.
+ */
+public class AbnormalJsonNodeException extends RuntimeException {
+ private static final long serialVersionUID = 8328377718334680368L;
+
+ /**
+ * Constructs a AbnormalJsonNodeException object.
+ * @param message error message
+ */
+ public AbnormalJsonNodeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a AbnormalJsonNodeException object.
+ * @param message error message
+ * @param cause Throwable
+ */
+ public AbnormalJsonNodeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/ColumnSchemaNotFoundException.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/ColumnSchemaNotFoundException.java
new file mode 100644
index 00000000..6fa0580f
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/ColumnSchemaNotFoundException.java
@@ -0,0 +1,55 @@
+/*
+ * 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.exception;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * This exception is thrown when a ColumnSchema cannot be found.
+ */
+public class ColumnSchemaNotFoundException extends RuntimeException {
+ private static final long serialVersionUID = -4325190659387339524L;
+
+ /**
+ * Constructs a ColumnSchemaNotFoundException object.
+ * @param message error message
+ */
+ public ColumnSchemaNotFoundException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a ColumnSchemaNotFoundException object.
+ * @param message error message
+ * @param cause Throwable
+ */
+ public ColumnSchemaNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create error message.
+ * @param columnName column name
+ * @param tableName table name
+ * @return message
+ */
+ public static String createMessage(String columnName, String tableName) {
+ String message = toStringHelper("ColumnSchemaNotFoundException")
+ .addValue("Could not find ColumnSchema for " + columnName
+ + " in " + tableName).toString();
+ return message;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/TableSchemaNotFoundException.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/TableSchemaNotFoundException.java
new file mode 100644
index 00000000..423cabb0
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/TableSchemaNotFoundException.java
@@ -0,0 +1,56 @@
+/*
+ * 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.exception;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * This exception is thrown when a TableSchema cannot be found.
+ */
+public class TableSchemaNotFoundException extends RuntimeException {
+ private static final long serialVersionUID = 8431894450061740838L;
+
+ /**
+ * Constructs a TableSchemaNotFoundException object.
+ * @param message error message
+ */
+ public TableSchemaNotFoundException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a TableSchemaNotFoundException object.
+ * @param message error message
+ * @param cause Throwable
+ */
+ public TableSchemaNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create error message.
+ * @param tableName table name
+ * @param schemaName database name
+ * @return message
+ */
+ public static String createMessage(String tableName, String schemaName) {
+ String message = toStringHelper("TableSchemaNotFoundException")
+ .addValue("Can not find TableSchema for " + tableName + " in "
+ + schemaName).toString();
+ return message;
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/UnsupportedException.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/UnsupportedException.java
new file mode 100644
index 00000000..2c44ad37
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/UnsupportedException.java
@@ -0,0 +1,41 @@
+/*
+ * 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.exception;
+
+/**
+ * This exception is thrown when the caller invoke the unsupported method or
+ * use the encoding is not supported.
+ */
+public class UnsupportedException extends RuntimeException {
+ private static final long serialVersionUID = 1377011546616825375L;
+
+ /**
+ * Constructs a UnsupportedException object.
+ * @param message error message
+ */
+ public UnsupportedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a UnsupportedException object.
+ * @param message error message
+ * @param cause Throwable
+ */
+ public UnsupportedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/VersionMismatchException.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/VersionMismatchException.java
new file mode 100644
index 00000000..ad54938e
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/exception/VersionMismatchException.java
@@ -0,0 +1,66 @@
+/*
+ * 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.exception;
+
+
+/**
+ * This exception is used when the a table or row is accessed though a typed
+ * interface and the version requirements are not met.
+ */
+public class VersionMismatchException extends RuntimeException {
+ private static final long serialVersionUID = -8439624321110133595L;
+
+ /**
+ * Constructs a VersionMismatchException object.
+ * @param message error message
+ */
+ public VersionMismatchException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a VersionMismatchException object.
+ * @param message error message
+ * @param cause Throwable
+ */
+ public VersionMismatchException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Create error message.
+ * @param actualVersion the actual version
+ * @param fromVersion the initial version
+ * @return message
+ */
+ public static String createFromMessage(String actualVersion, String fromVersion) {
+ String message = "The fromVersion should less than the actualVersion.\n fromVersion: "
+ + fromVersion + ".\n" + "actualVersion: " + actualVersion;
+ return message;
+ }
+
+ /**
+ * Create error message.
+ * @param actualVersion the actual version
+ * @param toVersion the end version
+ * @return message
+ */
+ public static String createToMessage(String actualVersion, String toVersion) {
+ String message = "The toVersion should greater than the actualVersion.\n"
+ + "toVersion: " + toVersion + ".\n" + " actualVersion: " + actualVersion;
+ return message;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/Callback.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/Callback.java
new file mode 100644
index 00000000..f7ec8b67
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/Callback.java
@@ -0,0 +1,50 @@
+/*
+ * 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.jsonrpc;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.message.UpdateNotification;
+
+/**
+ * The callback function interface will be used when the server send to the
+ * client report changes.
+ */
+public interface Callback {
+ /**
+ * The "update" notification is sent by the server to the client to report
+ * changes in tables that are being monitored following a "*monitor"
+ * request.
+ * @param updateNotification the information of the update
+ */
+ void update(UpdateNotification updateNotification);
+
+ /**
+ * The "locked" notification is provided to notify a client that it has been
+ * granted a lock that it had previously requested with the "lock" method.
+ * @param ids the locked ids
+ */
+ void locked(List<String> ids);
+
+ /**
+ * The "stolen" notification is provided to notify a client, which had
+ * previously obtained a lock, that another client has stolen ownership of
+ * that lock.
+ * @param ids the stolen ids
+ */
+ void stolen(List<String> ids);
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonReadContext.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonReadContext.java
new file mode 100644
index 00000000..8033f653
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonReadContext.java
@@ -0,0 +1,86 @@
+/*
+ * 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.jsonrpc;
+
+import java.util.Stack;
+
+/**
+ * Context for decode parameters.
+ */
+public class JsonReadContext {
+ private Stack<Byte> bufStack;
+ private boolean isStartMatch;
+ private int lastReadBytes;
+
+ /**
+ * Constructs a JsonReadContext object. This class only need initial
+ * parameter value for the readToJsonNode method of JsonRpcReaderUtil
+ * entity.
+ */
+ public JsonReadContext() {
+ bufStack = new Stack<Byte>();
+ isStartMatch = false;
+ lastReadBytes = 0;
+ }
+
+ /**
+ * Return bufStack.
+ * @return bufStack
+ */
+ public Stack<Byte> getBufStack() {
+ return bufStack;
+ }
+
+ /**
+ * Set bufStack, used for match the braces and double quotes.
+ * @param bufStack Stack of Byte
+ */
+ public void setBufStack(Stack<Byte> bufStack) {
+ this.bufStack = bufStack;
+ }
+
+ /**
+ * Return isStartMatch.
+ * @return isStartMatch
+ */
+ public boolean isStartMatch() {
+ return isStartMatch;
+ }
+
+ /**
+ * Set isStartMatch.
+ * @param isStartMatch mark whether the matching has started
+ */
+ public void setStartMatch(boolean isStartMatch) {
+ this.isStartMatch = isStartMatch;
+ }
+
+ /**
+ * Return lastReadBytes.
+ * @return lastReadBytes
+ */
+ public int getLastReadBytes() {
+ return lastReadBytes;
+ }
+
+ /**
+ * Set lastReadBytes.
+ * @param lastReadBytes the bytes for last decoding incomplete record
+ */
+ public void setLastReadBytes(int lastReadBytes) {
+ this.lastReadBytes = lastReadBytes;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcRequest.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcRequest.java
new file mode 100644
index 00000000..ecff096b
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcRequest.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.jsonrpc;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+import java.util.Objects;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Json Rpc Request information that include id,method,params.
+ */
+public class JsonRpcRequest {
+
+ private final String id;
+ private final String method;
+ private final List<Object> params;
+
+ /**
+ * JsonRpcRequest Constructor.
+ * @param id the id node of request information
+ * @param method the method node of request information
+ */
+ public JsonRpcRequest(String id, String method) {
+ checkNotNull(id, "id cannot be null");
+ checkNotNull(method, "method cannot be null");
+ this.id = id;
+ this.method = method;
+ this.params = Lists.newArrayList();
+ }
+
+ /**
+ * JsonRpcRequest Constructor.
+ * @param id the id node of request information
+ * @param method the method node of request information
+ * @param params the params node of request information
+ */
+ public JsonRpcRequest(String id, String method, List<Object> params) {
+ checkNotNull(id, "id cannot be null");
+ checkNotNull(method, "method cannot be null");
+ checkNotNull(params, "params cannot be null");
+ this.id = id;
+ this.method = method;
+ this.params = params;
+ }
+
+ /**
+ * Returns id.
+ * @return id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns method.
+ * @return method
+ */
+ public String getMethod() {
+ return method;
+ }
+
+ /**
+ * Returns params.
+ * @return params
+ */
+ public List<Object> getParams() {
+ return params;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, method, params);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof JsonRpcRequest) {
+ final JsonRpcRequest other = (JsonRpcRequest) obj;
+ return Objects.equals(this.id, other.id)
+ && Objects.equals(this.method, other.method)
+ && Objects.equals(this.params, other.params);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("id", id).add("method", method)
+ .add("params", params).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcResponse.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcResponse.java
new file mode 100644
index 00000000..a2f45414
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/JsonRpcResponse.java
@@ -0,0 +1,122 @@
+/*
+ * 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.jsonrpc;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+import java.util.Objects;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Json Rpc Response information that include id,error,result.
+ */
+public class JsonRpcResponse {
+
+ private final String id;
+ private final String error;
+ private final List<Object> result;
+
+ /**
+ * JsonRpcResponse Constructor.
+ * @param id the id node of response information
+ */
+ public JsonRpcResponse(String id) {
+ checkNotNull(id, "id cannot be null");
+ this.id = id;
+ this.error = null;
+ this.result = Lists.newArrayList();
+ }
+
+ /**
+ * JsonRpcResponse Constructor.
+ * @param id the id node of response information
+ * @param error the error node of response information
+ */
+ public JsonRpcResponse(String id, String error) {
+ checkNotNull(id, "id cannot be null");
+ checkNotNull(error, "error cannot be null");
+ this.id = id;
+ this.error = error;
+ this.result = Lists.newArrayList();
+ }
+
+ /**
+ * JsonRpcResponse Constructor.
+ * @param id the id node of response information
+ * @param error the error node of response information
+ * @param result the result node of response information
+ */
+ public JsonRpcResponse(String id, String error, List<Object> result) {
+ checkNotNull(id, "id cannot be null");
+ checkNotNull(error, "error cannot be null");
+ checkNotNull(result, "result cannot be null");
+ this.id = id;
+ this.error = error;
+ this.result = result;
+ }
+
+ /**
+ * Returns id.
+ * @return id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns error.
+ * @return error
+ */
+ public String getError() {
+ return error;
+ }
+
+ /**
+ * Returns result.
+ * @return result
+ */
+ public List<Object> getResult() {
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, error, result);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof JsonRpcResponse) {
+ final JsonRpcResponse other = (JsonRpcResponse) obj;
+ return Objects.equals(this.id, other.id)
+ && Objects.equals(this.error, other.error)
+ && Objects.equals(this.result, other.result);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("id", id).add("error", error)
+ .add("result", result).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/OvsdbRPC.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/OvsdbRPC.java
new file mode 100644
index 00000000..5d08b143
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/OvsdbRPC.java
@@ -0,0 +1,74 @@
+/*
+ * 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.jsonrpc;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.operations.Operation;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * The following interface describe the RPC7047's methods that are supported.
+ */
+public interface OvsdbRPC {
+
+ /**
+ * This operation retrieves a database-schema that describes hosted database
+ * db-name.
+ * @param dbnames database name
+ * @return ListenableFuture of JsonNode
+ */
+ ListenableFuture<JsonNode> getSchema(List<String> dbnames);
+
+ /**
+ * The "echo" method can be used by both clients and servers to verify the
+ * liveness of a database connection.
+ * @return return info
+ */
+ ListenableFuture<List<String>> echo();
+
+ /**
+ * The "monitor" request enables a client to replicate tables or subsets of
+ * tables within an OVSDB database by requesting notifications of changes to
+ * those tables and by receiving the complete initial state of a table or a
+ * subset of a table.
+ * @param dbSchema databse schema
+ * @param monitorId a id for monitor
+ * @return ListenableFuture of JsonNode
+ */
+ ListenableFuture<JsonNode> monitor(DatabaseSchema dbSchema, String monitorId);
+
+ /**
+ * This operation retrieves an array whose elements are the names of the
+ * databases that can be accessed over this management protocol connection.
+ * @return database names
+ */
+ ListenableFuture<List<String>> listDbs();
+
+ /**
+ * This RPC method causes the database server to execute a series of
+ * operations in the specified order on a given database.
+ * @param dbSchema database schema
+ * @param operations the operations to execute
+ * @return result the transact result
+ */
+ ListenableFuture<List<JsonNode>> transact(DatabaseSchema dbSchema,
+ List<Operation> operations);
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorRequest.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorRequest.java
new file mode 100644
index 00000000..e7f5eaee
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorRequest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.message;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+import java.util.Set;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+/**
+ * Monitor Requst information that need to monitor table.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public final class MonitorRequest {
+ @JsonIgnore
+ private final String tableName;
+ private final Set<String> columns;
+ private final MonitorSelect select;
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param tableName table name
+ * @param columns a set of column name
+ * @param select monitor action
+ */
+ public MonitorRequest(String tableName, Set<String> columns,
+ MonitorSelect select) {
+ checkNotNull(tableName, "table name cannot be null");
+ checkNotNull(columns, "columns cannot be null");
+ checkNotNull(select, "select cannot be null");
+ this.tableName = tableName;
+ this.columns = columns;
+ this.select = select;
+ }
+
+ /**
+ * Returns tableName.
+ * @return tableName
+ */
+ public String getTableName() {
+ return tableName;
+ }
+
+ /**
+ * Returns select.
+ * @return select
+ */
+ public MonitorSelect getSelect() {
+ return select;
+ }
+
+ /**
+ * Returns columns.
+ * @return columns
+ */
+ public Set<String> getColumns() {
+ return columns;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(tableName, select, columns);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof MonitorRequest) {
+ final MonitorRequest other = (MonitorRequest) obj;
+ return Objects.equals(this.tableName, other.tableName)
+ && Objects.equals(this.select, other.select)
+ && Objects.equals(this.columns, other.columns);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("tableName", tableName)
+ .add("select", select).add("columns", columns).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorSelect.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorSelect.java
new file mode 100644
index 00000000..502fc4de
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/MonitorSelect.java
@@ -0,0 +1,106 @@
+/*
+ * 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.message;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+/**
+ * The contents of this object specify how the columns or table are to be
+ * monitored.
+ */
+public final class MonitorSelect {
+
+ private final boolean initial;
+ private final boolean insert;
+ private final boolean delete;
+ private final boolean modify;
+
+ /**
+ * Constructs a MonitorSelect object.
+ * @param initial whether monitor the initial action
+ * @param insert whether monitor the insert action
+ * @param delete whether monitor the delete action
+ * @param modify whether monitor the modify action
+ */
+ public MonitorSelect(boolean initial, boolean insert, boolean delete,
+ boolean modify) {
+ this.initial = initial;
+ this.insert = insert;
+ this.delete = delete;
+ this.modify = modify;
+ }
+
+ /**
+ * Returns initial.
+ * @return initial
+ */
+ public boolean isInitial() {
+ return initial;
+ }
+
+ /**
+ * Returns insert.
+ * @return insert
+ */
+ public boolean isInsert() {
+ return insert;
+ }
+
+ /**
+ * Returns delete.
+ * @return delete
+ */
+ public boolean isDelete() {
+ return delete;
+ }
+
+ /**
+ * Returns modify.
+ * @return modify
+ */
+ public boolean isModify() {
+ return modify;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(initial, insert, delete, modify);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof MonitorSelect) {
+ final MonitorSelect other = (MonitorSelect) obj;
+ return Objects.equals(this.initial, other.initial)
+ && Objects.equals(this.insert, other.insert)
+ && Objects.equals(this.delete, other.delete)
+ && Objects.equals(this.modify, other.modify);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("initial", initial)
+ .add("insert", insert).add("delete", delete)
+ .add("modify", modify).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/OperationResult.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/OperationResult.java
new file mode 100644
index 00000000..99807355
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/OperationResult.java
@@ -0,0 +1,158 @@
+/*
+ * 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.message;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * All results of ovs table operations. refer to RFC7047 5.2.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public final class OperationResult {
+ private int count;
+ private UUID uuid;
+ private List<Row> rows;
+ private String error;
+ private String details;
+
+ /**
+ * Constructs a OperationResult object. When JsonNode is converted into
+ * OperationResult, need this constructor and also need setter method.
+ */
+ public OperationResult() {
+ }
+
+ /**
+ * Constructs a OperationResult object.
+ * @param rows List of Row entity
+ */
+ public OperationResult(List<Row> rows) {
+ checkNotNull(rows, "rows cannot be null");
+ this.rows = rows;
+ }
+
+ /**
+ * Constructs a OperationResult object.
+ * @param count the count node of result
+ * @param uuid UUID entity
+ * @param rows List of Row entity
+ * @param error error message
+ * @param details details of error message
+ */
+ public OperationResult(int count, UUID uuid, List<Row> rows, String error,
+ String details) {
+ checkNotNull(uuid, "uuid cannot be null");
+ checkNotNull(rows, "rows cannot be null");
+ checkNotNull(error, "error cannot be null");
+ checkNotNull(details, "details cannot be null");
+ this.count = count;
+ this.uuid = uuid;
+ this.rows = rows;
+ this.error = error;
+ this.details = details;
+ }
+
+ /**
+ * Return count.
+ * @return count
+ */
+ public int getCount() {
+ return count;
+ }
+
+ /**
+ * Set count value.
+ * @param count the Operation message of count
+ */
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ /**
+ * Return uuid.
+ * @return uuid
+ */
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Set uuid value.
+ * @param uuid the Operation message of uuid
+ */
+ public void setUuid(UUID uuid) {
+ checkNotNull(uuid, "uuid cannot be null");
+ this.uuid = uuid;
+ }
+
+ /**
+ * Return rows.
+ * @return List of Row
+ */
+ public List<Row> getRows() {
+ return rows;
+ }
+
+ /**
+ * Set rows value.
+ * @param rows the Operation message of rows
+ */
+ public void setRows(List<Row> rows) {
+ checkNotNull(rows, "rows cannot be null");
+ this.rows = rows;
+ }
+
+ /**
+ * Return error.
+ * @return error
+ */
+ public String getError() {
+ return error;
+ }
+
+ /**
+ * Set error value.
+ * @param error the Operation message of error
+ */
+ public void setError(String error) {
+ checkNotNull(error, "error cannot be null");
+ this.error = error;
+ }
+
+ /**
+ * Return details.
+ * @return details
+ */
+ public String getDetails() {
+ return details;
+ }
+
+ /**
+ * Set details value.
+ * @param details the Operation message of details
+ */
+ public void setDetails(String details) {
+ checkNotNull(details, "details cannot be null");
+ this.details = details;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/RowUpdate.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/RowUpdate.java
new file mode 100644
index 00000000..221206ef
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/RowUpdate.java
@@ -0,0 +1,97 @@
+/*
+ * 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.message;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+
+/**
+ * A TableUpdate is an object that maps from the row's UUID to a RowUpdate object.
+ * A RowUpdate is an object with the following members: "old": row, "new": row.
+ * Refer to RFC 7047 Section 4.1.6.
+ */
+public final class RowUpdate {
+ private final UUID uuid;
+ private final Row oldRow;
+ private final Row newRow;
+
+ /**
+ * Constructs a RowUpdate object.
+ * @param uuid UUID
+ * @param oldRow present for "delete" and "modify" updates
+ * @param newRow present for "initial", "insert", and "modify" updates
+ */
+ public RowUpdate(UUID uuid, Row oldRow, Row newRow) {
+ checkNotNull(uuid, "uuid cannot be null");
+ this.uuid = uuid;
+ this.oldRow = oldRow;
+ this.newRow = newRow;
+ }
+
+ /**
+ * Return uuid.
+ * @return uuid
+ */
+ public UUID uuid() {
+ return this.uuid;
+ }
+
+ /**
+ * Return oldRow.
+ * @return oldRow
+ */
+ public Row oldRow() {
+ return oldRow;
+ }
+
+ /**
+ * Return newRow.
+ * @return newRow
+ */
+ public Row newRow() {
+ return newRow;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(uuid, oldRow, newRow);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof RowUpdate) {
+ final RowUpdate other = (RowUpdate) obj;
+ return Objects.equals(this.uuid, other.uuid)
+ && Objects.equals(this.oldRow, other.oldRow)
+ && Objects.equals(this.newRow, other.newRow);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("uuid", uuid).add("oldRow", oldRow)
+ .add("newRow", newRow).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java
new file mode 100644
index 00000000..812a034c
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java
@@ -0,0 +1,107 @@
+/*
+ * 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.message;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+
+/**
+ * TableUpdate is an object that maps from the row's UUID to a RowUpdate object.
+ */
+public final class TableUpdate {
+
+ private final Map<UUID, RowUpdate> rows;
+
+ /**
+ * Constructs a TableUpdate object.
+ * @param rows the parameter of TableUpdate entity
+ */
+ private TableUpdate(Map<UUID, RowUpdate> rows) {
+ this.rows = rows;
+ }
+
+ /**
+ * Get TableUpdate entity.
+ * @param rows the parameter of TableUpdate entity
+ * @return TableUpdate entity
+ */
+ public static TableUpdate tableUpdate(Map<UUID, RowUpdate> rows) {
+ checkNotNull(rows, "rows cannot be null");
+ return new TableUpdate(rows);
+ }
+
+ /**
+ * Return old row.
+ * @param uuid the key of rows
+ * @return Row old row
+ */
+ public Row getOld(UUID uuid) {
+ RowUpdate rowUpdate = rows.get(uuid);
+ if (rowUpdate == null) {
+ return null;
+ }
+ return rowUpdate.oldRow();
+ }
+
+ /**
+ * Return new row.
+ * @param uuid the key of rows
+ * @return Row new row
+ */
+ public Row getNew(UUID uuid) {
+ RowUpdate rowUpdate = rows.get(uuid);
+ if (rowUpdate == null) {
+ return null;
+ }
+ return rowUpdate.newRow();
+ }
+
+ /**
+ * Return rows.
+ * @return rows
+ */
+ public Map<UUID, RowUpdate> rows() {
+ return rows;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(rows);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof TableUpdate) {
+ final TableUpdate other = (TableUpdate) obj;
+ return Objects.equals(this.rows, other.rows);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("rows", rows).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java
new file mode 100644
index 00000000..8938beea
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.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.message;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+/**
+ * TableUpdates is an object that maps from a table name to a TableUpdate.
+ */
+public final class TableUpdates {
+
+ private final Map<String, TableUpdate> result;
+
+ /**
+ * Constructs a TableUpdates object.
+ * @param result the parameter of TableUpdates entity
+ */
+ private TableUpdates(Map<String, TableUpdate> result) {
+ this.result = result;
+ }
+
+ /**
+ * Get TableUpdates.
+ * @param result the parameter of TableUpdates entity
+ * @return TableUpdates
+ */
+ public static TableUpdates tableUpdates(Map<String, TableUpdate> result) {
+ checkNotNull(result, "result cannot be null");
+ return new TableUpdates(result);
+ }
+
+ /**
+ * Return TableUpdate.
+ * @param table the TableSchema of TableUpdates
+ * @return TableUpdate
+ */
+ public TableUpdate tableUpdate(TableSchema table) {
+ return this.result.get(table.name());
+ }
+
+ /**
+ * Return the map of TableUpdate.
+ * @return result
+ */
+ public Map<String, TableUpdate> result() {
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(result);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof TableUpdates) {
+ final TableUpdates other = (TableUpdates) obj;
+ return Objects.equals(this.result, other.result);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("result", result).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/UpdateNotification.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/UpdateNotification.java
new file mode 100644
index 00000000..d4f0513d
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/UpdateNotification.java
@@ -0,0 +1,90 @@
+/*
+ * 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.message;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.json.UpdateNotificationConverter;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+/**
+ * The "update" notification is sent by the server to the client to report
+ * changes in tables that are being monitored following a "monitor" request. The
+ * "params" of the result JsonNode.
+ */
+@JsonDeserialize(converter = UpdateNotificationConverter.class)
+public final class UpdateNotification {
+ private final Object jsonValue;
+ private final JsonNode tbUpdatesJsonNode;
+
+ /**
+ * Constructs a UpdateNotification object.
+ * @param jsonValue the "json-value" in "params" of the result JsonNode
+ * @param tbUpdatesJsonNode the "table-updates" in "params" of the result JsonNode
+ */
+ public UpdateNotification(Object jsonValue, JsonNode tbUpdatesJsonNode) {
+ checkNotNull(jsonValue, "jsonValue cannot be null");
+ checkNotNull(tbUpdatesJsonNode, "tablebUpdates JsonNode cannot be null");
+ this.jsonValue = jsonValue;
+ this.tbUpdatesJsonNode = tbUpdatesJsonNode;
+ }
+
+ /**
+ * Return context.
+ * @return context
+ */
+ public Object jsonValue() {
+ return jsonValue;
+ }
+
+ /**
+ * Return tbUpdatesJsonNode.
+ * @return tbUpdatesJsonNode
+ */
+ public JsonNode tbUpdatesJsonNode() {
+ return tbUpdatesJsonNode;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(jsonValue, tbUpdatesJsonNode);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof UpdateNotification) {
+ final UpdateNotification other = (UpdateNotification) obj;
+ return Objects.equals(this.jsonValue, other.jsonValue)
+ && Objects.equals(this.tbUpdatesJsonNode,
+ other.tbUpdatesJsonNode);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("jsonValue", jsonValue)
+ .add("tbUpdatesJsonNode", tbUpdatesJsonNode).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java
new file mode 100644
index 00000000..60f49442
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Column.java
@@ -0,0 +1,81 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * Column is the basic element of the OpenVswitch database.
+ */
+public final class Column {
+ private final String columnName;
+ private final Object data;
+
+ /**
+ * Column constructor.
+ * @param columnName the column name
+ * @param obj the data of the column
+ */
+ public Column(String columnName, Object obj) {
+ checkNotNull(columnName, "columnName cannot be null");
+ checkNotNull(obj, "data cannot be null");
+ this.columnName = columnName;
+ this.data = obj;
+ }
+
+ /**
+ * Returns column data.
+ * @return column data
+ */
+ public Object data() {
+ return data;
+ }
+
+ /**
+ * Returns columnName.
+ * @return columnName
+ */
+ public String columnName() {
+ return columnName;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(columnName, data);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Column) {
+ final Column other = (Column) obj;
+ return Objects.equals(this.columnName, other.columnName)
+ && Objects.equals(this.data, other.data);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("columnName", columnName)
+ .add("data", data).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java
new file mode 100644
index 00000000..cbf35424
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Condition.java
@@ -0,0 +1,123 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.json.ConditionSerializer;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+/**
+ * Condition is a 3-element JSON array of the form [column, function, value]
+ * that represents a test on a column value.
+ */
+@JsonSerialize(using = ConditionSerializer.class)
+public final class Condition {
+ /**
+ * Function of Notation. Refer to RFC 7047 Section 5.1.
+ */
+ public enum Function {
+ LESS_THAN("<"), LESS_THAN_OR_EQUALS("<="), EQUALS("=="),
+ NOT_EQUALS("!="), GREATER_THAN(">"), GREATER_THAN_OR_EQUALS(">="),
+ INCLUDES("includes"), EXCLUDES("excludes");
+
+ private final String function;
+
+ private Function(String function) {
+ this.function = function;
+ }
+
+ /**
+ * Returns the function for Function.
+ * @return the function
+ */
+ public String function() {
+ return function;
+ }
+ }
+
+ private final String column;
+ private final Function function;
+ private final Object value;
+
+ /**
+ * Constructs a Condition object.
+ * @param column the column name
+ * @param function Function
+ * @param value column data
+ */
+ public Condition(String column, Function function, Object value) {
+ checkNotNull(column, "column cannot be null");
+ checkNotNull(function, "function cannot be null");
+ checkNotNull(value, "value cannot be null");
+ this.column = column;
+ this.function = function;
+ this.value = value;
+ }
+
+ /**
+ * Returns column name.
+ * @return column name
+ */
+ public String getColumn() {
+ return column;
+ }
+
+ /**
+ * Returns Function.
+ * @return Function
+ */
+ public Function getFunction() {
+ return function;
+ }
+
+ /**
+ * Returns column data.
+ * @return column data
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(column, function, value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Condition) {
+ final Condition other = (Condition) obj;
+ return Objects.equals(this.column, other.column)
+ && Objects.equals(this.function, other.function)
+ && Objects.equals(this.value, other.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("column", column)
+ .add("function", function).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java
new file mode 100644
index 00000000..5b5293c2
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Mutation.java
@@ -0,0 +1,124 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.json.MutationSerializer;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+/**
+ * Mutation is s 3-element JSON array of the form [column, mutator, value] that
+ * represents a change to a column value.
+ */
+@JsonSerialize(using = MutationSerializer.class)
+public final class Mutation {
+ /**
+ * Mutator must be "+=", "-=", "*=", "/=", or (integer only) "%=". The value
+ * of column is changed to the sum, difference, product, quotient, or
+ * remainder, respectively, of column and value.
+ */
+ public enum Mutator {
+ SUM("+="), DIFFERENCE("-="), PRODUCT("*="), QUOTIENT("/="),
+ REMAINDER("%="), INSERT("insert"), DELETE("delete");
+
+ private final String mutator;
+
+ private Mutator(String mutator) {
+ this.mutator = mutator;
+ }
+
+ /**
+ * Returns the mutator for Mutator.
+ * @return the mutator
+ */
+ public String mutator() {
+ return mutator;
+ }
+ }
+
+ private final String column;
+ private final Mutator mutator;
+ private final Object value;
+
+ /**
+ * Mutation constructor.
+ * @param column the column name
+ * @param mutator Mutator
+ * @param value column data
+ */
+ public Mutation(String column, Mutator mutator, Object value) {
+ checkNotNull(column, "column cannot be null");
+ checkNotNull(mutator, "mutator cannot be null");
+ checkNotNull(value, "value cannot be null");
+ this.column = column;
+ this.mutator = mutator;
+ this.value = value;
+ }
+
+ /**
+ * Returns column name.
+ * @return column name
+ */
+ public String getColumn() {
+ return column;
+ }
+
+ /**
+ * Returns Mutator.
+ * @return Mutator
+ */
+ public Mutator getMutator() {
+ return mutator;
+ }
+
+ /**
+ * Returns column data.
+ * @return column data
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(column, mutator, value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Mutation) {
+ final Mutation other = (Mutation) obj;
+ return Objects.equals(this.column, other.column)
+ && Objects.equals(this.mutator, other.mutator)
+ && Objects.equals(this.value, other.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("column", column)
+ .add("mutator", mutator).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java
new file mode 100644
index 00000000..fce3f69f
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java
@@ -0,0 +1,83 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.json.OvsdbMapSerializer;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+/**
+ * OvsdbMap is a 2-element JSON array that represents a database map value.
+ */
+@JsonSerialize(using = OvsdbMapSerializer.class)
+public final class OvsdbMap {
+
+ private final Map map;
+
+ /**
+ * OvsdbMap constructor.
+ * @param map java.util.Map
+ */
+ private OvsdbMap(Map map) {
+ checkNotNull(map, "map cannot be null");
+ this.map = map;
+ }
+
+ /**
+ * Returns map.
+ * @return map
+ */
+ public Map map() {
+ return map;
+ }
+
+ /**
+ * convert Map into OvsdbMap.
+ * @param map java.util.Map
+ * @return OvsdbMap
+ */
+ public static OvsdbMap ovsdbMap(Map map) {
+ return new OvsdbMap(map);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(map);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbMap) {
+ final OvsdbMap other = (OvsdbMap) obj;
+ return Objects.equals(this.map, other.map);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("map", map).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java
new file mode 100644
index 00000000..fa5abe83
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java
@@ -0,0 +1,85 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.json.OvsdbSetSerializer;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+/**
+ * OvsdbSet is either an atom, representing a set with exactly one element, or
+ * a 2-element JSON array that represents a database set value.
+ *
+ */
+@JsonSerialize(using = OvsdbSetSerializer.class)
+public final class OvsdbSet {
+
+ private final Set set;
+
+ /**
+ * OvsdbSet constructor.
+ * @param set java.util.Set
+ */
+ private OvsdbSet(Set set) {
+ checkNotNull(set, "set cannot be null");
+ this.set = set;
+ }
+
+ /**
+ * Returns set.
+ * @return set
+ */
+ public Set set() {
+ return set;
+ }
+
+ /**
+ * convert Set into OvsdbSet.
+ * @param set java.util.Set
+ * @return OvsdbSet
+ */
+ public static OvsdbSet ovsdbSet(Set set) {
+ return new OvsdbSet(set);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(set);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OvsdbSet) {
+ final OvsdbSet other = (OvsdbSet) obj;
+ return Objects.equals(this.set, other.set);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("set", set).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java
new file mode 100644
index 00000000..1b22a426
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/RefTableRow.java
@@ -0,0 +1,84 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * The RefTable type that can be expanded to Row. Refer to RFC 7047 Section 3.2.
+ */
+public final class RefTableRow {
+
+ private final String refTable;
+ private final JsonNode jsonNode;
+
+ /**
+ * RefTableRow constructor.
+ * @param refTable the refTable value of JsonNode
+ * @param jsonNode JsonNode
+ */
+ public RefTableRow(String refTable, JsonNode jsonNode) {
+ checkNotNull(refTable, "refTable cannot be null");
+ checkNotNull(jsonNode, "jsonNode cannot be null");
+ this.refTable = refTable;
+ this.jsonNode = jsonNode;
+ }
+
+ /**
+ * Returns JsonNode.
+ * @return JsonNode
+ */
+ public JsonNode jsonNode() {
+ return jsonNode;
+ }
+
+ /**
+ * Returns refTable.
+ * @return refTable
+ */
+ public String refTable() {
+ return refTable;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(refTable, jsonNode);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof RefTableRow) {
+ final RefTableRow other = (RefTableRow) obj;
+ return Objects.equals(this.refTable, other.refTable)
+ && Objects.equals(this.jsonNode, other.jsonNode);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("refTable", refTable)
+ .add("jsonNode", jsonNode).toString();
+ }
+}
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
new file mode 100644
index 00000000..33269223
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/Row.java
@@ -0,0 +1,128 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Objects;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Row is the basic element of the OpenVswitch's table.
+ */
+public final class Row {
+ private String tableName;
+ private Map<String, Column> columns;
+
+ /**
+ * Row constructor.
+ */
+ public Row() {
+ this.columns = Maps.newHashMap();
+ }
+
+ /**
+ * Row constructor.
+ * @param tableName table name
+ */
+ public Row(String tableName) {
+ checkNotNull(tableName, "tableName cannot be null");
+ this.tableName = tableName;
+ this.columns = Maps.newHashMap();
+ }
+
+ /**
+ * Row constructor.
+ * @param tableName table name
+ * @param columns Map of Column entity
+ */
+ public Row(String tableName, Map<String, Column> columns) {
+ checkNotNull(tableName, "table name cannot be null");
+ checkNotNull(columns, "columns cannot be null");
+ this.tableName = tableName;
+ this.columns = columns;
+ }
+
+ /**
+ * Returns tableName.
+ * @return tableName
+ */
+ public String tableName() {
+ return tableName;
+ }
+
+ /**
+ * Set tableName value.
+ * @param tableName table name
+ */
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ /**
+ * Returns Column by ColumnSchema.
+ * @param columnName column name
+ * @return Column
+ */
+ public Column getColumn(String columnName) {
+ return columns.get(columnName);
+ }
+
+ /**
+ * Returns Collection of Column.
+ * @return Collection of Column
+ */
+ public Collection<Column> getColumns() {
+ return columns.values();
+ }
+
+ /**
+ * add Column.
+ * @param columnName column name
+ * @param data Column entity
+ */
+ public void addColumn(String columnName, Column data) {
+ this.columns.put(columnName, data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(tableName, columns);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Row) {
+ final Row other = (Row) obj;
+ return Objects.equals(this.tableName, other.tableName)
+ && Objects.equals(this.columns, other.columns);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("tableName", tableName)
+ .add("columns", columns).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java
new file mode 100644
index 00000000..463b75de
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java
@@ -0,0 +1,84 @@
+/*
+ * 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.notation;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.notation.json.UUIDConverter;
+import org.onosproject.ovsdb.rfc.notation.json.UUIDSerializer;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+/**
+ * Handles both uuid and named-uuid.
+ */
+@JsonSerialize(using = UUIDSerializer.class)
+@JsonDeserialize(converter = UUIDConverter.class)
+public final class UUID {
+ private final String value;
+
+ /**
+ * UUID constructor.
+ * @param value UUID value
+ */
+ private UUID(String value) {
+ checkNotNull(value, "value cannot be null");
+ this.value = value;
+ }
+
+ /**
+ * Get UUID.
+ * @param value UUID value
+ * @return UUID
+ */
+ public static UUID uuid(String value) {
+ return new UUID(value);
+ }
+
+ /**
+ * Returns value.
+ * @return value
+ */
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof UUID) {
+ final UUID other = (UUID) obj;
+ return Objects.equals(this.value, other.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("value", value).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java
new file mode 100644
index 00000000..551a66a4
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/ConditionSerializer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.notation.json;
+
+import java.io.IOException;
+
+import org.onosproject.ovsdb.rfc.notation.Condition;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+/**
+ * Condition Serializer.
+ */
+public class ConditionSerializer extends JsonSerializer<Condition> {
+ @Override
+ public void serialize(Condition condition, JsonGenerator generator,
+ SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ generator.writeStartArray();
+ generator.writeString(condition.getColumn());
+ generator.writeString(condition.getFunction().function());
+ generator.writeObject(condition.getValue());
+ generator.writeEndArray();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java
new file mode 100644
index 00000000..a18b9e72
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/MutationSerializer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.notation.json;
+
+import java.io.IOException;
+
+import org.onosproject.ovsdb.rfc.notation.Mutation;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+/**
+ * Mutation Serializer.
+ */
+public class MutationSerializer extends JsonSerializer<Mutation> {
+ @Override
+ public void serialize(Mutation condition, JsonGenerator generator,
+ SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ generator.writeStartArray();
+ generator.writeString(condition.getColumn());
+ generator.writeString(condition.getMutator().mutator());
+ generator.writeObject(condition.getValue());
+ generator.writeEndArray();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java
new file mode 100644
index 00000000..60fd3349
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbMapSerializer.java
@@ -0,0 +1,49 @@
+/*
+ * 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.notation.json;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+/**
+ * OvsdbMap Serializer.
+ */
+public class OvsdbMapSerializer extends JsonSerializer<OvsdbMap> {
+ @Override
+ public void serialize(OvsdbMap map, JsonGenerator generator,
+ SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ generator.writeStartArray();
+ generator.writeString("map");
+ generator.writeStartArray();
+ Map javaMap = map.map();
+ for (Object key : javaMap.keySet()) {
+ generator.writeStartArray();
+ generator.writeObject(key);
+ generator.writeObject(javaMap.get(key));
+ generator.writeEndArray();
+ }
+ generator.writeEndArray();
+ generator.writeEndArray();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java
new file mode 100644
index 00000000..509b2c53
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/OvsdbSetSerializer.java
@@ -0,0 +1,46 @@
+/*
+ * 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.notation.json;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+/**
+ * OvsdbSet Serializer.
+ */
+public class OvsdbSetSerializer extends JsonSerializer<OvsdbSet> {
+ @Override
+ public void serialize(OvsdbSet set, JsonGenerator generator,
+ SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ generator.writeStartArray();
+ generator.writeString("set");
+ generator.writeStartArray();
+ Set javaSet = set.set();
+ for (Object key : javaSet) {
+ generator.writeObject(key);
+ }
+ generator.writeEndArray();
+ generator.writeEndArray();
+ }
+} \ No newline at end of file
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java
new file mode 100644
index 00000000..66a86633
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDConverter.java
@@ -0,0 +1,32 @@
+/*
+ * 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.notation.json;
+
+import org.onosproject.ovsdb.rfc.notation.UUID;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.util.StdConverter;
+
+/**
+ * UUIDConverter Converter.
+ */
+public class UUIDConverter extends StdConverter<JsonNode, UUID> {
+
+ @Override
+ public UUID convert(JsonNode json) {
+ return UUID.uuid(json.get(1).asText());
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.java
new file mode 100644
index 00000000..8fb5c49c
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UUIDSerializer.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.notation.json;
+
+import java.io.IOException;
+
+import org.onosproject.ovsdb.rfc.notation.UUID;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+/**
+ * UUID Serializer.
+ */
+public class UUIDSerializer extends JsonSerializer<UUID> {
+ @Override
+ public void serialize(UUID value, JsonGenerator generator,
+ SerializerProvider provider) throws IOException {
+ generator.writeStartArray();
+ String reg = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
+ if (value.value().matches(reg)) {
+ generator.writeString("uuid");
+ } else {
+ generator.writeString("named-uuid");
+ }
+ generator.writeString(value.value());
+ generator.writeEndArray();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java
new file mode 100644
index 00000000..2bb1b633
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/json/UpdateNotificationConverter.java
@@ -0,0 +1,46 @@
+/*
+ * 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.notation.json;
+
+import org.onosproject.ovsdb.rfc.message.UpdateNotification;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.util.StdConverter;
+
+/**
+ * UpdateNotificationDeser Converter.
+ */
+public class UpdateNotificationConverter
+ extends StdConverter<JsonNode, UpdateNotification> {
+
+ @Override
+ public UpdateNotification convert(JsonNode value) {
+ return deserialize(value);
+ }
+
+ /**
+ * JsonNode convert into UpdateNotification.
+ * @param node the "params" node of UpdateNotification JsonNode
+ */
+ private UpdateNotification deserialize(JsonNode node) {
+ if (node.isArray()) {
+ if (node.size() == 2) {
+ return new UpdateNotification(node.get(0).asText(), node.get(1));
+ }
+ }
+ return null;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Abort.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Assert.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Comment.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Commit.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Delete.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Insert.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Mutate.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Operation.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Select.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/operations/Update.java b/framework/src/onos/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/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/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/ColumnSchema.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/ColumnSchema.java
new file mode 100644
index 00000000..23eb2be7
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/ColumnSchema.java
@@ -0,0 +1,83 @@
+/*
+ * 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.schema;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.schema.type.ColumnType;
+
+/**
+ * A schema for the column represented by column-schema.
+ */
+public final class ColumnSchema {
+ private final String name;
+ private final ColumnType type;
+
+ /**
+ * Constructs a ColumnSchema object.
+ * @param name the column name
+ * @param columnType the column type
+ */
+ public ColumnSchema(String name, ColumnType columnType) {
+ checkNotNull(name, "name cannot be null");
+ checkNotNull(columnType, "column type cannot be null");
+ this.name = name;
+ this.type = columnType;
+ }
+
+ /**
+ * Returns the name of column.
+ * @return the name of column
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns the type of column.
+ * @return the type of column
+ */
+ public ColumnType type() {
+ return type;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, type);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof ColumnSchema) {
+ final ColumnSchema other = (ColumnSchema) obj;
+ return Objects.equals(this.name, other.name)
+ && Objects.equals(this.type, other.type);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("name", name).add("type", type)
+ .toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/DatabaseSchema.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/DatabaseSchema.java
new file mode 100644
index 00000000..298afc68
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/DatabaseSchema.java
@@ -0,0 +1,135 @@
+/*
+ * 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.schema;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A schema for the database represented by database-schema, which consists of
+ * a set of tables.
+ */
+public final class DatabaseSchema {
+
+ private final String name;
+ private final String version;
+ private final Map<String, TableSchema> tableSchemas;
+
+ /**
+ * Constructs a DatabaseSchema object.
+ * @param name the name of database
+ * @param version the version of database
+ * @param tableSchemas a map of TableSchema
+ */
+ public DatabaseSchema(String name, String version,
+ Map<String, TableSchema> tableSchemas) {
+ checkNotNull(name, "name cannot be null");
+ checkNotNull(version, "version cannot be null");
+ checkNotNull(tableSchemas, "tableSchemas cannot be null");
+ this.name = name;
+ this.version = version;
+ this.tableSchemas = tableSchemas;
+ }
+
+ /**
+ * Returns the name of database.
+ * @return the name of database
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns the version of database.
+ * @return the version of database
+ */
+ public String version() {
+ return version;
+ }
+
+ /**
+ * Returns a map of TableSchema.
+ * @return a map of TableSchema
+ */
+ public Map<String, TableSchema> tableSchemas() {
+ return tableSchemas;
+ }
+
+ /**
+ * Returns a set of table name.
+ * @return a set of table name
+ */
+ public Set<String> getTableNames() {
+ return this.tableSchemas.keySet();
+ }
+
+ /**
+ * Determine whether contain the table.
+ * @param tableName table name
+ * @return boolean
+ */
+ public boolean hasTable(String tableName) {
+ return this.getTableNames().contains(tableName);
+ }
+
+ /**
+ * Returns the TableSchema whose name is the tableName.
+ * @param tableName table name
+ * @return TableSchema
+ */
+ public TableSchema getTableSchema(String tableName) {
+ TableSchema table = tableSchemas.get(tableName);
+ return table;
+ }
+
+ /**
+ * generate initialization columns in each table namely _uuid and _version.
+ */
+ public void generateInitializationColumns() {
+ for (TableSchema tableSchema : tableSchemas.values()) {
+ tableSchema.generateInitializationColumns();
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, version, tableSchemas);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DatabaseSchema) {
+ final DatabaseSchema other = (DatabaseSchema) obj;
+ return Objects.equals(this.name, other.name)
+ && Objects.equals(this.version, other.version)
+ && Objects.equals(this.tableSchemas, other.tableSchemas);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("name", name).add("version", version)
+ .add("tableSchemas", tableSchemas).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/TableSchema.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/TableSchema.java
new file mode 100644
index 00000000..248745dd
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/TableSchema.java
@@ -0,0 +1,129 @@
+/*
+ * 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.schema;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType;
+import org.onosproject.ovsdb.rfc.schema.type.UuidBaseType;
+
+/**
+ * A schema for the table represented by table-schema, which consists of a set
+ * of columns.
+ */
+public final class TableSchema {
+
+ private final String name;
+ private final Map<String, ColumnSchema> columnSchemas;
+
+ /**
+ * Constructs a TableSchema object.
+ * @param name the name of table
+ * @param columnSchemas a map of ColumnSchema
+ */
+ public TableSchema(String name, Map<String, ColumnSchema> columnSchemas) {
+ checkNotNull(name, "name cannot be null");
+ checkNotNull(columnSchemas, "columnSchemas cannot be null");
+ this.name = name;
+ this.columnSchemas = columnSchemas;
+ }
+
+ /**
+ * Returns the name of table.
+ * @return the name of table
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns a map of ColumnSchema.
+ * @return a map of ColumnSchema
+ */
+ public Map<String, ColumnSchema> columnSchemas() {
+ return this.columnSchemas;
+ }
+
+ /**
+ * Returns a set of column name.
+ * @return a set of column name
+ */
+ public Set<String> getColumnNames() {
+ return this.columnSchemas.keySet();
+ }
+
+ /**
+ * Determine whether contain the column.
+ * @param columnName column name
+ * @return boolean
+ */
+ public boolean hasColumn(String columnName) {
+ return this.getColumnNames().contains(columnName);
+ }
+
+ /**
+ * Returns the ColumnSchema whose name is the columnName.
+ * @param columnName column name
+ * @return ColumnSchema
+ */
+ public ColumnSchema getColumnSchema(String columnName) {
+ return this.columnSchemas.get(columnName);
+ }
+
+ /**
+ * Refer to RFC 7047 Section 3.2. generate initialization columns in each
+ * table namely _uuid and _version.
+ */
+ public void generateInitializationColumns() {
+ columnSchemas
+ .put("_uuid",
+ new ColumnSchema("_uuid",
+ new AtomicColumnType(new UuidBaseType())));
+ columnSchemas
+ .put("_version",
+ new ColumnSchema("_version",
+ new AtomicColumnType(new UuidBaseType())));
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, columnSchemas);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof TableSchema) {
+ final TableSchema other = (TableSchema) obj;
+ return Objects.equals(this.name, other.name)
+ && Objects.equals(this.columnSchemas, other.columnSchemas);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("name", name)
+ .add("columnSchemas", columnSchemas).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/AtomicColumnType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/AtomicColumnType.java
new file mode 100644
index 00000000..881755ae
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/AtomicColumnType.java
@@ -0,0 +1,104 @@
+/*
+ * 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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * The "atomic-type" specifies the type of data stored in this column. Refer
+ * to RFC 7047 Section 3.2.
+ */
+public final class AtomicColumnType implements ColumnType {
+ private final BaseType baseType;
+ private final int min;
+ private final int max;
+
+ /**
+ * Constructs a AtomicColumnType object.
+ * @param baseType BaseType entity
+ */
+ public AtomicColumnType(BaseType baseType) {
+ checkNotNull(baseType, "BaseType cannot be null");
+ this.baseType = baseType;
+ this.min = 1;
+ this.max = 1;
+ }
+
+ /**
+ * Constructs a AtomicColumnType object.
+ * @param baseType BaseType entity
+ * @param min min constraint
+ * @param max max constraint
+ */
+ public AtomicColumnType(BaseType baseType, int min, int max) {
+ checkNotNull(baseType, "BaseType cannot be null");
+ this.baseType = baseType;
+ this.min = min;
+ this.max = max;
+ }
+
+ /**
+ * Get baseType.
+ * @return baseType
+ */
+ public BaseType baseType() {
+ return baseType;
+ }
+
+ /**
+ * Get min.
+ * @return min
+ */
+ public int min() {
+ return min;
+ }
+
+ /**
+ * Get max.
+ * @return max
+ */
+ public int max() {
+ return max;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(baseType, min, max);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof AtomicColumnType) {
+ final AtomicColumnType other = (AtomicColumnType) obj;
+ return Objects.equals(this.baseType, other.baseType)
+ && Objects.equals(this.min, other.min)
+ && Objects.equals(this.max, other.max);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("baseType", baseType).add("min", min)
+ .add("max", max).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseType.java
new file mode 100644
index 00000000..d2614c12
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseType.java
@@ -0,0 +1,24 @@
+/*
+ * 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.schema.type;
+
+/**
+ * One of the strings "integer", "real", "boolean", "string", or "uuid",
+ * representing the specified scalar type. Refer to RFC 7047 Section 3.2.
+ */
+public interface BaseType {
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseTypeFactory.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseTypeFactory.java
new file mode 100644
index 00000000..86dbb2e6
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BaseTypeFactory.java
@@ -0,0 +1,214 @@
+/*
+ * 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.schema.type;
+
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.exception.AbnormalJsonNodeException;
+import org.onosproject.ovsdb.rfc.schema.type.UuidBaseType.RefType;
+import org.onosproject.ovsdb.rfc.utils.ObjectMapperUtil;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Sets;
+
+/**
+ * BaseType Factory class.
+ */
+public final class BaseTypeFactory {
+
+ /**
+ * Constructs a BaseTypeFactory object. This class should not be
+ * instantiated.
+ */
+ private BaseTypeFactory() {
+ }
+
+ /**
+ * Create a BaseType from the JsonNode.
+ * @param baseTypeJson the BaseType JsonNode
+ * @param keyorval the key node or value node
+ * @return BaseType
+ */
+ public static BaseType getBaseTypeFromJson(JsonNode baseTypeJson, String keyorval) {
+ if (baseTypeJson.isValueNode()) {
+ String type = baseTypeJson.asText().trim();
+ return fromTypeStr(type);
+ } else {
+ if (!baseTypeJson.has(keyorval)) {
+ String message = "Abnormal BaseType JsonNode, it should contain 'key' or 'value' node but was not found"
+ + ObjectMapperUtil.convertToString(baseTypeJson);
+ throw new AbnormalJsonNodeException(message);
+ }
+ return fromJsonNode(baseTypeJson.get(keyorval));
+ }
+ }
+
+ /**
+ * Get BaseType by the type value of JsonNode.
+ * @param type the type value of JsonNode
+ * @return BaseType
+ */
+ private static BaseType fromTypeStr(String type) {
+ switch (type) {
+ case "boolean":
+ return new BooleanBaseType();
+ case "integer":
+ return new IntegerBaseType();
+ case "real":
+ return new RealBaseType();
+ case "string":
+ return new StringBaseType();
+ case "uuid":
+ return new UuidBaseType();
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * json like "string" or json like {"type" : "string", "enum": ["set",
+ * ["access", "native-tagged"]]}" for key or value.
+ * @param type JsonNode
+ */
+ private static BaseType fromJsonNode(JsonNode type) {
+ if (type.isTextual()) {
+ return fromTypeStr(type.asText());
+ } else if (type.isObject() && type.has("type")) {
+ String typeStr = type.get("type").asText();
+ switch (typeStr) {
+ case "boolean":
+ return new BooleanBaseType();
+ case "integer":
+ return getIntegerBaseType(type);
+ case "real":
+ return getRealBaseType(type);
+ case "string":
+ return getStringBaseType(type);
+ case "uuid":
+ return getUuidBaseType(type);
+ default:
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get IntegerBaseType by the type value of JsonNode which contains the
+ * constraints.
+ * @param type the type value of JsonNode
+ * @return IntegerBaseType
+ */
+ private static IntegerBaseType getIntegerBaseType(JsonNode type) {
+ int min = Integer.MIN_VALUE;
+ int max = Integer.MAX_VALUE;
+ Set<Integer> enums = Sets.newHashSet();
+ JsonNode node = type.get("minInteger");
+ if (node != null) {
+ min = node.asInt();
+ }
+ node = type.get("maxInteger");
+ if (node != null) {
+ max = node.asInt();
+ }
+ if (type.has("enum")) {
+ JsonNode anEnum = type.get("enum").get(1);
+ for (JsonNode n : anEnum) {
+ enums.add(n.asInt());
+ }
+ }
+ return new IntegerBaseType(min, max, enums);
+ }
+
+ /**
+ * Get RealBaseType by the type value of JsonNode which contains the
+ * constraints.
+ * @param type the type value of JsonNode
+ * @return RealBaseType
+ */
+ private static RealBaseType getRealBaseType(JsonNode type) {
+ double min = Double.MIN_VALUE;
+ double max = Double.MAX_VALUE;
+ Set<Double> enums = Sets.newHashSet();
+ JsonNode node = type.get("minReal");
+ if (node != null) {
+ min = node.asDouble();
+ }
+ node = type.get("maxReal");
+ if (node != null) {
+ max = node.asDouble();
+ }
+ if (type.has("enum")) {
+ JsonNode anEnum = type.get("enum").get(1);
+ for (JsonNode n : anEnum) {
+ enums.add(n.asDouble());
+ }
+ }
+ return new RealBaseType(min, max, enums);
+ }
+
+ /**
+ * Get StringBaseType by the type value of JsonNode which contains the
+ * constraints.
+ * @param type the type value of JsonNode
+ * @return StringBaseType
+ */
+ private static StringBaseType getStringBaseType(JsonNode type) {
+ int minLength = Integer.MIN_VALUE;
+ int maxLength = Integer.MAX_VALUE;
+ Set<String> enums = Sets.newHashSet();
+ JsonNode node = type.get("minLength");
+ if (node != null) {
+ minLength = node.asInt();
+ }
+ node = type.get("maxLength");
+ if (node != null) {
+ maxLength = node.asInt();
+ }
+ if (type.has("enum")) {
+ JsonNode enumVal = type.get("enum");
+ if (enumVal.isArray()) {
+ JsonNode anEnum = enumVal.get(1);
+ for (JsonNode n : anEnum) {
+ enums.add(n.asText());
+ }
+ } else if (enumVal.isTextual()) {
+ enums.add(enumVal.asText());
+ }
+ }
+ return new StringBaseType(minLength, maxLength, enums);
+ }
+
+ /**
+ * Get UuidBaseType by the type value of JsonNode which contains the
+ * constraints.
+ * @param type the type value of JsonNode
+ * @return UuidBaseType
+ */
+ private static UuidBaseType getUuidBaseType(JsonNode type) {
+ String refTable = null;
+ String refType = RefType.STRONG.refType();
+ JsonNode node = type.get("refTable");
+ if (node != null) {
+ refTable = node.asText();
+ }
+ node = type.get("refType");
+ if (node != null) {
+ refType = node.asText();
+ }
+ return new UuidBaseType(refTable, refType);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BooleanBaseType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BooleanBaseType.java
new file mode 100644
index 00000000..d42337a5
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/BooleanBaseType.java
@@ -0,0 +1,33 @@
+/*
+ * 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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * One of the strings "integer", "real", "boolean", "string", or "uuid",
+ * representing the specified scalar type. Refer to RFC 7047 Section 3.2.
+ * Because BooleanBaseType has no constraint conditions, and in order to be
+ * consistent with other BaseType, so this class is empty except for the
+ * toString method.
+ */
+public final class BooleanBaseType implements BaseType {
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnType.java
new file mode 100644
index 00000000..20f1bbac
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnType.java
@@ -0,0 +1,24 @@
+/*
+ * 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.schema.type;
+
+/**
+ * The "type" specifies the type of data stored in this column. Refer to RFC
+ * 7047 Section 3.2.
+ */
+public interface ColumnType {
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnTypeFactory.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnTypeFactory.java
new file mode 100644
index 00000000..47b34a6b
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/ColumnTypeFactory.java
@@ -0,0 +1,123 @@
+/*
+ * 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.schema.type;
+
+import org.onosproject.ovsdb.rfc.exception.AbnormalJsonNodeException;
+import org.onosproject.ovsdb.rfc.utils.ObjectMapperUtil;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * ColumnType Factory class.
+ */
+public final class ColumnTypeFactory {
+
+ /**
+ * Constructs a ColumnTypeFactory object. This class should not be
+ * instantiated.
+ */
+ private ColumnTypeFactory() {
+ }
+
+ /**
+ * Those Json's key/value pairs.
+ */
+ public enum Type {
+ KEY("key"), VALUE("value");
+
+ private final String type;
+
+ private Type(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Returns the type for Type.
+ * @return the type
+ */
+ public String type() {
+ return type;
+ }
+ }
+
+ /**
+ * JsonNode like
+ * "flow_tables":{"type":{"key":{"maxInteger":254,"minInteger":0,"type":
+ * "integer"},"min":0,"value":{"type":"uuid","refTable":"Flow_Table"},"max":
+ * "unlimited"}}.
+ * @param columnTypeJson the ColumnType JsonNode
+ * @return ColumnType
+ */
+ public static ColumnType getColumnTypeFromJson(JsonNode columnTypeJson) {
+ if (!columnTypeJson.isObject() || !columnTypeJson.has(Type.VALUE.type())) {
+ return createAtomicColumnType(columnTypeJson);
+ } else if (!columnTypeJson.isValueNode() && columnTypeJson.has(Type.VALUE.type())) {
+ return createKeyValuedColumnType(columnTypeJson);
+ }
+ String message = "Abnormal ColumnType JsonNode, it should be AtomicColumnType or KeyValuedColumnType"
+ + ObjectMapperUtil.convertToString(columnTypeJson);
+ throw new AbnormalJsonNodeException(message);
+ }
+
+ /**
+ * Create AtomicColumnType entity.
+ * @param json JsonNode
+ * @return AtomicColumnType entity
+ */
+ private static AtomicColumnType createAtomicColumnType(JsonNode json) {
+ BaseType baseType = BaseTypeFactory.getBaseTypeFromJson(json, Type.KEY.type());
+ int min = 1;
+ int max = 1;
+ JsonNode node = json.get("min");
+ if (node != null && node.isNumber()) {
+ min = node.asInt();
+ }
+ node = json.get("max");
+ if (node != null) {
+ if (node.isNumber()) {
+ max = node.asInt();
+ } else if (node.isTextual() && "unlimited".equals(node.asText())) {
+ max = Integer.MAX_VALUE;
+ }
+ }
+ return new AtomicColumnType(baseType, min, max);
+ }
+
+ /**
+ * Create KeyValuedColumnType entity.
+ * @param json JsonNode
+ * @return KeyValuedColumnType entity
+ */
+ private static KeyValuedColumnType createKeyValuedColumnType(JsonNode json) {
+ BaseType keyType = BaseTypeFactory.getBaseTypeFromJson(json, Type.KEY.type());
+ BaseType valueType = BaseTypeFactory.getBaseTypeFromJson(json, Type.VALUE.type());
+ int min = 1;
+ int max = 1;
+ JsonNode node = json.get("min");
+ if (node != null && node.isNumber()) {
+ min = node.asInt();
+ }
+ node = json.get("max");
+ if (node != null) {
+ if (node.isNumber()) {
+ max = node.asInt();
+ } else if (node.isTextual() && "unlimited".equals(node.asText())) {
+ max = Integer.MAX_VALUE;
+ }
+ }
+ return new KeyValuedColumnType(keyType, valueType, min, max);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/IntegerBaseType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/IntegerBaseType.java
new file mode 100644
index 00000000..91939515
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/IntegerBaseType.java
@@ -0,0 +1,103 @@
+/*
+ * 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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+import java.util.Set;
+
+import com.google.common.collect.Sets;
+
+/**
+ * One of the strings "integer", "real", "boolean", "string", or "uuid",
+ * representing the specified scalar type. Refer to RFC 7047 Section 3.2.
+ */
+public final class IntegerBaseType implements BaseType {
+ private final int min;
+ private final int max;
+ private final Set<Integer> enums;
+
+ /**
+ * Constructs a IntegerBaseType object.
+ */
+ public IntegerBaseType() {
+ this.min = Integer.MIN_VALUE;
+ this.max = Integer.MAX_VALUE;
+ this.enums = Sets.newHashSet();
+ }
+
+ /**
+ * Constructs a IntegerBaseType object.
+ * @param min min constraint
+ * @param max max constraint
+ * @param enums enums constraint
+ */
+ public IntegerBaseType(int min, int max, Set<Integer> enums) {
+ this.min = min;
+ this.max = max;
+ this.enums = enums;
+ }
+
+ /**
+ * Get min.
+ * @return min
+ */
+ public int min() {
+ return min;
+ }
+
+ /**
+ * Get max.
+ * @return max
+ */
+ public int max() {
+ return max;
+ }
+
+ /**
+ * Get enums.
+ * @return enums
+ */
+ public Set<Integer> enums() {
+ return enums;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(min, max, enums);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof IntegerBaseType) {
+ final IntegerBaseType other = (IntegerBaseType) obj;
+ return Objects.equals(this.enums, other.enums)
+ && Objects.equals(this.min, other.min)
+ && Objects.equals(this.max, other.max);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("min", min).add("max", max)
+ .add("enums", enums).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/KeyValuedColumnType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/KeyValuedColumnType.java
new file mode 100644
index 00000000..8407457a
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/KeyValuedColumnType.java
@@ -0,0 +1,108 @@
+/*
+ * 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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * a JSON object that describes the type of a database column, with key and
+ * value. Refer to RFC 7047 Section 3.2.
+ */
+public final class KeyValuedColumnType implements ColumnType {
+ private final BaseType keyType;
+ private final BaseType valueType;
+ private final int min;
+ private final int max;
+
+ /**
+ * Constructs a KeyValuedColumnType object.
+ * @param keyType BaseType entity
+ * @param valueType BaseType entity
+ * @param min min constraint
+ * @param max max constraint
+ */
+ public KeyValuedColumnType(BaseType keyType, BaseType valueType, int min,
+ int max) {
+ checkNotNull(keyType, "keyType cannot be null");
+ checkNotNull(valueType, "valueType cannot be null");
+ this.keyType = keyType;
+ this.valueType = valueType;
+ this.min = min;
+ this.max = max;
+ }
+
+ /**
+ * Get keyType.
+ * @return keyType
+ */
+ public BaseType keyType() {
+ return keyType;
+ }
+
+ /**
+ * Get valueType.
+ * @return valueType
+ */
+ public BaseType valueType() {
+ return valueType;
+ }
+
+ /**
+ * Get min.
+ * @return min
+ */
+ public int min() {
+ return min;
+ }
+
+ /**
+ * Get max.
+ * @return max
+ */
+ public int max() {
+ return max;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(keyType, valueType, min, max);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof KeyValuedColumnType) {
+ final KeyValuedColumnType other = (KeyValuedColumnType) obj;
+ return Objects.equals(this.keyType, other.keyType)
+ && Objects.equals(this.valueType, other.valueType)
+ && Objects.equals(this.min, other.min)
+ && Objects.equals(this.max, other.max);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("keyType", keyType)
+ .add("valueType", valueType).add("min", min).add("max", max)
+ .toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/RealBaseType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/RealBaseType.java
new file mode 100644
index 00000000..6704e30a
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/RealBaseType.java
@@ -0,0 +1,103 @@
+/*
+ * 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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+import java.util.Set;
+
+import com.google.common.collect.Sets;
+
+/**
+ * One of the strings "integer", "real", "boolean", "string", or "uuid",
+ * representing the specified scalar type. Refer to RFC 7047 Section 3.2.
+ */
+public final class RealBaseType implements BaseType {
+ private final double min;
+ private final double max;
+ private final Set<Double> enums;
+
+ /**
+ * Constructs a RealBaseType object.
+ */
+ public RealBaseType() {
+ this.min = Double.MIN_VALUE;
+ this.max = Double.MAX_VALUE;
+ this.enums = Sets.newHashSet();
+ }
+
+ /**
+ * Constructs a RealBaseType object.
+ * @param min min constraint
+ * @param max max constraint
+ * @param enums enums constraint
+ */
+ public RealBaseType(double min, double max, Set<Double> enums) {
+ this.min = min;
+ this.max = max;
+ this.enums = enums;
+ }
+
+ /**
+ * Get min.
+ * @return min
+ */
+ public double getMin() {
+ return min;
+ }
+
+ /**
+ * Get max.
+ * @return max
+ */
+ public double getMax() {
+ return max;
+ }
+
+ /**
+ * Get enums.
+ * @return enums
+ */
+ public Set<Double> getEnums() {
+ return enums;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(min, max, enums);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof RealBaseType) {
+ final RealBaseType other = (RealBaseType) obj;
+ return Objects.equals(this.enums, other.enums)
+ && Objects.equals(this.min, other.min)
+ && Objects.equals(this.max, other.max);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("min", min).add("max", max)
+ .add("enums", enums).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/StringBaseType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/StringBaseType.java
new file mode 100644
index 00000000..96d2f739
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/StringBaseType.java
@@ -0,0 +1,103 @@
+/*
+ * 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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+import java.util.Set;
+
+import com.google.common.collect.Sets;
+
+/**
+ * One of the strings "integer", "real", "boolean", "string", or "uuid",
+ * representing the specified scalar type. Refer to RFC 7047 Section 3.2.
+ */
+public final class StringBaseType implements BaseType {
+ private final int minLength;
+ private final int maxLength;
+ private final Set<String> enums;
+
+ /**
+ * Constructs a StringBaseType object.
+ */
+ public StringBaseType() {
+ this.minLength = Integer.MIN_VALUE;
+ this.maxLength = Integer.MAX_VALUE;
+ this.enums = Sets.newHashSet();
+ }
+
+ /**
+ * Constructs a StringBaseType object.
+ * @param minLength minLength constraint
+ * @param maxLength maxLength constraint
+ * @param enums enums constraint
+ */
+ public StringBaseType(int minLength, int maxLength, Set<String> enums) {
+ this.minLength = minLength;
+ this.maxLength = maxLength;
+ this.enums = enums;
+ }
+
+ /**
+ * Get minLength.
+ * @return minLength
+ */
+ public int getMinLength() {
+ return minLength;
+ }
+
+ /**
+ * Get maxLength.
+ * @return maxLength
+ */
+ public int getMaxLength() {
+ return maxLength;
+ }
+
+ /**
+ * Get enums.
+ * @return enums
+ */
+ public Set<String> getEnums() {
+ return enums;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(minLength, maxLength, enums);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof StringBaseType) {
+ final StringBaseType other = (StringBaseType) obj;
+ return Objects.equals(this.enums, other.enums)
+ && Objects.equals(this.minLength, other.minLength)
+ && Objects.equals(this.maxLength, other.maxLength);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("minLength", minLength)
+ .add("maxLength", maxLength).add("enums", enums).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/UuidBaseType.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/UuidBaseType.java
new file mode 100644
index 00000000..46e0d9fa
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/schema/type/UuidBaseType.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.schema.type;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * One of the strings "integer", "real", "boolean", "string", or "uuid",
+ * representing the specified scalar type. Refer to RFC 7047 Section 3.2.
+ */
+public final class UuidBaseType implements BaseType {
+ /**
+ * RefType is strong or weak. refer to base-type of RFC 7047 Section 3.2.
+ */
+ public enum RefType {
+ STRONG("strong"), WEAK("weak");
+
+ private String refType;
+
+ private RefType(String refType) {
+ this.refType = refType;
+ }
+
+ /**
+ * Returns the refType for RefType.
+ * @return the refType
+ */
+ public String refType() {
+ return refType;
+ }
+ }
+
+ private final String refTable;
+ private final String refType;
+
+ /**
+ * Constructs a UuidBaseType object.
+ */
+ public UuidBaseType() {
+ this.refTable = null;
+ this.refType = RefType.STRONG.refType();
+ }
+
+ /**
+ * Constructs a UuidBaseType object.
+ * @param refTable refTable constraint
+ * @param refType refType constraint
+ */
+ public UuidBaseType(String refTable, String refType) {
+ checkNotNull(refType, "refType cannot be null");
+ this.refTable = refTable;
+ this.refType = refType;
+ }
+
+ /**
+ * Get refTable.
+ * @return refTable
+ */
+ public String getRefTable() {
+ return refTable;
+ }
+
+ /**
+ * Get refType.
+ * @return refType
+ */
+ public String getRefType() {
+ return refType;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(refTable, refType);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof UuidBaseType) {
+ final UuidBaseType other = (UuidBaseType) obj;
+ return Objects.equals(this.refTable, other.refTable)
+ && Objects.equals(this.refType, other.refType);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("refTable", refTable)
+ .add("refType", refType).toString();
+ }
+}
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
new file mode 100644
index 00000000..bd589f03
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Bridge.java
@@ -0,0 +1,559 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+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;
+
+/**
+ * This class provides operations of Bridge Table.
+ */
+public class Bridge extends AbstractOvsdbTableService {
+
+ /**
+ * Bridge table column name.
+ */
+ public enum BridgeColumn {
+ NAME("name"), DATAPATHTYPE("datapath_type"), DATAPATHID("datapath_id"),
+ STPENABLE("stpenable"), PORTS("ports"), MIRRORS("mirrors"),
+ NETFLOW("netflow"), SFLOW("sflow"), IPFIX("ipfix"),
+ CONTROLLER("controller"), PROTOCOLS("protocols"),
+ FAILMODE("fail_mode"), STATUS("status"), OTHERCONFIG("other_config"),
+ EXTERNALIDS("external_ids"), FLOODVLANS("flood_vlans"),
+ FLOWTABLES("flow_tables");
+
+ private final String columnName;
+
+ private BridgeColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for BridgeColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Bridge object. Generate Bridge Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Bridge(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.BRIDGE, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "name" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "name"
+ */
+ public Column getNameColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.NAME
+ .columnName(),
+ "getNameColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "name" to the Row entity of
+ * attributes.
+ * @param name the column data which column name is "name"
+ */
+ public void setName(String name) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.NAME
+ .columnName(),
+ "setName",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, name);
+ }
+
+ /**
+ * Get the column data which column name is "name" from the Row entity of
+ * attributes.
+ * @return the column data which column name is "name"
+ */
+ public String getName() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.NAME
+ .columnName(),
+ "getName",
+ VersionNum.VERSION100);
+ return (String) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Get the Column entity which column name is "datapath_type" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "datapath_type"
+ */
+ public Column getDatapathTypeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.DATAPATHTYPE
+ .columnName(),
+ "getDatapathTypeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "datapath_type" to the Row
+ * entity of attributes.
+ * @param datapathType the column data which column name is "datapath_type"
+ */
+ public void setDatapathType(String datapathType) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.DATAPATHTYPE
+ .columnName(),
+ "setDatapathType",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, datapathType);
+ }
+
+ /**
+ * Get the Column entity which column name is "datapath_id" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "datapath_id"
+ */
+ public Column getDatapathIdColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.DATAPATHID
+ .columnName(),
+ "getDatapathIdColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "datapath_id" to the Row entity
+ * of attributes.
+ * @param datapathId the column data which column name is "datapath_id"
+ */
+ public void setDatapathId(Set<String> datapathId) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.DATAPATHID
+ .columnName(),
+ "setDatapathId",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, datapathId);
+ }
+
+ /**
+ * Get the Column entity which column name is "stpenable" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "stpenable"
+ */
+ public Column getStpEnableColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.STPENABLE
+ .columnName(),
+ "getStpEnableColumn",
+ VersionNum.VERSION620);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "stpenable" to the Row entity of
+ * attributes.
+ * @param stpenable the column data which column name is "stpenable"
+ */
+ public void setStpEnable(Boolean stpenable) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.STPENABLE
+ .columnName(),
+ "setStpEnable",
+ VersionNum.VERSION620);
+ super.setDataHandler(columndesc, stpenable);
+ }
+
+ /**
+ * Get the Column entity which column name is "ports" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "ports"
+ */
+ public Column getPortsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.PORTS
+ .columnName(),
+ "getPortsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ports" to the Row entity of
+ * attributes.
+ * @param ports the column data which column name is "ports"
+ */
+ public void setPorts(Set<UUID> ports) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.PORTS
+ .columnName(),
+ "setPorts",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, ports);
+ }
+
+ /**
+ * Get the Column entity which column name is "mirrors" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "mirrors"
+ */
+ public Column getMirrorsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.MIRRORS
+ .columnName(),
+ "getMirrorsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "mirrors" to the Row entity of
+ * attributes.
+ * @param mirrors the column data which column name is "mirrors"
+ */
+ public void setMirrors(Set<UUID> mirrors) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.MIRRORS
+ .columnName(),
+ "setMirrors",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, mirrors);
+ }
+
+ /**
+ * Get the Column entity which column name is "netflow" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "netflow"
+ */
+ public Column getNetflowColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.NETFLOW
+ .columnName(),
+ "getNetflowColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "netflow" to the Row entity of
+ * attributes.
+ * @param netflow the column data which column name is "netflow"
+ */
+ public void setNetflow(Set<UUID> netflow) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.NETFLOW
+ .columnName(),
+ "setNetflow",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, netflow);
+ }
+
+ /**
+ * Get the Column entity which column name is "sflow" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "sflow"
+ */
+ public Column getSflowColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.SFLOW
+ .columnName(),
+ "getSflowColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "sflow" to the Row entity of
+ * attributes.
+ * @param sflow the column data which column name is "sflow"
+ */
+ public void setSflow(Set<UUID> sflow) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.SFLOW
+ .columnName(),
+ "setSflow",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, sflow);
+ }
+
+ /**
+ * Get the Column entity which column name is "ipfix" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "ipfix"
+ */
+ public Column getIpfixColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.IPFIX
+ .columnName(),
+ "getIpfixColumn",
+ VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ipfix" to the Row entity of
+ * attributes.
+ * @param ipfix the column data which column name is "ipfix"
+ */
+ public void setIpfix(Set<UUID> ipfix) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.IPFIX
+ .columnName(),
+ "setIpfix",
+ VersionNum.VERSION710);
+ super.setDataHandler(columndesc, ipfix);
+ }
+
+ /**
+ * Get the Column entity which column name is "controller" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "controller"
+ */
+ public Column getControllerColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.CONTROLLER
+ .columnName(),
+ "getControllerColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "controller" to the Row entity
+ * of attributes.
+ * @param controller the column data which column name is "controller"
+ */
+ public void setController(Set<UUID> controller) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.CONTROLLER
+ .columnName(),
+ "setController",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, controller);
+ }
+
+ /**
+ * Get the Column entity which column name is "protocols" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "protocols"
+ */
+ public Column getProtocolsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.PROTOCOLS
+ .columnName(),
+ "getProtocolsColumn",
+ VersionNum.VERSION6111);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "protocols" to the Row entity of
+ * attributes.
+ * @param protocols the column data which column name is "protocols"
+ */
+ public void setProtocols(Set<String> protocols) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.PROTOCOLS
+ .columnName(),
+ "setProtocols",
+ VersionNum.VERSION6111);
+ super.setDataHandler(columndesc, protocols);
+ }
+
+ /**
+ * Get the Column entity which column name is "fail_mode" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "fail_mode"
+ */
+ public Column getFailModeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.FAILMODE
+ .columnName(),
+ "getFailModeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "fail_mode" to the Row entity of
+ * attributes.
+ * @param failMode the column data which column name is "fail_mode"
+ */
+ public void setFailMode(Set<String> failMode) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.FAILMODE
+ .columnName(),
+ "setFailMode",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, failMode);
+ }
+
+ /**
+ * Get the Column entity which column name is "status" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "status"
+ */
+ public Column getStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.STATUS
+ .columnName(),
+ "getStatusColumn",
+ VersionNum.VERSION620);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "status" to the Row entity of
+ * attributes.
+ * @param status the column data which column name is "status"
+ */
+ public void setStatus(Map<String, String> status) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.STATUS
+ .columnName(),
+ "setStatus",
+ VersionNum.VERSION620);
+ super.setDataHandler(columndesc, status);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "other_config"
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.OTHERCONFIG
+ .columnName(),
+ "getOtherConfigColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.OTHERCONFIG
+ .columnName(),
+ "setOtherConfig",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.EXTERNALIDS
+ .columnName(),
+ "getExternalIdsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.EXTERNALIDS
+ .columnName(),
+ "setExternalIds",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "flood_vlans" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "flood_vlans"
+ */
+ public Column getFloodVlansColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.FLOODVLANS
+ .columnName(),
+ "getFloodVlansColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "flood_vlans" to the Row entity
+ * of attributes.
+ * @param vlans the column data which column name is "flood_vlans"
+ */
+ public void setFloodVlans(Set<Long> vlans) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.FLOODVLANS
+ .columnName(),
+ "setFloodVlans",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, vlans);
+ }
+
+ /**
+ * Get the Column entity which column name is "flow_tables" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "flow_tables"
+ */
+ public Column getFlowTablesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.FLOWTABLES
+ .columnName(),
+ "getFlowTablesColumn",
+ VersionNum.VERSION650);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "flow_tables" to the Row entity
+ * of attributes.
+ * @param flowTables the column data which column name is "flow_tables"
+ */
+ public void setFlowTables(Map<Long, UUID> flowTables) {
+ ColumnDescription columndesc = new ColumnDescription(
+ BridgeColumn.FLOWTABLES
+ .columnName(),
+ "setFlowTables",
+ VersionNum.VERSION650);
+ super.setDataHandler(columndesc, flowTables);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Controller.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Controller.java
new file mode 100644
index 00000000..912526cc
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Controller.java
@@ -0,0 +1,556 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Controller Table.
+ */
+public class Controller extends AbstractOvsdbTableService {
+
+ /**
+ * Controller table column name.
+ */
+ public enum ControllerColumn {
+ TARGET("target"), BURSTLIMIT("controller_burst_limit"),
+ RATELIMIT("controller_rate_limit"), CONNECTIONMODE("connection_mode"),
+ ENABLEASYNCMESSAGES("enable_async_messages"),
+ EXTERNALIDS("external_ids"), LOCALNETMASK("local_netmask"),
+ LOCALGATEWAY("local_gateway"), STATUS("status"), ROLE("role"),
+ INACTIVITYPROBE("inactivity_probe"), ISCONNECTED("is_connected"),
+ OTHERCONFIG("other_config"), MAXBACKOFF("max_backoff"),
+ LOCALIP("local_ip"),
+ DISCOVERUPDATERESOLVCONF("discover_update_resolv_conf"),
+ DISCOVERACCEPTREGEX("discover_accept_regex");
+
+ private final String columnName;
+
+ private ControllerColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for ControllerColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Controller object. Generate Controller Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Controller(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.CONTROLLER, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "target" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "target"
+ */
+ public Column getTargetColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.TARGET
+ .columnName(),
+ "getTargetColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "target" to the Row entity of
+ * attributes.
+ * @param target the column data which column name is "target"
+ */
+ public void setTarget(String target) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.TARGET
+ .columnName(),
+ "setTarget",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, target);
+ }
+
+ /**
+ * Get the Column entity which column name is "controller_burst_limit" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "controller_burst_limit"
+ */
+ public Column getBurstLimitColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.BURSTLIMIT
+ .columnName(),
+ "getBurstLimitColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "controller_burst_limit" to the
+ * Row entity of attributes.
+ * @param burstLimit the column data which column name is
+ * "controller_burst_limit"
+ */
+ public void setBurstLimit(Long burstLimit) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.BURSTLIMIT
+ .columnName(),
+ "setBurstLimit",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, burstLimit);
+ }
+
+ /**
+ * Get the Column entity which column name is "controller_rate_limit" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "controller_rate_limit"
+ */
+ public Column getRateLimitColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.RATELIMIT
+ .columnName(),
+ "getRateLimitColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "controller_rate_limit" to the
+ * Row entity of attributes.
+ * @param rateLimit the column data which column name is
+ * "controller_rate_limit"
+ */
+ public void setRateLimit(Long rateLimit) {
+ ColumnDescription columndesc = new ColumnDescription(
+ "controller_rate_limit",
+ "setRateLimit",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, rateLimit);
+ }
+
+ /**
+ * Get the Column entity which column name is "connection_mode" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "connection_mode"
+ */
+ public Column getConnectionModeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ "connection_mode",
+ "getConnectionModeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "connection_mode" to the Row
+ * entity of attributes.
+ * @param connectionMode the column data which column name is
+ * "connection_mode"
+ */
+ public void setConnectionMode(Set<String> connectionMode) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.RATELIMIT
+ .columnName(),
+ "setConnectionMode",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, connectionMode);
+ }
+
+ /**
+ * Get the Column entity which column name is "enable_async_messages" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "enable_async_messages"
+ */
+ public Column getEnableAsyncMessagesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.ENABLEASYNCMESSAGES
+ .columnName(),
+ "getEnableAsyncMessagesColumn",
+ VersionNum.VERSION670);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "enable_async_messages" to the
+ * Row entity of attributes.
+ * @param enableAsyncMessages the column data which column name is
+ * "enable_async_messages"
+ */
+ public void setEnableAsyncMessages(Set<Boolean> enableAsyncMessages) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.ENABLEASYNCMESSAGES
+ .columnName(),
+ "setEnableAsyncMessages",
+ VersionNum.VERSION670);
+ super.setDataHandler(columndesc, enableAsyncMessages);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.EXTERNALIDS
+ .columnName(),
+ "getExternalIdsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.EXTERNALIDS
+ .columnName(),
+ "setExternalIds",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "local_netmask" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "local_netmask"
+ */
+ public Column getLocalNetmaskColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.LOCALNETMASK
+ .columnName(),
+ "getLocalNetmaskColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "local_netmask" to the Row
+ * entity of attributes.
+ * @param localNetmask the column data which column name is "local_netmask"
+ */
+ public void setLocalNetmask(Set<String> localNetmask) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.LOCALNETMASK
+ .columnName(),
+ "setLocalNetmask",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, localNetmask);
+ }
+
+ /**
+ * Get the Column entity which column name is "local_gateway" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "local_gateway"
+ */
+ public Column getLocalGatewayColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.LOCALGATEWAY
+ .columnName(),
+ "getLocalGatewayColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "local_gateway" to the Row
+ * entity of attributes.
+ * @param localGateway the column data which column name is "local_gateway"
+ */
+ public void setLocalGateway(Set<String> localGateway) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.LOCALGATEWAY
+ .columnName(),
+ "setLocalGateway",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, localGateway);
+ }
+
+ /**
+ * Get the Column entity which column name is "status" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "status"
+ */
+ public Column getStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.STATUS
+ .columnName(),
+ "getStatusColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "status" to the Row entity of
+ * attributes.
+ * @param status the column data which column name is "status"
+ */
+ public void setStatus(Map<String, String> status) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.STATUS
+ .columnName(),
+ "setStatus",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, status);
+ }
+
+ /**
+ * Get the Column entity which column name is "role" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "role"
+ */
+ public Column getRoleColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.ROLE
+ .columnName(),
+ "getRoleColumn",
+ VersionNum.VERSION110);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "role" to the Row entity of
+ * attributes.
+ * @param role the column data which column name is "role"
+ */
+ public void setRole(Set<String> role) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.ROLE
+ .columnName(),
+ "setRole",
+ VersionNum.VERSION110);
+ super.setDataHandler(columndesc, role);
+ }
+
+ /**
+ * Get the Column entity which column name is "inactivity_probe" from the
+ * Row entity of attributes.
+ * @return the Column entity which column name is "inactivity_probe"
+ */
+ public Column getInactivityProbeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.INACTIVITYPROBE
+ .columnName(),
+ "getInactivityProbeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "inactivity_probe" to the Row
+ * entity of attributes.
+ * @param inactivityProbe the column data which column name is
+ * "inactivity_probe"
+ */
+ public void setInactivityProbe(Set<Long> inactivityProbe) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.INACTIVITYPROBE
+ .columnName(),
+ "setInactivityProbe",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, inactivityProbe);
+ }
+
+ /**
+ * Get the Column entity which column name is "is_connected" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "is_connected"
+ */
+ public Column getIsConnectedColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.ISCONNECTED
+ .columnName(),
+ "getIsConnectedColumn",
+ VersionNum.VERSION110);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "is_connected" to the Row entity
+ * of attributes.
+ * @param isConnected the column data which column name is "is_connected"
+ */
+ public void setIsConnected(Boolean isConnected) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.ISCONNECTED
+ .columnName(),
+ "setIsConnected",
+ VersionNum.VERSION110);
+ super.setDataHandler(columndesc, isConnected);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "other_config"
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.OTHERCONFIG
+ .columnName(),
+ "getOtherConfigColumn",
+ VersionNum.VERSION680);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.OTHERCONFIG
+ .columnName(),
+ "setOtherConfig",
+ VersionNum.VERSION680);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "max_backoff" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "max_backoff"
+ */
+ public Column getMaxBackoffColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.MAXBACKOFF
+ .columnName(),
+ "getMaxBackoffColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "max_backoff" to the Row entity
+ * of attributes.
+ * @param maxBackoff the column data which column name is "max_backoff"
+ */
+ public void setMaxBackoff(Long maxBackoff) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.MAXBACKOFF
+ .columnName(),
+ "setMaxBackoff",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, maxBackoff);
+ }
+
+ /**
+ * Get the Column entity which column name is "local_ip" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "local_ip"
+ */
+ public Column getLocalIpColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.LOCALIP
+ .columnName(),
+ "getLocalIpColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "local_ip" to the Row entity of
+ * attributes.
+ * @param localIp the column data which column name is "local_ip"
+ */
+ public void setLocalIp(Set<String> localIp) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.LOCALIP
+ .columnName(),
+ "setLocalIp",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, localIp);
+ }
+
+ /**
+ * Get the Column entity which column name is "discover_update_resolv_conf"
+ * from the Row entity of attributes.
+ * @return the Column entity which column name is
+ * "discover_update_resolv_conf"
+ */
+ public Column getDiscoverUpdateResolvConfColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.DISCOVERUPDATERESOLVCONF
+ .columnName(),
+ "getDiscoverUpdateResolvConfColumn",
+ VersionNum.VERSION100,
+ VersionNum.VERSION300);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "discover_update_resolv_conf" to
+ * the Row entity of attributes.
+ * @param discoverUpdateResolvConf the column data which column name is
+ * "discover_update_resolv_conf"
+ */
+ public void setDiscoverUpdateResolvConf(Set<String> discoverUpdateResolvConf) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.DISCOVERUPDATERESOLVCONF
+ .columnName(),
+ "setDiscoverUpdateResolvConf",
+ VersionNum.VERSION100,
+ VersionNum.VERSION300);
+ super.setDataHandler(columndesc, discoverUpdateResolvConf);
+ }
+
+ /**
+ * Get the Column entity which column name is "discover_accept_regex" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "discover_accept_regex"
+ */
+ public Column getDiscoverAcceptRegexColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.DISCOVERACCEPTREGEX
+ .columnName(),
+ "getDiscoverAcceptRegexColumn",
+ VersionNum.VERSION100,
+ VersionNum.VERSION300);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "discover_accept_regex" to the
+ * Row entity of attributes.
+ * @param discoverAcceptRegex the column data which column name is
+ * "discover_accept_regex"
+ */
+ public void setDiscoverAcceptRegex(Set<String> discoverAcceptRegex) {
+ ColumnDescription columndesc = new ColumnDescription(
+ ControllerColumn.DISCOVERACCEPTREGEX
+ .columnName(),
+ "setDiscoverAcceptRegex",
+ VersionNum.VERSION100,
+ VersionNum.VERSION300);
+ super.setDataHandler(columndesc, discoverAcceptRegex);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowSampleCollectorSet.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowSampleCollectorSet.java
new file mode 100644
index 00000000..05a0354f
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowSampleCollectorSet.java
@@ -0,0 +1,151 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+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;
+
+/**
+ * This class provides operations of FlowSampleCollectorSet Table.
+ */
+public class FlowSampleCollectorSet extends AbstractOvsdbTableService {
+ /**
+ * FlowSampleCollectorSet table column name.
+ */
+ public enum FlowSampleCollectorSetColumn {
+ ID("id"), BRIDGE("bridge"), IPFIX("ipfix"), EXTERNALIDS("external_ids");
+
+ private final String columnName;
+
+ private FlowSampleCollectorSetColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for FlowSampleCollectorSetColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a FlowSampleCollectorSet object. Generate
+ * FlowSampleCollectorSet Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public FlowSampleCollectorSet(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.FLOWSAMPLECOLLECTORSET, VersionNum.VERSION710);
+ }
+
+ /**
+ * Get the Column entity which column name is "id" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "id"
+ */
+ public Column getIdColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.ID.columnName(),
+ "getIdColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "id" to the Row entity of
+ * attributes.
+ * @param id the column data which column name is "id"
+ */
+ public void setId(Long id) {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.ID.columnName(),
+ "setId", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, id);
+ }
+
+ /**
+ * Get the Column entity which column name is "bridge" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "bridge"
+ */
+ public Column getBridgeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.BRIDGE.columnName(),
+ "getBridgeColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bridge" to the Row entity of
+ * attributes.
+ * @param bridge the column data which column name is "bridge"
+ */
+ public void setBridge(UUID bridge) {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.BRIDGE.columnName(),
+ "setBridge", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, bridge);
+ }
+
+ /**
+ * Get the Column entity which column name is "ipfix" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "ipfix"
+ */
+ public Column getIpfixColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.IPFIX.columnName(),
+ "getIpfixColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ipfix" to the Row entity of
+ * attributes.
+ * @param ipfix the column data which column name is "ipfix"
+ */
+ public void setIpfix(UUID ipfix) {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.IPFIX.columnName(),
+ "setIpfix", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, ipfix);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.EXTERNALIDS
+ .columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.EXTERNALIDS
+ .columnName(),
+ "setExternalIds", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, externalIds);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowTable.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowTable.java
new file mode 100644
index 00000000..ed1c217a
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/FlowTable.java
@@ -0,0 +1,196 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of FlowTable Table.
+ */
+public class FlowTable extends AbstractOvsdbTableService {
+ /**
+ * FlowTable table column name.
+ */
+ public enum FlowTableColumn {
+ FLOWLIMIT("flow_limit"), OVERFLOWPOLICY("overflow_policy"), GROUPS("groups"), NAME("name"),
+ PREFIXES("prefixes"), EXTERNALIDS("external_ids");
+
+ private final String columnName;
+
+ private FlowTableColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for FlowTableColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a FlowTable object. Generate FlowTable Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public FlowTable(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.FLWTABLE, VersionNum.VERSION650);
+ }
+
+ /**
+ * Get the Column entity which column name is "flow_limit" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "flow_limit"
+ */
+ public Column getFlowLimitColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.FLOWLIMIT.columnName(),
+ "getFlowLimitColumn", VersionNum.VERSION650);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "flow_limit" to the Row entity
+ * of attributes.
+ * @param flowLimit the column data which column name is "flow_limit"
+ */
+ public void setFlowLimit(Set<Long> flowLimit) {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.FLOWLIMIT.columnName(),
+ "setFlowLimit", VersionNum.VERSION650);
+ super.setDataHandler(columndesc, flowLimit);
+ }
+
+ /**
+ * Get the Column entity which column name is "overflow_policy" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "overflow_policy"
+ */
+ public Column getOverflowPolicyColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.OVERFLOWPOLICY.columnName(),
+ "getOverflowPolicyColumn", VersionNum.VERSION650);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "overflow_policy" to the Row
+ * entity of attributes.
+ * @param overflowPolicy the column data which column name is
+ * "overflow_policy"
+ */
+ public void setOverflowPolicy(Set<String> overflowPolicy) {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.OVERFLOWPOLICY.columnName(),
+ "setOverflowPolicy", VersionNum.VERSION650);
+ super.setDataHandler(columndesc, overflowPolicy);
+ }
+
+ /**
+ * Get the Column entity which column name is "groups" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "groups"
+ */
+ public Column getGroupsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.GROUPS.columnName(),
+ "getGroupsColumn", VersionNum.VERSION650);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "groups" to the Row entity of
+ * attributes.
+ * @param groups the column data which column name is "groups"
+ */
+ public void setGroups(Set<String> groups) {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.GROUPS.columnName(),
+ "setGroups", VersionNum.VERSION650);
+ super.setDataHandler(columndesc, groups);
+ }
+
+ /**
+ * Get the Column entity which column name is "name" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "name"
+ */
+ public Column getNameColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.NAME.columnName(),
+ "getNameColumn", VersionNum.VERSION650);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "name" to the Row entity of
+ * attributes.
+ * @param name the column data which column name is "name"
+ */
+ public void setName(Set<String> name) {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.NAME.columnName(),
+ "setName",
+ VersionNum.VERSION650);
+ super.setDataHandler(columndesc, name);
+ }
+
+ /**
+ * Get the Column entity which column name is "prefixes" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "prefixes"
+ */
+ public Column getPrefixesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.PREFIXES.columnName(),
+ "getPrefixesColumn", VersionNum.VERSION740);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "prefixes" to the Row entity of
+ * attributes.
+ * @param prefixes the column data which column name is "prefixes"
+ */
+ public void setPrefixes(Set<String> prefixes) {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.PREFIXES.columnName(),
+ "setPrefixes", VersionNum.VERSION740);
+ super.setDataHandler(columndesc, prefixes);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION750);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(FlowTableColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION750);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Interface.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Interface.java
new file mode 100644
index 00000000..ee946287
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Interface.java
@@ -0,0 +1,1024 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Interface Table.
+ */
+public class Interface extends AbstractOvsdbTableService {
+
+ /**
+ * Interface table column name.
+ */
+ public enum InterfaceColumn {
+ NAME("name"), TYPE("type"), OPTIONS("options"),
+ INGRESSPOLICINGRATE("ingress_policing_rate"),
+ INGRESSPOLICINGBURST("ingress_policing_burst"), MACINUSE("mac_in_use"),
+ MAC("mac"), IFINDEX("ifindex"), EXTERNALIDS("external_ids"),
+ OFPORT("ofport"), OFPORTREQUEST("ofport_request"), BFD("bfd"),
+ BFDSTATUS("bfd_status"), MONITOR("monitor"), CFMMPID("cfm_mpid"),
+ CFMREMOTEMPID("cfm_remote_mpid"), CFMREMOTEMPIDS("cfm_remote_mpids"),
+ CFMFLAPCOUNT("cfm_flap_count"), CFMFAULT("cfm_fault"),
+ CFMFAULTSTATUS("cfm_fault_status"),
+ CFMREMOTEOPSTATE("cfm_remote_opstate"), CFMHEALTH("cfm_health"),
+ LACPCURRENT("lacp_current"), OTHERCONFIG("other_config"),
+ STATISTICS("statistics"), STATUS("status"), ADMINSTATE("admin_state"),
+ LINKSTATE("link_state"), LINKRESETS("link_resets"),
+ LINKSPEED("link_speed"), DUPLEX("duplex"), MTU("mtu"), ERROR("error");
+
+ private final String columnName;
+
+ private InterfaceColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for InterfaceColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Interface object. Generate Interface Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Interface(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.INTERFACE, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "name" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "name"
+ */
+ public Column getNameColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.NAME
+ .columnName(),
+ "getNameColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "name" to the Row entity of
+ * attributes.
+ * @param name the column data which column name is "name"
+ */
+ public void setName(String name) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.NAME
+ .columnName(),
+ "setName",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, name);
+ }
+
+ /**
+ * Get the column data which column name is "name" from the Row entity of
+ * attributes.
+ * @return the column data which column name is "name"
+ */
+ public String getName() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.NAME
+ .columnName(),
+ "getName",
+ VersionNum.VERSION100);
+ return (String) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Get the Column entity which column name is "type" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "type"
+ */
+ public Column getTypeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.TYPE
+ .columnName(),
+ "getTypeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "type" to the Row entity of
+ * attributes.
+ * @param type the column data which column name is "type"
+ */
+ public void setType(String type) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.TYPE
+ .columnName(),
+ "setType",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, type);
+ }
+
+ /**
+ * Get the Column entity which column name is "options" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "options"
+ */
+ public Column getOptionsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OPTIONS
+ .columnName(),
+ "getOptionsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "options" to the Row entity of
+ * attributes.
+ * @param options the column data which column name is "options"
+ */
+ public void setOptions(Map<String, String> options) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OPTIONS
+ .columnName(),
+ "setOptions",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, options);
+ }
+
+ /**
+ * Get the Column entity which column name is "ingress_policing_rate" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "ingress_policing_rate"
+ */
+ public Column getIngressPolicingRateColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.INGRESSPOLICINGRATE
+ .columnName(),
+ "getIngressPolicingRateColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ingress_policing_rate" to the
+ * Row entity of attributes.
+ * @param ingressPolicingRate the column data which column name is
+ * "ingress_policing_rate"
+ */
+ public void setIngressPolicingRate(Set<Long> ingressPolicingRate) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.INGRESSPOLICINGRATE
+ .columnName(),
+ "setIngressPolicingRate",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, ingressPolicingRate);
+ }
+
+ /**
+ * Get the Column entity which column name is "ingress_policing_burst" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "ingress_policing_burst"
+ */
+ public Column getIngressPolicingBurstColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.INGRESSPOLICINGBURST
+ .columnName(),
+ "getIngressPolicingBurstColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ingress_policing_burst" to the
+ * Row entity of attributes.
+ * @param ingressPolicingBurst the column data which column name is
+ * "ingress_policing_burst"
+ */
+ public void setIngressPolicingBurst(Set<Long> ingressPolicingBurst) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.INGRESSPOLICINGBURST
+ .columnName(),
+ "setIngressPolicingBurst",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, ingressPolicingBurst);
+ }
+
+ /**
+ * Get the Column entity which column name is "mac_in_use" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "mac_in_use"
+ */
+ public Column getMacInUseColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MACINUSE
+ .columnName(),
+ "getMacInUseColumn",
+ VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "mac_in_use" to the Row entity
+ * of attributes.
+ * @param macInUse the column data which column name is "mac_in_use"
+ */
+ public void setMacInUse(Set<String> macInUse) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MACINUSE
+ .columnName(),
+ "setMacInUse",
+ VersionNum.VERSION710);
+ super.setDataHandler(columndesc, macInUse);
+ }
+
+ /**
+ * Get the Column entity which column name is "mac" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "mac"
+ */
+ public Column getMacColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MAC
+ .columnName(),
+ "getMacColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "mac" to the Row entity of
+ * attributes.
+ * @param mac the column data which column name is "mac"
+ */
+ public void setMac(Set<String> mac) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MAC
+ .columnName(),
+ "setMac",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, mac);
+ }
+
+ /**
+ * Get the Column entity which column name is "ifindex" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "ifindex"
+ */
+ public Column getIfIndexColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.IFINDEX
+ .columnName(),
+ "getIfIndexColumn",
+ VersionNum.VERSION721);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ifindex" to the Row entity of
+ * attributes.
+ * @param ifIndex the column data which column name is "ifindex"
+ */
+ public void setIfIndex(Long ifIndex) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.IFINDEX
+ .columnName(),
+ "setIfIndex",
+ VersionNum.VERSION721);
+ super.setDataHandler(columndesc, ifIndex);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.EXTERNALIDS
+ .columnName(),
+ "getExternalIdsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.EXTERNALIDS
+ .columnName(),
+ "setExternalIds",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "ofport" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "ofport"
+ */
+ public Column getOpenFlowPortColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OFPORT
+ .columnName(),
+ "getOpenFlowPortColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ofport" to the Row entity of
+ * attributes.
+ * @param openFlowPort the column data which column name is "ofport"
+ */
+ public void setOpenFlowPort(Set<Long> openFlowPort) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OFPORT
+ .columnName(),
+ "setOpenFlowPort",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, openFlowPort);
+ }
+
+ /**
+ * Get the Column entity which column name is "ofport_request" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "ofport_request"
+ */
+ public Column getOpenFlowPortRequestColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OFPORTREQUEST
+ .columnName(),
+ "getOpenFlowPortRequestColumn",
+ VersionNum.VERSION620);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ofport_request" to the Row
+ * entity of attributes.
+ * @param openFlowPortRequest the column data which column name is
+ * "ofport_request"
+ */
+ public void setOpenFlowPortRequest(String openFlowPortRequest) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OFPORTREQUEST
+ .columnName(),
+ "setOpenFlowPortRequest",
+ VersionNum.VERSION620);
+ super.setDataHandler(columndesc, openFlowPortRequest);
+ }
+
+ /**
+ * Get the Column entity which column name is "bfd" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "bfd"
+ */
+ public Column getBfdColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.BFD
+ .columnName(),
+ "getBfdColumn",
+ VersionNum.VERSION720);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bfd" to the Row entity of
+ * attributes.
+ * @param bfd the column data which column name is "bfd"
+ */
+ public void setBfd(Map<String, String> bfd) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.BFD
+ .columnName(),
+ "setBfd",
+ VersionNum.VERSION720);
+ super.setDataHandler(columndesc, bfd);
+ }
+
+ /**
+ * Get the Column entity which column name is "bfd_status" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "bfd_status"
+ */
+ public Column getBfdStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.BFDSTATUS
+ .columnName(),
+ "getBfdStatusColumn",
+ VersionNum.VERSION720);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bfd_status" to the Row entity
+ * of attributes.
+ * @param bfdStatus the column data which column name is "bfd_status"
+ */
+ public void setBfdStatus(Map<String, String> bfdStatus) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.BFDSTATUS
+ .columnName(),
+ "setBfdStatus",
+ VersionNum.VERSION720);
+ super.setDataHandler(columndesc, bfdStatus);
+ }
+
+ /**
+ * Get the Column entity which column name is "monitor" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "monitor"
+ */
+ public Column getMonitorColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MONITOR
+ .columnName(),
+ "getMonitorColumn",
+ VersionNum.VERSION100,
+ VersionNum.VERSION350);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "monitor" to the Row entity of
+ * attributes.
+ * @param monitor the column data which column name is "monitor"
+ */
+ public void setMonitor(String monitor) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MONITOR
+ .columnName(),
+ "setMonitor",
+ VersionNum.VERSION100,
+ VersionNum.VERSION350);
+ super.setDataHandler(columndesc, monitor);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_mpid" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "cfm_mpid"
+ */
+ public Column getCfmMpidColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMMPID
+ .columnName(),
+ "getCfmMpidColumn",
+ VersionNum.VERSION400);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_mpid" to the Row entity of
+ * attributes.
+ * @param cfmMpid the column data which column name is "cfm_mpid"
+ */
+ public void setCfmMpid(Set<Long> cfmMpid) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMMPID
+ .columnName(),
+ "setCfmMpid",
+ VersionNum.VERSION400);
+ super.setDataHandler(columndesc, cfmMpid);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_remote_mpid" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "cfm_remote_mpid"
+ */
+ public Column getCfmRemoteMpidColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMREMOTEMPID
+ .columnName(),
+ "getCfmRemoteMpidColumn",
+ VersionNum.VERSION400,
+ VersionNum.VERSION520);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_remote_mpid" to the Row
+ * entity of attributes.
+ * @param cfmRemoteMpid the column data which column name is
+ * "cfm_remote_mpid"
+ */
+ public void setCfmRemoteMpid(Set<Long> cfmRemoteMpid) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMREMOTEMPID
+ .columnName(),
+ "setCfmRemoteMpid",
+ VersionNum.VERSION400,
+ VersionNum.VERSION520);
+ super.setDataHandler(columndesc, cfmRemoteMpid);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_remote_mpids" from the
+ * Row entity of attributes.
+ * @return the Column entity which column name is "cfm_remote_mpids"
+ */
+ public Column getCfmRemoteMpidsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMREMOTEMPIDS
+ .columnName(),
+ "getCfmRemoteMpidsColumn",
+ VersionNum.VERSION600);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_remote_mpids" to the Row
+ * entity of attributes.
+ * @param cfmRemoteMpids the column data which column name is
+ * "cfm_remote_mpids"
+ */
+ public void setCfmRemoteMpids(Set<Long> cfmRemoteMpids) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMREMOTEMPIDS
+ .columnName(),
+ "setCfmRemoteMpids",
+ VersionNum.VERSION600);
+ super.setDataHandler(columndesc, cfmRemoteMpids);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_flap_count" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "cfm_flap_count"
+ */
+ public Column getCfmFlapCountColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMFLAPCOUNT
+ .columnName(),
+ "getCfmFlapCountColumn",
+ VersionNum.VERSION730);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_flap_count" to the Row
+ * entity of attributes.
+ * @param cfmFlapCount the column data which column name is "cfm_flap_count"
+ */
+ public void setCfmFlapCount(Set<Long> cfmFlapCount) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMFLAPCOUNT
+ .columnName(),
+ "setCfmFlapCount",
+ VersionNum.VERSION730);
+ super.setDataHandler(columndesc, cfmFlapCount);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_fault" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "cfm_fault"
+ */
+ public Column getCfmFaultColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMFAULT
+ .columnName(),
+ "getCfmFaultColumn",
+ VersionNum.VERSION400);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_fault" to the Row entity of
+ * attributes.
+ * @param cfmFault the column data which column name is "cfm_fault"
+ */
+ public void setCfmFault(Set<Boolean> cfmFault) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMFAULT
+ .columnName(),
+ "setCfmFault",
+ VersionNum.VERSION400);
+ super.setDataHandler(columndesc, cfmFault);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_fault_status" from the
+ * Row entity of attributes.
+ * @return the Column entity which column name is "cfm_fault_status"
+ */
+ public Column getCfmFaultStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMFAULTSTATUS
+ .columnName(),
+ "getCfmFaultStatusColumn",
+ VersionNum.VERSION660);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_fault_status" to the Row
+ * entity of attributes.
+ * @param cfmFaultStatus the column data which column name is
+ * "cfm_fault_status"
+ */
+ public void setCfmFaultStatus(Set<String> cfmFaultStatus) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMFAULTSTATUS
+ .columnName(),
+ "setCfmFaultStatus",
+ VersionNum.VERSION660);
+ super.setDataHandler(columndesc, cfmFaultStatus);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_remote_opstate" from the
+ * Row entity of attributes.
+ * @return the Column entity which column name is "cfm_remote_opstate"
+ */
+ public Column getCfmRemoteOpStateColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMREMOTEOPSTATE
+ .columnName(),
+ "getCfmRemoteOpStateColumn",
+ VersionNum.VERSION6100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_remote_opstate" to the Row
+ * entity of attributes.
+ * @param cfmRemoteOpState the column data which column name is
+ * "cfm_remote_opstate"
+ */
+ public void setCfmRemoteOpState(Set<String> cfmRemoteOpState) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMREMOTEOPSTATE
+ .columnName(),
+ "setCfmRemoteOpState",
+ VersionNum.VERSION6100);
+ super.setDataHandler(columndesc, cfmRemoteOpState);
+ }
+
+ /**
+ * Get the Column entity which column name is "cfm_health" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "cfm_health"
+ */
+ public Column getCfmHealthColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMHEALTH
+ .columnName(),
+ "getCfmHealthColumn",
+ VersionNum.VERSION690);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cfm_health" to the Row entity
+ * of attributes.
+ * @param cfmHealth the column data which column name is "cfm_health"
+ */
+ public void setCfmHealth(Set<Long> cfmHealth) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.CFMHEALTH
+ .columnName(),
+ "setCfmHealth",
+ VersionNum.VERSION690);
+ super.setDataHandler(columndesc, cfmHealth);
+ }
+
+ /**
+ * Get the Column entity which column name is "lacp_current" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "lacp_current"
+ */
+ public Column getLacpCurrentColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LACPCURRENT
+ .columnName(),
+ "getLacpCurrentColumn",
+ VersionNum.VERSION330);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "lacp_current" to the Row entity
+ * of attributes.
+ * @param lacpCurrent the column data which column name is "lacp_current"
+ */
+ public void setLacpCurrent(Set<Boolean> lacpCurrent) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LACPCURRENT
+ .columnName(),
+ "setLacpCurrent",
+ VersionNum.VERSION330);
+ super.setDataHandler(columndesc, lacpCurrent);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "other_config"
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OTHERCONFIG
+ .columnName(),
+ "getOtherConfigColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.OTHERCONFIG
+ .columnName(),
+ "setOtherConfig",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "statistics" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "statistics"
+ */
+ public Column getStatisticsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.STATISTICS
+ .columnName(),
+ "getStatisticsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "statistics" to the Row entity
+ * of attributes.
+ * @param statistics the column data which column name is "statistics"
+ */
+ public void setStatistics(Map<String, Long> statistics) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.STATISTICS
+ .columnName(),
+ "setStatistics",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, statistics);
+ }
+
+ /**
+ * Get the Column entity which column name is "status" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "status"
+ */
+ public Column getStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.STATUS
+ .columnName(),
+ "getStatusColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "status" to the Row entity of
+ * attributes.
+ * @param status the column data which column name is "status"
+ */
+ public void setStatus(Map<String, String> status) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.STATUS
+ .columnName(),
+ "setStatus",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, status);
+ }
+
+ /**
+ * Get the Column entity which column name is "admin_state" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "admin_state"
+ */
+ public Column getAdminStateColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.ADMINSTATE
+ .columnName(),
+ "getAdminStateColumn",
+ VersionNum.VERSION106);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "admin_state" to the Row entity
+ * of attributes.
+ * @param adminState the column data which column name is "admin_state"
+ */
+ public void setAdminState(Set<String> adminState) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.ADMINSTATE
+ .columnName(),
+ "setAdminState",
+ VersionNum.VERSION106);
+ super.setDataHandler(columndesc, adminState);
+ }
+
+ /**
+ * Get the Column entity which column name is "link_state" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "link_state"
+ */
+ public Column getLinkStateColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LINKSTATE
+ .columnName(),
+ "getLinkStateColumn",
+ VersionNum.VERSION106);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "link_state" to the Row entity
+ * of attributes.
+ * @param linkState the column data which column name is "link_state"
+ */
+ public void setLinkState(Map<String, String> linkState) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LINKSTATE
+ .columnName(),
+ "setLinkState",
+ VersionNum.VERSION106);
+ super.setDataHandler(columndesc, linkState);
+ }
+
+ /**
+ * Get the Column entity which column name is "link_resets" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "link_resets"
+ */
+ public Column getLinkResetsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LINKRESETS
+ .columnName(),
+ "getLinkResetsColumn",
+ VersionNum.VERSION620);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "link_resets" to the Row entity
+ * of attributes.
+ * @param linkResets the column data which column name is "link_resets"
+ */
+ public void setLinkResets(Set<String> linkResets) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LINKRESETS
+ .columnName(),
+ "setLinkResets",
+ VersionNum.VERSION620);
+ super.setDataHandler(columndesc, linkResets);
+ }
+
+ /**
+ * Get the Column entity which column name is "link_speed" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "link_speed"
+ */
+ public Column getLinkSpeedColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LINKSPEED
+ .columnName(),
+ "getLinkSpeedColumn",
+ VersionNum.VERSION106);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "link_speed" to the Row entity
+ * of attributes.
+ * @param linkSpeed the column data which column name is "link_speed"
+ */
+ public void setLinkSpeed(Set<Long> linkSpeed) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.LINKSPEED
+ .columnName(),
+ "setLinkSpeed",
+ VersionNum.VERSION106);
+ super.setDataHandler(columndesc, linkSpeed);
+ }
+
+ /**
+ * Get the Column entity which column name is "duplex" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "duplex"
+ */
+ public Column getDuplexColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.DUPLEX
+ .columnName(),
+ "getDuplexColumn",
+ VersionNum.VERSION106);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "duplex" to the Row entity of
+ * attributes.
+ * @param duplex the column data which column name is "duplex"
+ */
+ public void setDuplex(Set<Long> duplex) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.DUPLEX
+ .columnName(),
+ "setDuplex",
+ VersionNum.VERSION106);
+ super.setDataHandler(columndesc, duplex);
+ }
+
+ /**
+ * Get the Column entity which column name is "mtu" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "mtu"
+ */
+ public Column getMtuColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MTU
+ .columnName(),
+ "getMtuColumn",
+ VersionNum.VERSION106);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "mtu" to the Row entity of
+ * attributes.
+ * @param mtu the column data which column name is "mtu"
+ */
+ public void setMtu(Set<Long> mtu) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.MTU
+ .columnName(),
+ "setMtu",
+ VersionNum.VERSION106);
+ super.setDataHandler(columndesc, mtu);
+ }
+
+ /**
+ * Get the Column entity which column name is "error" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "error"
+ */
+ public Column getErrorColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.ERROR
+ .columnName(),
+ "getErrorColumn",
+ VersionNum.VERSION770);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "error" to the Row entity of
+ * attributes.
+ * @param error the column data which column name is "error"
+ */
+ public void setError(Set<String> error) {
+ ColumnDescription columndesc = new ColumnDescription(
+ InterfaceColumn.ERROR
+ .columnName(),
+ "setError",
+ VersionNum.VERSION770);
+ super.setDataHandler(columndesc, error);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ipfix.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ipfix.java
new file mode 100644
index 00000000..c29f2e01
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ipfix.java
@@ -0,0 +1,220 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Ipfix Table.
+ */
+public class Ipfix extends AbstractOvsdbTableService {
+ /**
+ * Ipfix table column name.
+ */
+ public enum IpfixColumn {
+ TARGETS("targets"), SAMPLING("sampling"), OBSDOMAINID("obs_domain_id"), OBSPOINTID("obs_point_id"),
+ CACHEACTIVETIMEOUT("cache_active_timeout"), EXTERNALIDS("external_ids"),
+ CACHEMAXFLOWS("cache_max_flows");
+
+ private final String columnName;
+
+ private IpfixColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for IpfixColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Ipfix object. Generate Ipfix Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Ipfix(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.IPFIX, VersionNum.VERSION710);
+ }
+
+ /**
+ * Get the Column entity which column name is "targets" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "targets"
+ */
+ public Column getTargetsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.TARGETS.columnName(),
+ "getTargetsColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "targets" to the Row entity of
+ * attributes.
+ * @param targets the column data which column name is "targets"
+ */
+ public void setTargets(Set<String> targets) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.TARGETS.columnName(),
+ "setTargets",
+ VersionNum.VERSION710);
+ super.setDataHandler(columndesc, targets);
+ }
+
+ /**
+ * Get the Column entity which column name is "sampling" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "sampling"
+ */
+ public Column getSamplingColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.SAMPLING.columnName(),
+ "getSamplingColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "sampling" to the Row entity of
+ * attributes.
+ * @param sampling the column data which column name is "sampling"
+ */
+ public void setSampling(Set<Long> sampling) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.SAMPLING.columnName(),
+ "setSampling", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, sampling);
+ }
+
+ /**
+ * Get the Column entity which column name is "obs_domain_id" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "obs_domain_id"
+ */
+ public Column getObsDomainIdColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.OBSDOMAINID.columnName(),
+ "getObsDomainIdColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "obs_domain_id" to the Row
+ * entity of attributes.
+ * @param obsdomainid the column data which column name is "obs_domain_id"
+ */
+ public void setObsDomainId(Set<Long> obsdomainid) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.OBSDOMAINID.columnName(),
+ "setObsDomainId", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, obsdomainid);
+ }
+
+ /**
+ * Get the Column entity which column name is "obs_point_id" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "obs_point_id"
+ */
+ public Column getObsPointIdColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.OBSPOINTID.columnName(),
+ "getObsPointIdColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "obs_point_id" to the Row entity
+ * of attributes.
+ * @param obsPointId the column data which column name is "obs_point_id"
+ */
+ public void setObsPointId(Set<Long> obsPointId) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.OBSPOINTID.columnName(),
+ "setObsPointId", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, obsPointId);
+ }
+
+ /**
+ * Get the Column entity which column name is "cache_active_timeout" from
+ * the Row entity of attributes.
+ * @return the Column entity which column name is "cache_active_timeout"
+ */
+ public Column getCacheActiveTimeoutColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.CACHEACTIVETIMEOUT.columnName(),
+ "getCacheActiveTimeoutColumn",
+ VersionNum.VERSION730);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cache_active_timeout" to the
+ * Row entity of attributes.
+ * @param cacheActiveTimeout the column data which column name is
+ * "cache_active_timeout"
+ */
+ public void setCacheActiveTimeout(Set<Long> cacheActiveTimeout) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.CACHEACTIVETIMEOUT.columnName(),
+ "setCacheActiveTimeout", VersionNum.VERSION730);
+ super.setDataHandler(columndesc, cacheActiveTimeout);
+ }
+
+ /**
+ * Get the Column entity which column name is "cache_max_flows" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "cache_max_flows"
+ */
+ public Column getCacheMaxFlowsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.CACHEMAXFLOWS.columnName(),
+ "getCacheMaxFlowsColumn", VersionNum.VERSION730);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cache_max_flows" to the Row
+ * entity of attributes.
+ * @param cacheMaxFlows the column data which column name is
+ * "cache_max_flows"
+ */
+ public void setCacheMaxFlows(Set<Long> cacheMaxFlows) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.CACHEMAXFLOWS.columnName(),
+ "setCacheMaxFlows", VersionNum.VERSION730);
+ super.setDataHandler(columndesc, cacheMaxFlows);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION710);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(IpfixColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION710);
+ super.setDataHandler(columndesc, externalIds);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Manager.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Manager.java
new file mode 100644
index 00000000..d0c2638f
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Manager.java
@@ -0,0 +1,243 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Manager Table.
+ */
+public class Manager extends AbstractOvsdbTableService {
+ /**
+ * Manager table column name.
+ */
+ public enum ManagerColumn {
+ TARGET("target"), ISCONNECTED("is_connected"), CONNECTIONMODE("connection_mode"),
+ EXTERNALIDS("external_ids"), STATUS("status"), INACTIVITYPROBE("inactivity_probe"),
+ OTHERCONFIG("other_config"), MAXBACKOFF("max_backoff");
+
+ private final String columnName;
+
+ private ManagerColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for ManagerColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Manager object. Generate Manager Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Manager(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.MANAGER, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "target" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "target"
+ */
+ public Column getTargetColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.TARGET.columnName(),
+ "getTargetColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "target" to the Row entity of
+ * attributes.
+ * @param target the column data which column name is "target"
+ */
+ public void setTarget(Set<String> target) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.TARGET.columnName(),
+ "setTarget",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, target);
+ }
+
+ /**
+ * Get the Column entity which column name is "is_connected" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "is_connected"
+ */
+ public Column getIsConnectedColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.ISCONNECTED.columnName(),
+ "getIsConnectedColumn", VersionNum.VERSION110);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "is_connected" to the Row entity
+ * of attributes.
+ * @param isConnected the column data which column name is "is_connected"
+ */
+ public void setIsConnected(Boolean isConnected) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.ISCONNECTED.columnName(),
+ "setIsConnected", VersionNum.VERSION110);
+ super.setDataHandler(columndesc, isConnected);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "other_config"
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.OTHERCONFIG.columnName(),
+ "getOtherConfigColumn", VersionNum.VERSION680);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.OTHERCONFIG.columnName(),
+ "setOtherConfig", VersionNum.VERSION680);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "max_backoff" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "max_backoff"
+ */
+ public Column getMaxBackoffColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.MAXBACKOFF.columnName(),
+ "getMaxBackoffColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "max_backoff" to the Row entity
+ * of attributes.
+ * @param maxBackoff the column data which column name is "max_backoff"
+ */
+ public void setMaxBackoff(Set<Long> maxBackoff) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.MAXBACKOFF.columnName(),
+ "setMaxBackoff", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, maxBackoff);
+ }
+
+ /**
+ * Get the Column entity which column name is "status" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "status"
+ */
+ public Column getStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.STATUS.columnName(),
+ "getStatusColumn", VersionNum.VERSION110);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "status" to the Row entity of
+ * attributes.
+ * @param status the column data which column name is "status"
+ */
+ public void setStatus(Map<String, String> status) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.STATUS.columnName(),
+ "setStatus",
+ VersionNum.VERSION110);
+ super.setDataHandler(columndesc, status);
+ }
+
+ /**
+ * Get the Column entity which column name is "inactivity_probe" from the
+ * Row entity of attributes.
+ * @return the Column entity which column name is "inactivity_probe"
+ */
+ public Column getInactivityProbeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.INACTIVITYPROBE.columnName(),
+ "getInactivityProbeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "inactivity_probe" to the Row
+ * entity of attributes.
+ * @param inactivityProbe the column data which column name is
+ * "inactivity_probe"
+ */
+ public void setInactivityProbe(Set<Long> inactivityProbe) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.INACTIVITYPROBE.columnName(),
+ "setInactivityProbe", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, inactivityProbe);
+ }
+
+ /**
+ * Get the Column entity which column name is "connection_mode" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "connection_mode"
+ */
+ public Column getConnectionModeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.CONNECTIONMODE.columnName(),
+ "getConnectionModeColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "connection_mode" to the Row
+ * entity of attributes.
+ * @param connectionMode the column data which column name is
+ * "connection_mode"
+ */
+ public void setConnectionMode(Set<String> connectionMode) {
+ ColumnDescription columndesc = new ColumnDescription(ManagerColumn.CONNECTIONMODE.columnName(),
+ "setConnectionMode", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, connectionMode);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Mirror.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Mirror.java
new file mode 100644
index 00000000..ec022fee
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Mirror.java
@@ -0,0 +1,277 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+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;
+
+/**
+ * This class provides operations of Mirror Table.
+ */
+public class Mirror extends AbstractOvsdbTableService {
+ /**
+ * Mirror table column name.
+ */
+ public enum MirrorColumn {
+ NAME("name"), SELECTSRCPORT("select_src_port"), SELECTDSTPORT("select_dst_port"),
+ SELECTVLAN("select_vlan"), OUTPUTPORT("output_port"), EXTERNALIDS("external_ids"),
+ OUTPUTVLAN("output_vlan"), STATISTICS("statistics"), SELECTALL("select_all");
+
+ private final String columnName;
+
+ private MirrorColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for MirrorColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Mirror object. Generate Mirror Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Mirror(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.MIRROR, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "name" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "name"
+ */
+ public Column getNameColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.NAME.columnName(),
+ "getNameColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "name" to the Row entity of
+ * attributes.
+ * @param name the column data which column name is "name"
+ */
+ public void setName(Set<String> name) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.NAME.columnName(),
+ "setName",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, name);
+ }
+
+ /**
+ * Get the column data which column name is "name" from the Row entity of
+ * attributes.
+ * @return the column data which column name is "name"
+ */
+ public Set<String> getName() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.NAME.columnName(),
+ "getName",
+ VersionNum.VERSION100);
+ return (Set<String>) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Get the Column entity which column name is "select_src_port" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "select_src_port"
+ */
+ public Column getSelectSrcPortColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTSRCPORT.columnName(),
+ "getSelectSrcPortColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "select_src_port" to the Row
+ * entity of attributes.
+ * @param selectSrcPort the column data which column name is
+ * "select_src_port"
+ */
+ public void setSelectSrcPort(Set<UUID> selectSrcPort) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTSRCPORT.columnName(),
+ "setSelectSrcPort", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, selectSrcPort);
+ }
+
+ /**
+ * Get the Column entity which column name is "select_dst_port" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "select_dst_port"
+ */
+ public Column getSelectDstPortColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTDSTPORT.columnName(),
+ "getSelectDstPortColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "select_dst_port" to the Row
+ * entity of attributes.
+ * @param selectDstPrt the column data which column name is
+ * "select_dst_port"
+ */
+ public void setSelectDstPort(Set<UUID> selectDstPrt) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTDSTPORT.columnName(),
+ "setSelectDstPort", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, selectDstPrt);
+ }
+
+ /**
+ * Get the Column entity which column name is "select_vlan" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "select_vlan"
+ */
+ public Column getSelectVlanColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTVLAN.columnName(),
+ "getSelectVlanColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "select_vlan" to the Row entity
+ * of attributes.
+ * @param selectVlan the column data which column name is "select_vlan"
+ */
+ public void setSelectVlan(Set<Long> selectVlan) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTVLAN.columnName(),
+ "setSelectVlan", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, selectVlan);
+ }
+
+ /**
+ * Get the Column entity which column name is "output_port" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "output_port"
+ */
+ public Column getOutputPortColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTPORT.columnName(),
+ "getOutputPortColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "output_port" to the Row entity
+ * of attributes.
+ * @param outputPort the column data which column name is "output_port"
+ */
+ public void setOutputPort(Set<UUID> outputPort) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTPORT.columnName(),
+ "setOutputPort", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, outputPort);
+ }
+
+ /**
+ * Get the Column entity which column name is "output_vlan" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "output_vlan"
+ */
+ public Column getOutputVlanColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTVLAN.columnName(),
+ "getOutputVlanColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "output_vlan" to the Row entity
+ * of attributes.
+ * @param outputVlan the column data which column name is "output_vlan"
+ */
+ public void setOutputVlan(Set<Long> outputVlan) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTVLAN.columnName(),
+ "setOutputVlan", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, outputVlan);
+ }
+
+ /**
+ * Get the Column entity which column name is "statistics" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "statistics"
+ */
+ public Column getStatisticsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.STATISTICS.columnName(),
+ "getStatisticsColumn", VersionNum.VERSION640);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "statistics" to the Row entity
+ * of attributes.
+ * @param statistics the column data which column name is "statistics"
+ */
+ public void setStatistics(Map<String, Long> statistics) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.STATISTICS.columnName(),
+ "setStatistics", VersionNum.VERSION640);
+ super.setDataHandler(columndesc, statistics);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "select_all" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "select_all"
+ */
+ public Column getSelectAllColumn() {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTALL.columnName(),
+ "getSelectAllColumn", VersionNum.VERSION620);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "select_all" to the Row entity
+ * of attributes.
+ * @param selectAll the column data which column name is "select_all"
+ */
+ public void setSelectAll(Boolean selectAll) {
+ ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTALL.columnName(),
+ "setSelectAll", VersionNum.VERSION620);
+ super.setDataHandler(columndesc, selectAll);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Netflow.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Netflow.java
new file mode 100644
index 00000000..98c3de55
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Netflow.java
@@ -0,0 +1,197 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Netflow Table.
+ */
+public class Netflow extends AbstractOvsdbTableService {
+ /**
+ * Netflow table column name.
+ */
+ public enum NetflowColumn {
+ TARGETS("targets"), ACTIVETIMEOUT("active_timeout"), ENGINETYPE("engine_type"),
+ EXTERNALIDS("external_ids"), ADDIDTOINTERFACE("add_id_to_interface"), ENGINEID("engine_id");
+
+ private final String columnName;
+
+ private NetflowColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for NetflowColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a NetFlow object. Generate Netflow Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Netflow(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.NETFLOW, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "targets" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getTargetsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.TARGETS.columnName(),
+ "getTargetsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "targets" to the Row entity of
+ * attributes.
+ * @param targets the column data which column name is "targets"
+ */
+ public void setTargets(Set<String> targets) {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.TARGETS.columnName(),
+ "setTargets", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, targets);
+ }
+
+ /**
+ * Get the Column entity which column name is "active_timeout" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getActiveTimeoutColumn() {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ACTIVETIMEOUT.columnName(),
+ "getActiveTimeoutColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "active_timeout" to the Row
+ * entity of attributes.
+ * @param activeTimeout the column data which column name is
+ * "active_timeout"
+ */
+ public void setActiveTimeout(Long activeTimeout) {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ACTIVETIMEOUT.columnName(),
+ "setActiveTimeout", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, activeTimeout);
+ }
+
+ /**
+ * Get the Column entity which column name is "engine_type" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getEngineTypeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ENGINETYPE.columnName(),
+ "getEngineTypeColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "engine_type" to the Row entity
+ * of attributes.
+ * @param engineType the column data which column name is "engine_type"
+ */
+ public void setEngineType(Set<Long> engineType) {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ENGINETYPE.columnName(),
+ "setEngineType", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, engineType);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "add_id_to_interface" from the
+ * Row entity of attributes.
+ * @return the Column entity
+ */
+ public Column getAddIdToInterfaceColumn() {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ADDIDTOINTERFACE.columnName(),
+ "getAddIdToInterfaceColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "add_id_to_interface" to the Row
+ * entity of attributes.
+ * @param addIdToInterface the column data which column name is
+ * "add_id_to_interface"
+ */
+ public void setAddIdToInterface(Boolean addIdToInterface) {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ADDIDTOINTERFACE.columnName(),
+ "setAddIdToInterface", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, addIdToInterface);
+ }
+
+ /**
+ * Get the Column entity which column name is "engine_id" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getEngineIdColumn() {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ENGINETYPE.columnName(),
+ "getEngineIdColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "engine_id" to the Row entity of
+ * attributes.
+ * @param engineId the column data which column name is "engine_id"
+ */
+ public void setEngineId(Set<Long> engineId) {
+ ColumnDescription columndesc = new ColumnDescription(NetflowColumn.ENGINETYPE.columnName(),
+ "setEngineId", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, engineId);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OpenVSwitch.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OpenVSwitch.java
new file mode 100644
index 00000000..73d7ca1e
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OpenVSwitch.java
@@ -0,0 +1,451 @@
+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.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;
+
+/**
+ * This class provides operations of Open_vSwitch Table.
+ */
+public class OpenVSwitch extends AbstractOvsdbTableService {
+
+ /**
+ * OpenVSwitch table column name.
+ */
+ public enum OpenVSwitchColumn {
+ BRIDGES("bridges"), MANAGERS("managers"),
+ MANAGEROPTIONS("manager_options"), SSL("ssl"),
+ OTHERCONFIG("other_config"), EXTERNALIDS("external_ids"),
+ NEXTCFG("next_cfg"), CURCFG("cur_cfg"), CAPABILITIES("capabilities"),
+ STATISTICS("statistics"), OVSVERSION("ovs_version"),
+ DBVERSION("db_version"), SYSTEMTYPE("system_type"),
+ SYSTEMVERSION("system_version");
+
+ private final String columnName;
+
+ private OpenVSwitchColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for OpenVSwitchColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a OpenVSwitch object. Generate Open_vSwitch Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public OpenVSwitch(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.OPENVSWITCH, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "bridges" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "bridges"
+ */
+ public Column getBridgesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.BRIDGES
+ .columnName(),
+ "getBridgesColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bridges" to the Row entity of
+ * attributes.
+ * @param bridges the column data which column name is "bridges"
+ */
+ public void setBridges(Set<UUID> bridges) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.BRIDGES
+ .columnName(),
+ "setBridges",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, bridges);
+ }
+
+ /**
+ * Get the Column entity which column name is "managers" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "managers"
+ */
+ public Column getManagersColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.MANAGERS
+ .columnName(),
+ "getManagersColumn",
+ VersionNum.VERSION100,
+ VersionNum.VERSION200);
+ return (Column) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "managers" to the Row entity of
+ * attributes.
+ * @param managers the column data which column name is "managers"
+ */
+ public void setManagers(Set<UUID> managers) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.MANAGERS
+ .columnName(),
+ "setManagers",
+ VersionNum.VERSION100,
+ VersionNum.VERSION200);
+ super.setDataHandler(columndesc, managers);
+ }
+
+ /**
+ * Get the Column entity which column name is "manager_options" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "manager_options"
+ */
+ public Column getManagerOptionsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.MANAGEROPTIONS
+ .columnName(),
+ "getManagerOptionsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "manager_options" to the Row
+ * entity of attributes.
+ * @param managerOptions the column data which column name is
+ * "manager_options"
+ */
+ public void setManagerOptions(Set<UUID> managerOptions) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.MANAGEROPTIONS
+ .columnName(),
+ "setManagerOptions",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, managerOptions);
+ }
+
+ /**
+ * Get the Column entity which column name is "ssl" from the Row entity of
+ * attributes.
+ * @return the Column entity which column name is "ssl"
+ */
+ public Column getSslColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.SSL
+ .columnName(),
+ "getSslColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ssl" to the Row entity of
+ * attributes.
+ * @param ssl the column data which column name is "ssl"
+ */
+ public void setSsl(Set<UUID> ssl) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.SSL
+ .columnName(),
+ "setSsl",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, ssl);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "other_config"
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.OTHERCONFIG
+ .columnName(),
+ "getOtherConfigColumn",
+ VersionNum.VERSION510);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.OTHERCONFIG
+ .columnName(),
+ "setOtherConfig",
+ VersionNum.VERSION510);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "external_ids"
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.EXTERNALIDS
+ .columnName(),
+ "getExternalIdsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.EXTERNALIDS
+ .columnName(),
+ "setExternalIds",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "next_cfg" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "next_cfg"
+ */
+ public Column getNextConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.NEXTCFG
+ .columnName(),
+ "getNextConfigColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "next_cfg" to the Row entity of
+ * attributes.
+ * @param nextConfig the column data which column name is "next_cfg"
+ */
+ public void setNextConfig(Long nextConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.NEXTCFG
+ .columnName(),
+ "setNextConfig",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, nextConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "cur_cfg" from the Row entity
+ * of attributes.
+ * @return the Column entity which column name is "cur_cfg"
+ */
+ public Column getCurrentConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.CURCFG
+ .columnName(),
+ "getCurrentConfigColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "cur_cfg" to the Row entity of
+ * attributes.
+ * @param currentConfig the column data which column name is "cur_cfg"
+ */
+ public void setCurrentConfig(Long currentConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.CURCFG
+ .columnName(),
+ "setCurrentConfig",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, currentConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "capabilities" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "capabilities"
+ */
+ public Column getCapabilitiesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.CAPABILITIES
+ .columnName(),
+ "getCapabilitiesColumn",
+ VersionNum.VERSION100,
+ VersionNum.VERSION670);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "capabilities" to the Row entity
+ * of attributes.
+ * @param capabilities the column data which column name is "capabilities"
+ */
+ public void setCapabilities(Map<String, UUID> capabilities) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.CAPABILITIES
+ .columnName(),
+ "setCapabilities",
+ VersionNum.VERSION100,
+ VersionNum.VERSION670);
+ super.setDataHandler(columndesc, capabilities);
+ }
+
+ /**
+ * Get the Column entity which column name is "statistics" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "statistics"
+ */
+ public Column getStatisticsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.STATISTICS
+ .columnName(),
+ "getStatisticsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "statistics" to the Row entity
+ * of attributes.
+ * @param statistics the column data which column name is "statistics"
+ */
+ public void setStatistics(Map<String, Long> statistics) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.STATISTICS
+ .columnName(),
+ "setStatistics",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, statistics);
+ }
+
+ /**
+ * Get the Column entity which column name is "ovs_version" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "ovs_version"
+ */
+ public Column getOvsVersionColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.OVSVERSION
+ .columnName(),
+ "getOvsVersionColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ovs_version" to the Row entity
+ * of attributes.
+ * @param ovsVersion the column data which column name is "ovs_version"
+ */
+ public void setOvsVersion(Set<String> ovsVersion) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.OVSVERSION
+ .columnName(),
+ "setOvsVersion",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, ovsVersion);
+ }
+
+ /**
+ * Get the Column entity which column name is "db_version" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "db_version"
+ */
+ public Column getDbVersionColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.DBVERSION
+ .columnName(),
+ "getDbVersionColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "db_version" to the Row entity
+ * of attributes.
+ * @param dbVersion the column data which column name is "db_version"
+ */
+ public void setDbVersion(Set<String> dbVersion) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.DBVERSION
+ .columnName(),
+ "setDbVersion",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, dbVersion);
+ }
+
+ /**
+ * Get the Column entity which column name is "system_type" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "system_type"
+ */
+ public Column getSystemTypeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.SYSTEMTYPE
+ .columnName(),
+ "getSystemTypeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "system_type" to the Row entity
+ * of attributes.
+ * @param systemType the column data which column name is "system_type"
+ */
+ public void setSystemType(Set<String> systemType) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.SYSTEMTYPE
+ .columnName(),
+ "setSystemType",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, systemType);
+ }
+
+ /**
+ * Get the Column entity which column name is "system_version" from the Row
+ * entity of attributes.
+ * @return the Column entity which column name is "system_version"
+ */
+ public Column getSystemVersionColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.SYSTEMVERSION
+ .columnName(),
+ "getSystemVersionColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "system_version" to the Row
+ * entity of attributes.
+ * @param systemVersion the column data which column name is
+ * "system_version"
+ */
+ public void setSystemVersion(Set<String> systemVersion) {
+ ColumnDescription columndesc = new ColumnDescription(
+ OpenVSwitchColumn.SYSTEMVERSION
+ .columnName(),
+ "setSystemVersion",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, systemVersion);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OvsdbTable.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OvsdbTable.java
new file mode 100644
index 00000000..2bfe2e79
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/OvsdbTable.java
@@ -0,0 +1,41 @@
+/*
+ * 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.table;
+
+/**
+ * Ovsdb table name. Refer to RFC7047's Section 9.2.
+ */
+public enum OvsdbTable {
+ INTERFACE("Interface"), BRIDGE("Bridge"), CONTROLLER("Controller"),
+ PORT("Port"), OPENVSWITCH("Open_vSwitch"), FLWTABLE("Flow_Table"),
+ QOS("Qos"), QUEUE("Queue"), MIRROR("Mirror"), MANAGER("Manager"),
+ NETFLOW("NetFlow"), SSL("SSL"), SFLOW("sFlow"), IPFIX("IPFIX"),
+ FLOWSAMPLECOLLECTORSET("Flow_Sample_Collector_Set");
+
+ private final String tableName;
+
+ private OvsdbTable(String tableName) {
+ this.tableName = tableName;
+ }
+
+ /**
+ * Returns the table name for OvsdbTable.
+ * @return the table name
+ */
+ public String tableName() {
+ return tableName;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Port.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Port.java
new file mode 100644
index 00000000..996e93ff
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Port.java
@@ -0,0 +1,575 @@
+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.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;
+
+/**
+ * This class provides operations of Port Table.
+ */
+public class Port extends AbstractOvsdbTableService {
+
+ /**
+ * Port table column name.
+ */
+ public enum PortColumn {
+ NAME("name"), INTERFACES("interfaces"), TRUNKS("trunks"), TAG("tag"),
+ VLANMODE("vlan_mode"), QOS("qos"), MAC("mac"), BONDTYPE("bond_type"),
+ BONDMODE("bond_mode"), LACP("lacp"), BONDUPDELAY("bond_updelay"),
+ BONDDOWNDELAY("bond_downdelay"), BONDFAKEIFACE("bond_fake_iface"),
+ FAKEBRIDGE("fake_bridge"), STATUS("status"), STATISTICS("statistics"),
+ OTHERCONFIG("other_config"), EXTERNALIDS("external_ids");
+
+ private final String columnName;
+
+ private PortColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for PortColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Port object. Generate Port Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Port(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.PORT, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "name" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getNameColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.NAME
+ .columnName(),
+ "getNameColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "name" to the Row entity of
+ * attributes.
+ * @param name the column data which column name is "name"
+ */
+ public void setName(String name) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.NAME
+ .columnName(),
+ "setName",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, name);
+ }
+
+ /**
+ * Get the Column entity which column name is "name" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public String getName() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.NAME
+ .columnName(),
+ "getName",
+ VersionNum.VERSION100);
+ return (String) super.getDataHandler(columndesc);
+ }
+
+ /**
+ * Get the Column entity which column name is "interfaces" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getInterfacesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.INTERFACES
+ .columnName(),
+ "getInterfacesColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "interfaces" to the Row entity
+ * of attributes.
+ * @param interfaces the column data which column name is "interfaces"
+ */
+ public void setInterfaces(Set<UUID> interfaces) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.INTERFACES
+ .columnName(),
+ "setInterfaces",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, interfaces);
+ }
+
+ /**
+ * Get the Column entity which column name is "trunks" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getTrunksColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.TRUNKS
+ .columnName(),
+ "getTrunksColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "trunks" to the Row entity of
+ * attributes.
+ * @param trunks the column data which column name is "trunks"
+ */
+ public void setTrunks(Set<Long> trunks) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.TRUNKS
+ .columnName(),
+ "setTrunks",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, trunks);
+ }
+
+ /**
+ * Get the Column entity which column name is "tag" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getTagColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.TAG
+ .columnName(),
+ "getTagColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "tag" to the Row entity of
+ * attributes.
+ * @param tag the column data which column name is "tag"
+ */
+ public void setTag(Set<Long> tag) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.TAG
+ .columnName(),
+ "setTag",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, tag);
+ }
+
+ /**
+ * Get the Column entity which column name is "vlan_mode" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getVlanModeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.VLANMODE
+ .columnName(),
+ "getVlanModeColumn",
+ VersionNum.VERSION610);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "vlan_mode" to the Row entity of
+ * attributes.
+ * @param vlanMode the column data which column name is "vlan_mode"
+ */
+ public void setVlanMode(Set<String> vlanMode) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.VLANMODE
+ .columnName(),
+ "setVlanMode",
+ VersionNum.VERSION610);
+ super.setDataHandler(columndesc, vlanMode);
+ }
+
+ /**
+ * Get the Column entity which column name is "qos" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getQosColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.QOS
+ .columnName(),
+ "getQosColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "qos" to the Row entity of
+ * attributes.
+ * @param qos the column data which column name is "qos"
+ */
+ public void setQos(Set<UUID> qos) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.QOS
+ .columnName(),
+ "setQos",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, qos);
+ }
+
+ /**
+ * Get the Column entity which column name is "mac" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getMacColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.MAC
+ .columnName(),
+ "getMacColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "mac" to the Row entity of
+ * attributes.
+ * @param mac the column data which column name is "mac"
+ */
+ public void setMac(Set<String> mac) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.MAC
+ .columnName(),
+ "setMac",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, mac);
+ }
+
+ /**
+ * Get the Column entity which column name is "bond_type" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getBondTypeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDTYPE
+ .columnName(),
+ "getBondTypeColumn",
+ VersionNum.VERSION102,
+ VersionNum.VERSION103);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bond_type" to the Row entity of
+ * attributes.
+ * @param bondtype the column data which column name is "bond_type"
+ */
+ public void setBondType(Set<String> bondtype) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDTYPE
+ .columnName(),
+ "setBondType",
+ VersionNum.VERSION102,
+ VersionNum.VERSION103);
+ super.setDataHandler(columndesc, bondtype);
+ }
+
+ /**
+ * Get the Column entity which column name is "bond_mode" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getBondModeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDMODE
+ .columnName(),
+ "getBondModeColumn",
+ VersionNum.VERSION104);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bond_mode" to the Row entity of
+ * attributes.
+ * @param bondmode the column data which column name is "bond_mode"
+ */
+ public void setBondMode(Set<String> bondmode) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDMODE
+ .columnName(),
+ "setBondMode",
+ VersionNum.VERSION104);
+ super.setDataHandler(columndesc, bondmode);
+ }
+
+ /**
+ * Get the Column entity which column name is "lacp" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getLacpColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.LACP
+ .columnName(),
+ "getLacpColumn",
+ VersionNum.VERSION130);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "lacp" to the Row entity of
+ * attributes.
+ * @param lacp the column data which column name is "lacp"
+ */
+ public void setLacp(Set<String> lacp) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.LACP
+ .columnName(),
+ "setLacp",
+ VersionNum.VERSION130);
+ super.setDataHandler(columndesc, lacp);
+ }
+
+ /**
+ * Get the Column entity which column name is "bond_updelay" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getBondUpDelayColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDUPDELAY
+ .columnName(),
+ "getBondUpDelayColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bond_updelay" to the Row entity
+ * of attributes.
+ * @param bondUpDelay the column data which column name is "bond_updelay"
+ */
+ public void setBondUpDelay(Set<Long> bondUpDelay) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDUPDELAY
+ .columnName(),
+ "setBondUpDelay",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, bondUpDelay);
+ }
+
+ /**
+ * Get the Column entity which column name is "bond_downdelay" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getBondDownDelayColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDDOWNDELAY
+ .columnName(),
+ "getBondDownDelayColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bond_downdelay" to the Row
+ * entity of attributes.
+ * @param bondDownDelay the column data which column name is
+ * "bond_downdelay"
+ */
+ public void setBondDownDelay(Set<Long> bondDownDelay) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDDOWNDELAY
+ .columnName(),
+ "setBondDownDelay",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, bondDownDelay);
+ }
+
+ /**
+ * Get the Column entity which column name is "bond_fake_iface" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getBondFakeInterfaceColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDFAKEIFACE
+ .columnName(),
+ "getBondFakeInterfaceColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bond_fake_iface" to the Row
+ * entity of attributes.
+ * @param bondFakeInterface the column data which column name is
+ * "bond_fake_iface"
+ */
+ public void setBondFakeInterface(Set<Boolean> bondFakeInterface) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.BONDFAKEIFACE
+ .columnName(),
+ "setBondFakeInterface",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, bondFakeInterface);
+ }
+
+ /**
+ * Get the Column entity which column name is "fake_bridge" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getFakeBridgeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.FAKEBRIDGE
+ .columnName(),
+ "getFakeBridgeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "fake_bridge" to the Row entity
+ * of attributes.
+ * @param fakeBridge the column data which column name is "fake_bridge"
+ */
+ public void setFakeBridge(Set<Boolean> fakeBridge) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.FAKEBRIDGE
+ .columnName(),
+ "setFakeBridge",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, fakeBridge);
+ }
+
+ /**
+ * Get the Column entity which column name is "status" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getStatusColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.STATUS
+ .columnName(),
+ "getStatusColumn",
+ VersionNum.VERSION620);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "status" to the Row entity of
+ * attributes.
+ * @param status the column data which column name is "status"
+ */
+ public void setStatus(Map<String, String> status) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.STATUS
+ .columnName(),
+ "setStatus",
+ VersionNum.VERSION620);
+ super.setDataHandler(columndesc, status);
+ }
+
+ /**
+ * Get the Column entity which column name is "statistics" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getStatisticsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.STATISTICS
+ .columnName(),
+ "getStatisticsColumn",
+ VersionNum.VERSION630);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "statistics" to the Row entity
+ * of attributes.
+ * @param statistics the column data which column name is "statistics"
+ */
+ public void setStatistics(Map<String, Long> statistics) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.STATISTICS
+ .columnName(),
+ "setStatistics",
+ VersionNum.VERSION630);
+ super.setDataHandler(columndesc, statistics);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.OTHERCONFIG
+ .columnName(),
+ "getOtherConfigColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.OTHERCONFIG
+ .columnName(),
+ "setOtherConfig",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.EXTERNALIDS
+ .columnName(),
+ "getExternalIdsColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(
+ PortColumn.EXTERNALIDS
+ .columnName(),
+ "setExternalIds",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Qos.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Qos.java
new file mode 100644
index 00000000..a40aa30c
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Qos.java
@@ -0,0 +1,149 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+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;
+
+/**
+ * This class provides operations of Qos Table.
+ */
+public class Qos extends AbstractOvsdbTableService {
+ /**
+ * Qos table column name.
+ */
+ public enum QosColumn {
+ QUEUES("queues"), TYPE("type"), OTHERCONFIG("other_config"), EXTERNALIDS("external_ids");
+
+ private final String columnName;
+
+ private QosColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for QosColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Qos object. Generate Qos Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Qos(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.QOS, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "queues" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getQueuesColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.QUEUES.columnName(),
+ "getQueuesColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "queues" to the Row entity of
+ * attributes.
+ * @param queues the column data which column name is "queues"
+ */
+ public void setQueues(Map<Long, UUID> queues) {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.QUEUES.columnName(), "setQueues",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, queues);
+ }
+
+ /**
+ * Get the Column entity which column name is "type" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getTypeColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.TYPE.columnName(), "getTypeColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "type" to the Row entity of
+ * attributes.
+ * @param type the column data which column name is "type"
+ */
+ public void setType(Set<String> type) {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.TYPE.columnName(), "setType",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, type);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.OTHERCONFIG.columnName(),
+ "getOtherConfigColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.OTHERCONFIG.columnName(),
+ "setOtherConfig", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(QosColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Queue.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Queue.java
new file mode 100644
index 00000000..a89abafc
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Queue.java
@@ -0,0 +1,126 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Queue Table.
+ */
+public class Queue extends AbstractOvsdbTableService {
+ /**
+ * Queue table column name.
+ */
+ public enum QueueColumn {
+ DSCP("dscp"), OTHERCONFIG("other_config"), EXTERNALIDS("external_ids");
+
+ private final String columnName;
+
+ private QueueColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for QueueColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Queue object. Generate Queue Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Queue(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.QUEUE, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "dscp" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getDscpColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QueueColumn.DSCP.columnName(), "getDscpColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "dscp" to the Row entity of
+ * attributes.
+ * @param dscp the column data which column name is "dscp"
+ */
+ public void setDscp(Set<Long> dscp) {
+ ColumnDescription columndesc = new ColumnDescription(QueueColumn.DSCP.columnName(), "setDscp",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, dscp);
+ }
+
+ /**
+ * Get the Column entity which column name is "other_config" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getOtherConfigColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QueueColumn.OTHERCONFIG.columnName(),
+ "getOtherConfigColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "other_config" to the Row entity
+ * of attributes.
+ * @param otherConfig the column data which column name is "other_config"
+ */
+ public void setOtherConfig(Map<String, String> otherConfig) {
+ ColumnDescription columndesc = new ColumnDescription(QueueColumn.OTHERCONFIG.columnName(),
+ "setOtherConfig", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, otherConfig);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(QueueColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(QueueColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Sflow.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Sflow.java
new file mode 100644
index 00000000..142f66e3
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Sflow.java
@@ -0,0 +1,193 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Sflow Table.
+ */
+public class Sflow extends AbstractOvsdbTableService {
+ /**
+ * Sflow table column name.
+ */
+ public enum SflowColumn {
+ TARGETS("targets"), AGENT("agent"), EXTERNALIDS("external_ids"), HAEDER("header"),
+ POLLING("polling"), SAMPLING("sampling");
+
+ private final String columnName;
+
+ private SflowColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for SflowColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Sflow object. Generate Sflow Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Sflow(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.SFLOW, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "targets" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getTargetsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.TARGETS.columnName(),
+ "getTargetsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "targets" to the Row entity of
+ * attributes.
+ * @param targets the column data which column name is "targets"
+ */
+ public void setTargets(Set<String> targets) {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.TARGETS.columnName(), "setTargets",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, targets);
+ }
+
+ /**
+ * Get the Column entity which column name is "agent" from the Row entity of
+ * attributes.
+ * @return the Column entity
+ */
+ public Column getAgentColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.AGENT.columnName(),
+ "getAgentColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "agent" to the Row entity of
+ * attributes.
+ * @param agent the column data which column name is "agent"
+ */
+ public void setAgent(Set<String> agent) {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.AGENT.columnName(), "setAgent",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, agent);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "header" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getHeaderColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.HAEDER.columnName(),
+ "getHeaderColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "header" to the Row entity of
+ * attributes.
+ * @param header the column data which column name is "header"
+ */
+ public void setHeader(Set<Long> header) {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.HAEDER.columnName(), "setHeader",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, header);
+ }
+
+ /**
+ * Get the Column entity which column name is "polling" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getPollingColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.POLLING.columnName(),
+ "getPollingColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "polling" to the Row entity of
+ * attributes.
+ * @param polling the column data which column name is "polling"
+ */
+ public void setPolling(Set<Long> polling) {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.POLLING.columnName(), "setPolling",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, polling);
+ }
+
+ /**
+ * Get the Column entity which column name is "sampling" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getSamplingColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.SAMPLING.columnName(),
+ "getSamplingColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "sampling" to the Row entity of
+ * attributes.
+ * @param sampling the column data which column name is "sampling"
+ */
+ public void setSampling(Set<Long> sampling) {
+ ColumnDescription columndesc = new ColumnDescription(SflowColumn.SAMPLING.columnName(),
+ "setSampling", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, sampling);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ssl.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ssl.java
new file mode 100644
index 00000000..188dee52
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Ssl.java
@@ -0,0 +1,172 @@
+/*
+ * 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.table;
+
+import java.util.Map;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
+import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
+
+/**
+ * This class provides operations of Ssl Table.
+ */
+public class Ssl extends AbstractOvsdbTableService {
+ /**
+ * Ssl table column name.
+ */
+ public enum SslColumn {
+ CACERT("ca_cert"), EXTERNALIDS("external_ids"), BOOTSTRAPCACERT("bootstrap_ca_cert"),
+ CERTIFICATE("certificate"), PRIVATEKEY("private_key");
+
+ private final String columnName;
+
+ private SslColumn(String columnName) {
+ this.columnName = columnName;
+ }
+
+ /**
+ * Returns the table column name for SslColumn.
+ * @return the table column name
+ */
+ public String columnName() {
+ return columnName;
+ }
+ }
+
+ /**
+ * Constructs a Ssl object. Generate Ssl Table Description.
+ * @param dbSchema DatabaseSchema
+ * @param row Row
+ */
+ public Ssl(DatabaseSchema dbSchema, Row row) {
+ super(dbSchema, row, OvsdbTable.SSL, VersionNum.VERSION100);
+ }
+
+ /**
+ * Get the Column entity which column name is "ca_cert" from the Row entity
+ * of attributes.
+ * @return the Column entity
+ */
+ public Column getCaCertColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.CACERT.columnName(),
+ "getCaCertColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "ca_cert" to the Row entity of
+ * attributes.
+ * @param caCert the column data which column name is "ca_cert"
+ */
+ public void setCaCert(String caCert) {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.CACERT.columnName(), "setCaCert",
+ VersionNum.VERSION100);
+ super.setDataHandler(columndesc, caCert);
+ }
+
+ /**
+ * Get the Column entity which column name is "external_ids" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getExternalIdsColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.EXTERNALIDS.columnName(),
+ "getExternalIdsColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "external_ids" to the Row entity
+ * of attributes.
+ * @param externalIds the column data which column name is "external_ids"
+ */
+ public void setExternalIds(Map<String, String> externalIds) {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.EXTERNALIDS.columnName(),
+ "setExternalIds", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, externalIds);
+ }
+
+ /**
+ * Get the Column entity which column name is "bootstrap_ca_cert" from the
+ * Row entity of attributes.
+ * @return the Column entity
+ */
+ public Column getBootstrapCaCertColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.BOOTSTRAPCACERT.columnName(),
+ "getBootstrapCaCertColumn",
+ VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "bootstrap_ca_cert" to the Row
+ * entity of attributes.
+ * @param bootstrapCaCert the column data which column name is
+ * "bootstrap_ca_cert"
+ */
+ public void setBootstrapCaCert(Boolean bootstrapCaCert) {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.BOOTSTRAPCACERT.columnName(),
+ "setBootstrapCaCert", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, bootstrapCaCert);
+ }
+
+ /**
+ * Get the Column entity which column name is "certificate" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getCertificateColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.CERTIFICATE.columnName(),
+ "getCertificateColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "certificate" to the Row entity
+ * of attributes.
+ * @param certificate the column data which column name is "certificate"
+ */
+ public void setCertificate(String certificate) {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.CERTIFICATE.columnName(),
+ "setCertificate", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, certificate);
+ }
+
+ /**
+ * Get the Column entity which column name is "private_key" from the Row
+ * entity of attributes.
+ * @return the Column entity
+ */
+ public Column getPrivateKeyColumn() {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.PRIVATEKEY.columnName(),
+ "getPrivateKeyColumn", VersionNum.VERSION100);
+ return (Column) super.getColumnHandler(columndesc);
+ }
+
+ /**
+ * Add a Column entity which column name is "private_key" to the Row entity
+ * of attributes.
+ * @param privatekey the column data which column name is "private_key"
+ */
+ public void setPrivateKey(String privatekey) {
+ ColumnDescription columndesc = new ColumnDescription(SslColumn.PRIVATEKEY.columnName(),
+ "setPrivateKey", VersionNum.VERSION100);
+ super.setDataHandler(columndesc, privatekey);
+ }
+}
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
new file mode 100644
index 00000000..c1ae7c79
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/TableGenerator.java
@@ -0,0 +1,102 @@
+/*
+ * 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.table;
+
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+
+/**
+ * Table generator.
+ */
+public final class TableGenerator {
+
+ /**
+ * Constructs a TableGenerator object. Utility classes should not have a
+ * public or default constructor, otherwise it will compile failed. This
+ * class should not be instantiated.
+ */
+ private TableGenerator() {
+ }
+
+ /**
+ * Create table.
+ * @param dbSchema DatabaseSchema entity
+ * @param tableName table name
+ * @return Object table entity
+ */
+ public static Object createTable(DatabaseSchema dbSchema,
+ OvsdbTable tableName) {
+ Row row = new Row();
+ return generateTable(dbSchema, row, tableName);
+ }
+
+ /**
+ * Get table from Row.
+ * @param dbSchema DatabaseSchema entity
+ * @param row Row entity
+ * @param tableName table name
+ * @return Object table entity
+ */
+ public static Object getTable(DatabaseSchema dbSchema, Row row,
+ OvsdbTable tableName) {
+ return generateTable(dbSchema, row, tableName);
+ }
+
+ /**
+ * Generate the table by table name.
+ * @param dbSchema DatabaseSchema entity
+ * @param row Row entity
+ * @param tableName table name
+ * @return Object Table entity
+ */
+ private static Object generateTable(DatabaseSchema dbSchema, Row row,
+ OvsdbTable tableName) {
+ switch (tableName) {
+ case INTERFACE:
+ return new Interface(dbSchema, row);
+ case BRIDGE:
+ return new Bridge(dbSchema, row);
+ case CONTROLLER:
+ return new Controller(dbSchema, row);
+ case OPENVSWITCH:
+ return new OpenVSwitch(dbSchema, row);
+ case PORT:
+ return new Port(dbSchema, row);
+ case FLWTABLE:
+ return new FlowTable(dbSchema, row);
+ case QOS:
+ return new Qos(dbSchema, row);
+ case QUEUE:
+ return new Queue(dbSchema, row);
+ case MIRROR:
+ return new Mirror(dbSchema, row);
+ case MANAGER:
+ return new Manager(dbSchema, row);
+ case NETFLOW:
+ return new Netflow(dbSchema, row);
+ case SSL:
+ return new Ssl(dbSchema, row);
+ case SFLOW:
+ return new Sflow(dbSchema, row);
+ case IPFIX:
+ return new Ipfix(dbSchema, row);
+ case FLOWSAMPLECOLLECTORSET:
+ return new FlowSampleCollectorSet(dbSchema, row);
+ default:
+ return null;
+ }
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/VersionNum.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/VersionNum.java
new file mode 100644
index 00000000..8b356420
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/VersionNum.java
@@ -0,0 +1,47 @@
+/*
+ * 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.table;
+
+/**
+ * The version number of tables and columns.
+ */
+public enum VersionNum {
+ VERSION100("1.0.0"), VERSION102("1.0.2"), VERSION103("1.0.3"),
+ VERSION104("1.0.4"), VERSION106("1.0.6"), VERSION110("1.1.0"),
+ VERSION130("1.3.0"), VERSION200("2.0.0"), VERSION300("3.0.0"),
+ VERSION330("3.3.0"), VERSION350("3.5.0"), VERSION400("4.0.0"),
+ VERSION510("5.1.0"), VERSION520("5.2.0"), VERSION600("6.0.0"),
+ VERSION610("6.1.0"), VERSION620("6.2.0"), VERSION630("6.3.0"),
+ VERSION640("6.4.0"), VERSION650("6.5.0"), VERSION660("6.6.0"),
+ VERSION670("6.7.0"), VERSION680("6.8.0"), VERSION690("6.9.0"),
+ VERSION6100("6.10.0"), VERSION6111("6.11.1"), VERSION710("7.1.0"),
+ VERSION720("7.2.0"), VERSION721("7.2.1"), VERSION730("7.3.0"),
+ VERSION740("7.4.0"), VERSION750("7.5.0"), VERSION770("7.7.0");
+
+ private final String versionNum;
+
+ private VersionNum(String versionNum) {
+ this.versionNum = versionNum;
+ }
+
+ /**
+ * Returns the version number for VersionNum.
+ * @return the version number
+ */
+ public String versionNum() {
+ return versionNum;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java
new file mode 100644
index 00000000..6b7c7971
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java
@@ -0,0 +1,284 @@
+/*
+ * 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.tableservice;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.ovsdb.rfc.exception.ColumnSchemaNotFoundException;
+import org.onosproject.ovsdb.rfc.exception.TableSchemaNotFoundException;
+import org.onosproject.ovsdb.rfc.exception.VersionMismatchException;
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+import org.onosproject.ovsdb.rfc.schema.ColumnSchema;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+import org.onosproject.ovsdb.rfc.table.OvsdbTable;
+import org.onosproject.ovsdb.rfc.table.VersionNum;
+import org.onosproject.ovsdb.rfc.utils.VersionUtil;
+
+/**
+ * Representation of conversion between Ovsdb table and Row.
+ */
+public abstract class AbstractOvsdbTableService implements OvsdbTableService {
+
+ private final DatabaseSchema dbSchema;
+ private final Row row;
+ private final TableDescription tableDesc;
+
+ /**
+ * Constructs a AbstractOvsdbTableService object.
+ * @param dbSchema DatabaseSchema entity
+ * @param row Row entity
+ * @param table table name
+ * @param formVersion the initial version
+ */
+ public AbstractOvsdbTableService(DatabaseSchema dbSchema, Row row, OvsdbTable table,
+ VersionNum formVersion) {
+ checkNotNull(dbSchema, "database schema cannot be null");
+ checkNotNull(row, "row cannot be null");
+ checkNotNull(table, "table cannot be null");
+ checkNotNull(formVersion, "the initial version cannot be null");
+ this.dbSchema = dbSchema;
+ row.setTableName(table.tableName());
+ this.row = row;
+ TableDescription tableDesc = new TableDescription(table, formVersion);
+ this.tableDesc = tableDesc;
+ }
+
+ /**
+ * Check whether the parameter of dbSchema is valid and check whether the
+ * table is existent in Database Schema.
+ */
+ private boolean isValid() {
+ if (dbSchema == null) {
+ return false;
+ }
+ if (!dbSchema.name().equalsIgnoreCase(tableDesc.database())) {
+ return false;
+ }
+ checkTableSchemaVersion();
+ return true;
+ }
+
+ /**
+ * Check the table version.
+ */
+ private void checkTableSchemaVersion() {
+ String fromVersion = tableDesc.fromVersion();
+ String untilVersion = tableDesc.untilVersion();
+ String schemaVersion = dbSchema.version();
+ checkVersion(schemaVersion, fromVersion, untilVersion);
+ }
+
+ /**
+ * Check the column version.
+ * @param columnDesc ColumnDescription entity
+ */
+ private void checkColumnSchemaVersion(ColumnDescription columnDesc) {
+ String fromVersion = columnDesc.fromVersion();
+ String untilVersion = columnDesc.untilVersion();
+ String schemaVersion = dbSchema.version();
+ checkVersion(schemaVersion, fromVersion, untilVersion);
+ }
+
+ /**
+ * Check whether the DatabaseSchema version between the initial version and
+ * the end of the version.
+ * @param schemaVersion DatabaseSchema version
+ * @param fromVersion The initial version
+ * @param untilVersion The end of the version
+ * @throws VersionMismatchException this is a version mismatch exception
+ */
+ private void checkVersion(String schemaVersion, String fromVersion, String untilVersion) {
+ VersionUtil.versionMatch(fromVersion);
+ VersionUtil.versionMatch(untilVersion);
+ if (!fromVersion.equals(VersionUtil.DEFAULT_VERSION_STRING)) {
+ if (VersionUtil.versionCompare(schemaVersion, fromVersion) < 0) {
+ String message = VersionMismatchException.createFromMessage(schemaVersion,
+ fromVersion);
+ throw new VersionMismatchException(message);
+ }
+ }
+ if (!untilVersion.equals(VersionUtil.DEFAULT_VERSION_STRING)) {
+ if (VersionUtil.versionCompare(untilVersion, schemaVersion) < 0) {
+ String message = VersionMismatchException.createToMessage(schemaVersion,
+ untilVersion);
+ throw new VersionMismatchException(message);
+ }
+ }
+ }
+
+ /**
+ * Returns TableSchema from dbSchema by table name.
+ * @return TableSchema
+ */
+ private TableSchema getTableSchema() {
+ String tableName = tableDesc.name();
+ return dbSchema.getTableSchema(tableName);
+ }
+
+ /**
+ * Returns ColumnSchema from TableSchema by column name.
+ * @param columnName column name
+ * @return ColumnSchema
+ */
+ private ColumnSchema getColumnSchema(String columnName) {
+ TableSchema tableSchema = getTableSchema();
+ if (tableSchema == null) {
+ String message = TableSchemaNotFoundException.createMessage(tableDesc.name(),
+ dbSchema.name());
+ throw new TableSchemaNotFoundException(message);
+ }
+ ColumnSchema columnSchema = tableSchema.getColumnSchema(columnName);
+ if (columnSchema == null) {
+ String message = ColumnSchemaNotFoundException.createMessage(columnName,
+ tableSchema.name());
+ throw new ColumnSchemaNotFoundException(message);
+ }
+ return columnSchema;
+ }
+
+ @Override
+ public Column getColumnHandler(ColumnDescription columnDesc) {
+ if (!isValid()) {
+ return null;
+ }
+ String columnName = columnDesc.name();
+ checkColumnSchemaVersion(columnDesc);
+ ColumnSchema columnSchema = getColumnSchema(columnName);
+ if (row == null) {
+ return null;
+ }
+ return row.getColumn(columnSchema.name());
+ }
+
+ @Override
+ public Object getDataHandler(ColumnDescription columnDesc) {
+ if (!isValid()) {
+ return null;
+ }
+ String columnName = columnDesc.name();
+ checkColumnSchemaVersion(columnDesc);
+ ColumnSchema columnSchema = getColumnSchema(columnName);
+ if (row == null || row.getColumn(columnSchema.name()) == null) {
+ return null;
+ }
+ return row.getColumn(columnSchema.name()).data();
+ }
+
+ @Override
+ public void setDataHandler(ColumnDescription columnDesc, Object obj) {
+ if (!isValid()) {
+ return;
+ }
+ String columnName = columnDesc.name();
+ checkColumnSchemaVersion(columnDesc);
+ ColumnSchema columnSchema = getColumnSchema(columnName);
+ Column column = new Column(columnSchema.name(), obj);
+ row.addColumn(columnName, column);
+ }
+
+ @Override
+ public UUID getTableUuid() {
+ if (!isValid()) {
+ return null;
+ }
+ ColumnDescription columnDesc = new ColumnDescription("_uuid", "getTableUuid");
+ return (UUID) getDataHandler(columnDesc);
+ }
+
+ @Override
+ public Column getTableUuidColumn() {
+ if (!isValid()) {
+ return null;
+ }
+ ColumnDescription columnDesc = new ColumnDescription("_uuid", "getTableUuidColumn");
+ return (Column) getColumnHandler(columnDesc);
+ }
+
+ @Override
+ public UUID getTableVersion() {
+ if (!isValid()) {
+ return null;
+ }
+ ColumnDescription columnDesc = new ColumnDescription("_version", "getTableVersion");
+ return (UUID) getDataHandler(columnDesc);
+ }
+
+ @Override
+ public Column getTableVersionColumn() {
+ if (!isValid()) {
+ return null;
+ }
+ ColumnDescription columnDesc = new ColumnDescription("_version", "getTableVersionColumn");
+ return (Column) getColumnHandler(columnDesc);
+ }
+
+ /**
+ * Get DatabaseSchema entity.
+ * @return DatabaseSchema entity
+ */
+ public DatabaseSchema dbSchema() {
+ return dbSchema;
+ }
+
+ /**
+ * Get Row entity.
+ * @return Row entity
+ */
+ public Row getRow() {
+ if (!isValid()) {
+ return null;
+ }
+ return this.row;
+ }
+
+ /**
+ * Get TableDescription entity.
+ * @return TableDescription entity
+ */
+ public TableDescription tableDesc() {
+ return tableDesc;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(row);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof AbstractOvsdbTableService) {
+ final AbstractOvsdbTableService other = (AbstractOvsdbTableService) obj;
+ return Objects.equals(this.row, other.row);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ TableSchema schema = (TableSchema) getTableSchema();
+ String tableName = schema.name();
+ return toStringHelper(this).add("tableName", tableName).add("row", row).toString();
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/ColumnDescription.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/ColumnDescription.java
new file mode 100644
index 00000000..910b3296
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/ColumnDescription.java
@@ -0,0 +1,117 @@
+/*
+ * 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.tableservice;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.onosproject.ovsdb.rfc.table.VersionNum;
+import org.onosproject.ovsdb.rfc.utils.VersionUtil;
+
+/**
+ * Column description.
+ */
+public class ColumnDescription {
+
+ // The column name
+ private final String name;
+ // The method name
+ private final String method;
+ // The initial version
+ private final String fromVersion;
+ // The end of the version
+ private final String untilVersion;
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param name column name
+ * @param method method name
+ */
+ public ColumnDescription(String name, String method) {
+ checkNotNull(name, "name cannot be null");
+ checkNotNull(method, "method cannot be null");
+ this.name = name;
+ this.method = method;
+ this.fromVersion = VersionUtil.DEFAULT_VERSION_STRING;
+ this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING;
+ }
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param name column name
+ * @param method method name
+ * @param fromVersion the initial version
+ */
+ public ColumnDescription(String name, String method, VersionNum fromVersion) {
+ checkNotNull(name, "name cannot be null");
+ checkNotNull(method, "method cannot be null");
+ checkNotNull(fromVersion, "the initial version cannot be null");
+ this.name = name;
+ this.method = method;
+ this.fromVersion = fromVersion.versionNum();
+ this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING;
+ }
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param name column name
+ * @param method method name
+ * @param fromVersion the initial version
+ * @param untilVersion the end of the version
+ */
+ public ColumnDescription(String name, String method, VersionNum fromVersion,
+ VersionNum untilVersion) {
+ checkNotNull(name, "name cannot be null");
+ checkNotNull(method, "method cannot be null");
+ checkNotNull(fromVersion, "the initial version cannot be null");
+ checkNotNull(untilVersion, "the end of the version cannot be null");
+ this.name = name;
+ this.method = method;
+ this.fromVersion = fromVersion.versionNum();
+ this.untilVersion = untilVersion.versionNum();
+ }
+
+ /**
+ * Returns the column name.
+ * @return the column name
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns the method name.
+ * @return the method name
+ */
+ public String method() {
+ return method;
+ }
+
+ /**
+ * Returns the initial version.
+ * @return the initial version
+ */
+ public String fromVersion() {
+ return fromVersion;
+ }
+
+ /**
+ * Returns the end of the version.
+ * @return the end of the version
+ */
+ public String untilVersion() {
+ return untilVersion;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/OvsdbTableService.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/OvsdbTableService.java
new file mode 100644
index 00000000..58b656ef
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/OvsdbTableService.java
@@ -0,0 +1,70 @@
+/*
+ * 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.tableservice;
+
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+
+/**
+ * Representation of conversion between Ovsdb table and Row.
+ */
+public interface OvsdbTableService {
+
+ /**
+ * Get Column from row.
+ * @param columndesc Column description
+ * @return Column
+ */
+ public Column getColumnHandler(ColumnDescription columndesc);
+
+ /**
+ * Get Data from row.
+ * @param columndesc Column description
+ * @return Object column data
+ */
+ public Object getDataHandler(ColumnDescription columndesc);
+
+ /**
+ * Set column data of row.
+ * @param columndesc Column description
+ * @param obj column data
+ */
+ public void setDataHandler(ColumnDescription columndesc, Object obj);
+
+ /**
+ * Returns UUID which column name is _uuid.
+ * @return UUID
+ */
+ public UUID getTableUuid();
+
+ /**
+ * Returns UUID Column which column name is _uuid.
+ * @return UUID Column
+ */
+ public Column getTableUuidColumn();
+
+ /**
+ * Returns UUID which column name is _version.
+ * @return UUID
+ */
+ public UUID getTableVersion();
+
+ /**
+ * Returns UUID Column which column name is _version.
+ * @return UUID Column
+ */
+ public Column getTableVersionColumn();
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/TableDescription.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/TableDescription.java
new file mode 100644
index 00000000..d120cab8
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/TableDescription.java
@@ -0,0 +1,108 @@
+/*
+ * 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.tableservice;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.onosproject.ovsdb.rfc.table.OvsdbTable;
+import org.onosproject.ovsdb.rfc.table.VersionNum;
+import org.onosproject.ovsdb.rfc.utils.VersionUtil;
+
+/**
+ * Table description.
+ */
+public class TableDescription {
+
+ // The table name
+ private final String name;
+ // The database name
+ private final String database = "Open_vSwitch";
+ // The initial version
+ private final String fromVersion;
+ // The end of the version
+ private final String untilVersion;
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param table OvsdbTable entity
+ */
+ public TableDescription(OvsdbTable table) {
+ checkNotNull(table, "table cannot be null");
+ this.name = table.tableName();
+ this.fromVersion = VersionUtil.DEFAULT_VERSION_STRING;
+ this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING;
+ }
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param table OvsdbTable entity
+ * @param fromVersion the initial version
+ */
+ public TableDescription(OvsdbTable table, VersionNum fromVersion) {
+ checkNotNull(table, "table cannot be null");
+ checkNotNull(fromVersion, "the initial version cannot be null");
+ this.name = table.tableName();
+ this.fromVersion = fromVersion.versionNum();
+ this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING;
+ }
+
+ /**
+ * Constructs a MonitorRequest object.
+ * @param table OvsdbTable entity
+ * @param fromVersion the initial version
+ * @param untilVersion the end of the version
+ */
+ public TableDescription(OvsdbTable table, VersionNum fromVersion, VersionNum untilVersion) {
+ checkNotNull(table, "table cannot be null");
+ checkNotNull(fromVersion, "the initial version cannot be null");
+ checkNotNull(untilVersion, "the end of the version cannot be null");
+ this.name = table.tableName();
+ this.fromVersion = fromVersion.versionNum();
+ this.untilVersion = untilVersion.versionNum();
+ }
+
+ /**
+ * Returns the column name.
+ * @return the column name
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns the database name.
+ * @return the database name
+ */
+ public String database() {
+ return database;
+ }
+
+ /**
+ * Returns the initial version.
+ * @return the initial version
+ */
+ public String fromVersion() {
+ return fromVersion;
+ }
+
+ /**
+ * Returns the end of the version.
+ * @return the end of the version
+ */
+ public String untilVersion() {
+ return untilVersion;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ConditionUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ConditionUtil.java
new file mode 100644
index 00000000..527b8bfe
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ConditionUtil.java
@@ -0,0 +1,122 @@
+/*
+ * 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.utils;
+
+import org.onosproject.ovsdb.rfc.notation.Condition;
+import org.onosproject.ovsdb.rfc.notation.Condition.Function;
+
+/**
+ * Condition utility class.
+ */
+public final class ConditionUtil {
+
+ /**
+ * Constructs a ConditionUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully. This
+ * class should not be instantiated.
+ */
+ private ConditionUtil() {
+ }
+
+ /**
+ * Returns a Condition that means Function.EQUALS .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition equals(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.EQUALS, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.NOT_EQUALS .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition unEquals(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.NOT_EQUALS, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.GREATER_THAN .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition greaterThan(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.GREATER_THAN, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.GREATER_THAN_OR_EQUALS .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition greaterThanOrEquals(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.GREATER_THAN_OR_EQUALS, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.LESS_THAN .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition lesserThan(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.LESS_THAN, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.LESS_THAN_OR_EQUALS .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition lesserThanOrEquals(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.LESS_THAN_OR_EQUALS, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.INCLUDES .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition includes(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.INCLUDES, value);
+ }
+
+ /**
+ * Returns a Condition that means Function.EXCLUDES .
+ * @param columnName column name
+ * @param data column value
+ * @return Condition
+ */
+ public static Condition excludes(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Condition(columnName, Function.EXCLUDES, value);
+ }
+
+}
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
new file mode 100644
index 00000000..9744fb49
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/FromJsonUtil.java
@@ -0,0 +1,320 @@
+/*
+ * 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.utils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.onosproject.ovsdb.rfc.exception.AbnormalJsonNodeException;
+import org.onosproject.ovsdb.rfc.exception.UnsupportedException;
+import org.onosproject.ovsdb.rfc.jsonrpc.Callback;
+import org.onosproject.ovsdb.rfc.jsonrpc.JsonRpcResponse;
+import org.onosproject.ovsdb.rfc.message.OperationResult;
+import org.onosproject.ovsdb.rfc.message.RowUpdate;
+import org.onosproject.ovsdb.rfc.message.TableUpdate;
+import org.onosproject.ovsdb.rfc.message.TableUpdates;
+import org.onosproject.ovsdb.rfc.message.UpdateNotification;
+import org.onosproject.ovsdb.rfc.notation.Column;
+import org.onosproject.ovsdb.rfc.notation.Row;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+import org.onosproject.ovsdb.rfc.operations.Operation;
+import org.onosproject.ovsdb.rfc.schema.ColumnSchema;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+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;
+
+/**
+ * JsonNode utility class. convert JsonNode into Object.
+ */
+public final class FromJsonUtil {
+
+ private static final Logger log = LoggerFactory.getLogger(FromJsonUtil.class);
+
+ /**
+ * Constructs a FromJsonUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully.
+ * This class should not be instantiated.
+ */
+ private FromJsonUtil() {
+ }
+
+ /**
+ * Verify whether the jsonNode is normal.
+ * @param jsonNode JsonNode
+ * @param nodeStr the node name of JsonNode
+ */
+ private static void validateJsonNode(JsonNode jsonNode, String nodeStr) {
+ if (!jsonNode.isObject() || !jsonNode.has(nodeStr)) {
+ String message = "Abnormal DatabaseSchema JsonNode, it should contain " + nodeStr
+ + " node but was not found";
+ throw new AbnormalJsonNodeException(message);
+ }
+ }
+
+ /**
+ * convert JsonNode into DatabaseSchema.
+ * @param dbName database name
+ * @param dbJson the JsonNode of get_schema result
+ * @return DatabaseSchema
+ * @throws AbnormalJsonNodeException this is an abnormal JsonNode exception
+ */
+ public static DatabaseSchema jsonNodeToDbSchema(String dbName, JsonNode dbJson) {
+ validateJsonNode(dbJson, "tables");
+ validateJsonNode(dbJson, "version");
+ String dbVersion = dbJson.get("version").asText();
+ Map<String, TableSchema> tables = new HashMap<>();
+ Iterator<Map.Entry<String, JsonNode>> tablesIter = dbJson.get("tables").fields();
+ while (tablesIter.hasNext()) {
+ Map.Entry<String, JsonNode> table = tablesIter.next();
+ tables.put(table.getKey(), jsonNodeToTableSchema(table.getKey(), table.getValue()));
+ }
+ return new DatabaseSchema(dbName, dbVersion, tables);
+ }
+
+ /**
+ * convert JsonNode into TableSchema.
+ * @param tableName table name
+ * @param tableJson table JsonNode
+ * @return TableSchema
+ * @throws AbnormalJsonNodeException this is an abnormal JsonNode exception
+ */
+ private static TableSchema jsonNodeToTableSchema(String tableName, JsonNode tableJson) {
+ validateJsonNode(tableJson, "columns");
+ Map<String, ColumnSchema> columns = new HashMap<>();
+ Iterator<Map.Entry<String, JsonNode>> columnsIter = tableJson.get("columns").fields();
+ while (columnsIter.hasNext()) {
+ Map.Entry<String, JsonNode> column = columnsIter.next();
+ columns.put(column.getKey(), jsonNodeToColumnSchema(column.getKey(), column.getValue()));
+ }
+ return new TableSchema(tableName, columns);
+ }
+
+ /**
+ * convert JsonNode into ColumnSchema.
+ * @param name column name
+ * @param columnJson column JsonNode
+ * @return ColumnSchema
+ * @throws AbnormalJsonNodeException this is an abnormal JsonNode exception
+ */
+ private static ColumnSchema jsonNodeToColumnSchema(String name, JsonNode columnJson) {
+ validateJsonNode(columnJson, "type");
+ return new ColumnSchema(name, ColumnTypeFactory.getColumnTypeFromJson(columnJson
+ .get("type")));
+ }
+
+ /**
+ * convert JsonNode into the returnType of methods in OvsdbRPC class.
+ * @param resultJsonNode the result JsonNode
+ * @param methodName the method name of methods in OvsdbRPC class
+ * @param objectMapper ObjectMapper entity
+ * @return Object
+ * @throws UnsupportedException this is an unsupported exception
+ */
+ private static Object convertResultType(JsonNode resultJsonNode, String methodName,
+ ObjectMapper objectMapper) {
+ switch (methodName) {
+ case "getSchema":
+ case "monitor":
+ return resultJsonNode;
+ case "echo":
+ case "listDbs":
+ return objectMapper.convertValue(resultJsonNode, objectMapper.getTypeFactory()
+ .constructParametricType(List.class, String.class));
+ case "transact":
+ return objectMapper.convertValue(resultJsonNode, objectMapper.getTypeFactory()
+ .constructParametricType(List.class, JsonNode.class));
+ default:
+ throw new UnsupportedException("does not support this rpc method" + methodName);
+ }
+ }
+
+ /**
+ * convert JsonNode into the returnType of methods in OvsdbRPC class.
+ * @param jsonNode the result JsonNode
+ * @param methodName the method name of methods in OvsdbRPC class
+ * @return Object
+ */
+ public static Object jsonResultParser(JsonNode jsonNode, String methodName) {
+ ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper();
+ JsonNode error = jsonNode.get("error");
+ if (error != null && !error.isNull()) {
+ log.error("jsonRpcResponse error : {}", error.toString());
+ }
+ JsonNode resultJsonNode = jsonNode.get("result");
+ Object result = convertResultType(resultJsonNode, methodName, objectMapper);
+ return result;
+ }
+
+ /**
+ * When monitor the ovsdb tables, if a table update, ovs send update
+ * notification, then call callback function.
+ * @param jsonNode the result JsonNode
+ * @param callback the callback function
+ * @throws UnsupportedException this is an unsupported exception
+ */
+ public static void jsonCallbackRequestParser(JsonNode jsonNode, Callback callback) {
+ ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper();
+ JsonNode params = jsonNode.get("params");
+ Object param = null;
+ String methodName = jsonNode.get("method").asText();
+ switch (methodName) {
+ case "update":
+ param = objectMapper.convertValue(params, UpdateNotification.class);
+ callback.update((UpdateNotification) param);
+ break;
+ default:
+ throw new UnsupportedException("does not support this callback method: " + methodName);
+ }
+ }
+
+ /**
+ * Ovs send echo request to keep the heart, need we return echo result.
+ * @param jsonNode the result JsonNode
+ * @return JsonRpcResponse String
+ */
+ public static String getEchoRequestStr(JsonNode jsonNode) {
+ ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper();
+ String str = null;
+ if (jsonNode.get("method").asText().equals("echo")) {
+ JsonRpcResponse response = new JsonRpcResponse(jsonNode.get("id").asText());
+ try {
+ str = objectMapper.writeValueAsString(response);
+ } catch (JsonProcessingException e) {
+ log.error("JsonProcessingException while converting JsonNode into string: ", e);
+ }
+ }
+ return str;
+ }
+
+ /**
+ * Convert the List of Operation result into List of OperationResult .
+ * @param input the List of JsonNode
+ * @param operations the List of Operation
+ * @return the List of OperationResult
+ */
+ public static List<OperationResult> jsonNodeToOperationResult(List<JsonNode> input,
+ List<Operation> operations) {
+ ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper(false);
+ List<OperationResult> operationResults = new ArrayList<OperationResult>();
+ for (int i = 0; i < input.size(); i++) {
+ JsonNode jsonNode = input.get(i);
+ Operation operation = operations.get(i);
+ if (jsonNode != null && jsonNode.size() > 0) {
+ if (i >= operations.size() || operation.getOp() != "select") {
+ OperationResult or = objectMapper.convertValue(jsonNode, OperationResult.class);
+ operationResults.add(or);
+ } else {
+ List<Row> rows = createRows(operation.getTableSchema(), jsonNode);
+ OperationResult or = new OperationResult(rows);
+ operationResults.add(or);
+ }
+ }
+ }
+ return operationResults;
+ }
+
+ /**
+ * Convert Operation JsonNode into Rows.
+ * @param tableSchema TableSchema entity
+ * @param rowsNode JsonNode
+ * @return ArrayList<Row> the List of Row
+ */
+ private static ArrayList<Row> createRows(TableSchema tableSchema, JsonNode rowsNode) {
+ validateJsonNode(rowsNode, "rows");
+ ArrayList<Row> rows = Lists.newArrayList();
+ for (JsonNode rowNode : rowsNode.get("rows")) {
+ rows.add(createRow(tableSchema, rowNode));
+ }
+ return rows;
+ }
+
+ /**
+ * convert the params of Update Notification into TableUpdates.
+ * @param updatesJson the params of Update Notification
+ * @param dbSchema DatabaseSchema entity
+ * @return TableUpdates
+ */
+ public static TableUpdates jsonNodeToTableUpdates(JsonNode updatesJson, DatabaseSchema dbSchema) {
+ Map<String, TableUpdate> tableUpdateMap = Maps.newHashMap();
+ Iterator<Map.Entry<String, JsonNode>> tableUpdatesItr = updatesJson.fields();
+ while (tableUpdatesItr.hasNext()) {
+ Map.Entry<String, JsonNode> entry = tableUpdatesItr.next();
+ TableSchema tableSchema = dbSchema.getTableSchema(entry.getKey());
+ TableUpdate tableUpdate = jsonNodeToTableUpdate(tableSchema, entry.getValue());
+ tableUpdateMap.put(entry.getKey(), tableUpdate);
+ }
+ return TableUpdates.tableUpdates(tableUpdateMap);
+ }
+
+ /**
+ * convert the params of Update Notification into TableUpdate.
+ * @param tableSchema TableSchema entity
+ * @param updateJson the table-update in params of Update Notification
+ * @return TableUpdate
+ */
+ public static TableUpdate jsonNodeToTableUpdate(TableSchema tableSchema, JsonNode updateJson) {
+ Map<UUID, RowUpdate> rows = Maps.newHashMap();
+ Iterator<Map.Entry<String, JsonNode>> tableUpdateItr = updateJson.fields();
+ while (tableUpdateItr.hasNext()) {
+ Map.Entry<String, JsonNode> oldNewRow = tableUpdateItr.next();
+ String uuidStr = oldNewRow.getKey();
+ 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;
+ RowUpdate rowUpdate = new RowUpdate(uuid, oldRow, newRow);
+ rows.put(uuid, rowUpdate);
+ }
+ return TableUpdate.tableUpdate(rows);
+ }
+
+ /**
+ * Convert Operation JsonNode into Row.
+ * @param tableSchema TableSchema entity
+ * @param rowNode JsonNode
+ * @return Row
+ */
+ private static Row createRow(TableSchema tableSchema, JsonNode rowNode) {
+ if (tableSchema == null) {
+ return null;
+ }
+ Map<String, Column> columns = Maps.newHashMap();
+ Iterator<Map.Entry<String, JsonNode>> rowIter = rowNode.fields();
+ while (rowIter.hasNext()) {
+ Map.Entry<String, JsonNode> next = rowIter.next();
+ ColumnSchema columnSchema = tableSchema.getColumnSchema(next.getKey());
+ if (columnSchema != null) {
+ String columnName = columnSchema.name();
+ Object obj = TransValueUtil.getValueFromJson(next.getValue(), columnSchema.type());
+ columns.put(columnName, new Column(columnName, obj));
+ }
+ }
+ return new Row(tableSchema.name(), columns);
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcReaderUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcReaderUtil.java
new file mode 100644
index 00000000..2a88199d
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcReaderUtil.java
@@ -0,0 +1,165 @@
+/*
+ * 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.utils;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufInputStream;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Stack;
+
+import org.onosproject.ovsdb.rfc.exception.UnsupportedException;
+import org.onosproject.ovsdb.rfc.jsonrpc.JsonReadContext;
+
+import com.fasterxml.jackson.core.JsonEncoding;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.io.IOContext;
+import com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper;
+import com.fasterxml.jackson.core.util.BufferRecycler;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.MappingJsonFactory;
+
+/**
+ * Decoder utility class.
+ */
+public final class JsonRpcReaderUtil {
+
+ /**
+ * Constructs a JsonRpcReaderUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully.
+ * This class should not be instantiated.
+ */
+ private JsonRpcReaderUtil() {
+ }
+
+ /**
+ * Decode the bytes to Json object.
+ * @param in input of bytes
+ * @param out ouput of Json object list
+ * @param jrContext context for the last decoding process
+ * @throws IOException IOException
+ * @throws JsonParseException JsonParseException
+ */
+ public static void readToJsonNode(ByteBuf in, List<Object> out, JsonReadContext jrContext)
+ throws JsonParseException, IOException {
+ int lastReadBytes = jrContext.getLastReadBytes();
+ if (lastReadBytes == 0) {
+ if (in.readableBytes() < 4) {
+ return;
+ }
+ checkEncoding(in);
+ }
+
+ int i = lastReadBytes + in.readerIndex();
+ Stack<Byte> bufStack = jrContext.getBufStack();
+ for (; i < in.writerIndex(); i++) {
+ byte b = in.getByte(i);
+ switch (b) {
+ case '{':
+ if (!isDoubleQuote(bufStack)) {
+ bufStack.push(b);
+ jrContext.setStartMatch(true);
+ }
+ break;
+ case '}':
+ if (!isDoubleQuote(bufStack)) {
+ bufStack.pop();
+ }
+ break;
+ case '"':
+ if (in.getByte(i - 1) != '\\') {
+ if (!bufStack.isEmpty() && bufStack.peek() != '"') {
+ bufStack.push(b);
+ } else {
+ bufStack.pop();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (jrContext.isStartMatch() && bufStack.isEmpty()) {
+ ByteBuf buf = in.readSlice(i - in.readerIndex() + 1);
+ JsonParser jf = new MappingJsonFactory().createParser(new ByteBufInputStream(buf));
+ JsonNode jsonNode = jf.readValueAsTree();
+ out.add(jsonNode);
+ lastReadBytes = 0;
+ jrContext.setLastReadBytes(lastReadBytes);
+ break;
+ }
+ }
+
+ if (i >= in.writerIndex()) {
+ lastReadBytes = in.readableBytes();
+ jrContext.setLastReadBytes(lastReadBytes);
+ }
+ }
+
+ /**
+ * Filter the invalid characters before decoding.
+ * @param in input of bytes
+ * @param lastReadBytes the bytes for last decoding incomplete record
+ */
+ private static void fliterCharaters(ByteBuf in) {
+ while (in.isReadable()) {
+ int ch = in.getByte(in.readerIndex());
+ if ((ch != ' ') && (ch != '\n') && (ch != '\t') && (ch != '\r')) {
+ break;
+ } else {
+ in.readByte();
+ }
+ }
+ }
+
+ /**
+ * Check whether the peek of the stack element is double quote.
+ * @param jrContext context for the last decoding process
+ * @return boolean
+ */
+ private static boolean isDoubleQuote(Stack<Byte> bufStack) {
+ if (!bufStack.isEmpty() && bufStack.peek() == '"') {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check whether the encoding is valid.
+ * @param in input of bytes
+ * @throws IOException this is an IO exception
+ * @throws UnsupportedException this is an unsupported exception
+ */
+ private static void checkEncoding(ByteBuf in) throws IOException {
+ int inputStart = 0;
+ int inputLength = 4;
+ fliterCharaters(in);
+ byte[] buff = new byte[4];
+ in.getBytes(in.readerIndex(), buff);
+ ByteSourceJsonBootstrapper strapper = new ByteSourceJsonBootstrapper(new IOContext(new BufferRecycler(),
+ null,
+ false),
+ buff, inputStart,
+ inputLength);
+ JsonEncoding jsonEncoding = strapper.detectEncoding();
+ if (!JsonEncoding.UTF8.equals(jsonEncoding)) {
+ throw new UnsupportedException("Only UTF-8 encoding is supported.");
+ }
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcWriterUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcWriterUtil.java
new file mode 100644
index 00000000..7511c36e
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/JsonRpcWriterUtil.java
@@ -0,0 +1,114 @@
+/*
+ * 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.utils;
+
+import java.util.List;
+
+import org.onosproject.ovsdb.rfc.jsonrpc.JsonRpcRequest;
+import org.onosproject.ovsdb.rfc.operations.Operation;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+
+/**
+ * RPC Methods request utility class. Refer to RFC7047's Section 4.1.
+ */
+public final class JsonRpcWriterUtil {
+
+ /**
+ * Constructs a JsonRpcWriterUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully.
+ * This class should not be instantiated.
+ */
+ private JsonRpcWriterUtil() {
+ }
+
+ /**
+ * Returns string of RPC request.
+ * @param uuid id of request object
+ * @param methodName method of request object
+ * @param params params of request object
+ * @return RPC Request String
+ */
+ private static String getRequestStr(String uuid, String methodName,
+ List params) {
+ JsonRpcRequest request;
+ if (params != null) {
+ request = new JsonRpcRequest(uuid, methodName, params);
+ } else {
+ request = new JsonRpcRequest(uuid, methodName);
+ }
+ String str = ObjectMapperUtil.convertToString(request);
+ return str;
+ }
+
+ /**
+ * Returns string of get_schema request.
+ * @param uuid id of get_schema request
+ * @param dbnames params of get_schema request
+ * @return get_schema Request String
+ */
+ public static String getSchemaStr(String uuid, List<String> dbnames) {
+ String methodName = "get_schema";
+ return getRequestStr(uuid, methodName, dbnames);
+ }
+
+ /**
+ * Returns string of echo request.
+ * @param uuid id of echo request
+ * @return echo Request String
+ */
+ public static String echoStr(String uuid) {
+ String methodName = "echo";
+ return getRequestStr(uuid, methodName, null);
+ }
+
+ /**
+ * Returns string of monitor request.
+ * @param uuid id of monitor request
+ * @param monotorId json-value in params of monitor request
+ * @param dbSchema DatabaseSchema entity
+ * @return monitor Request String
+ */
+ public static String monitorStr(String uuid, String monotorId,
+ DatabaseSchema dbSchema) {
+ String methodName = "monitor";
+ return getRequestStr(uuid, methodName,
+ ParamUtil.getMonitorParams(monotorId, dbSchema));
+ }
+
+ /**
+ * Returns string of list_dbs request.
+ * @param uuid id of list_dbs request
+ * @return list_dbs Request String
+ */
+ public static String listDbsStr(String uuid) {
+ String methodName = "list_dbs";
+ return getRequestStr(uuid, methodName, null);
+ }
+
+ /**
+ * Returns string of transact request.
+ * @param uuid id of transact request
+ * @param dbSchema DatabaseSchema entity
+ * @param operations operation* in params of transact request
+ * @return transact Request String
+ */
+ public static String transactStr(String uuid, DatabaseSchema dbSchema,
+ List<Operation> operations) {
+ String methodName = "transact";
+ return getRequestStr(uuid, methodName,
+ ParamUtil.getTransactParams(dbSchema, operations));
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/MutationUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/MutationUtil.java
new file mode 100644
index 00000000..00e7dbe8
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/MutationUtil.java
@@ -0,0 +1,92 @@
+package org.onosproject.ovsdb.rfc.utils;
+
+import org.onosproject.ovsdb.rfc.notation.Mutation;
+import org.onosproject.ovsdb.rfc.notation.Mutation.Mutator;
+
+public final class MutationUtil {
+
+ /**
+ * Constructs a MutationUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully. This
+ * class should not be instantiated.
+ */
+ private MutationUtil() {
+ }
+
+ /**
+ * Returns a Mutation that means += .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation sum(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.SUM, value);
+ }
+
+ /**
+ * Returns a Mutation that means -= .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation difference(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.DIFFERENCE, value);
+ }
+
+ /**
+ * Returns a Mutation that means *= .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation product(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.PRODUCT, value);
+ }
+
+ /**
+ * Returns a Mutation that means /= .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation quotient(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.QUOTIENT, value);
+ }
+
+ /**
+ * Returns a Mutation that means %= .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation remainder(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.REMAINDER, value);
+ }
+
+ /**
+ * Returns a Mutation that means insert .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation insert(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.INSERT, value);
+ }
+
+ /**
+ * Returns a Mutation that means delete .
+ * @param columnName column name
+ * @param data column value
+ * @return Mutation
+ */
+ public static Mutation delete(String columnName, Object data) {
+ Object value = TransValueUtil.getFormatData(data);
+ return new Mutation(columnName, Mutator.DELETE, value);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ObjectMapperUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ObjectMapperUtil.java
new file mode 100644
index 00000000..e80a52bc
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ObjectMapperUtil.java
@@ -0,0 +1,98 @@
+/*
+ * 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.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * ObjectMapper utility class.
+ */
+public final class ObjectMapperUtil {
+
+ private static final Logger log = LoggerFactory
+ .getLogger(ObjectMapperUtil.class);
+
+ /**
+ * Constructs a ObjectMapperUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully. This
+ * class should not be instantiated.
+ */
+ private ObjectMapperUtil() {
+ }
+
+ /**
+ * get ObjectMapper entity.
+ * @return ObjectMapper entity
+ */
+ public static ObjectMapper getObjectMapper() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
+ false);
+ objectMapper.setSerializationInclusion(Include.NON_NULL);
+ return objectMapper;
+ }
+
+ /**
+ * get ObjectMapper entity.
+ * @param flag configure
+ * @return ObjectMapper entity
+ */
+ public static ObjectMapper getObjectMapper(boolean flag) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
+ flag);
+ return objectMapper;
+ }
+
+ /**
+ * get ObjectMapper entity.
+ * @param flag configure
+ * @param incl setSerializationInclusion
+ * @return ObjectMapper entity
+ */
+ public static ObjectMapper getObjectMapper(boolean flag, Include incl) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
+ flag);
+ objectMapper.setSerializationInclusion(incl);
+ return objectMapper;
+ }
+
+ /**
+ * convert Object into String.
+ * @param obj Object
+ * @return String
+ */
+ public static String convertToString(Object obj) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ return objectMapper.writeValueAsString(obj);
+ } catch (JsonProcessingException e) {
+ log.error("JsonProcessingException while converting Entity into string", e);
+ }
+ return null;
+ }
+
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ParamUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ParamUtil.java
new file mode 100644
index 00000000..486b39b8
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/ParamUtil.java
@@ -0,0 +1,86 @@
+/*
+ * 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.utils;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.message.MonitorRequest;
+import org.onosproject.ovsdb.rfc.message.MonitorSelect;
+import org.onosproject.ovsdb.rfc.operations.Operation;
+import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
+import org.onosproject.ovsdb.rfc.schema.TableSchema;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Params utility class. Params of the request object, refer to RFC7047's
+ * Section 4.1.
+ */
+public final class ParamUtil {
+
+ /**
+ * Constructs a ParamUtil object. Utility classes should not have a public
+ * or default constructor, otherwise IDE will compile unsuccessfully. This
+ * class should not be instantiated.
+ */
+ private ParamUtil() {
+ }
+
+ /**
+ * Returns MonitorRequest, refer to RFC7047's Section 4.1.5.
+ * @param tableSchema entity
+ * @return MonitorRequest
+ */
+ private static MonitorRequest getAllColumnsMonitorRequest(TableSchema tableSchema) {
+ String tableName = tableSchema.name();
+ Set<String> columns = tableSchema.getColumnNames();
+ MonitorSelect select = new MonitorSelect(true, true, true, true);
+ MonitorRequest monitorRequest = new MonitorRequest(tableName, columns, select);
+ return monitorRequest;
+ }
+
+ /**
+ * Returns params of monitor method, refer to RFC7047's Section 4.1.5.
+ * @param monotorId json-value, refer to RFC7047's Section 4.1.5.
+ * @param dbSchema DatabaseSchema entity
+ * @return List of Object, the params of monitor request
+ */
+ public static List<Object> getMonitorParams(String monotorId, DatabaseSchema dbSchema) {
+ Set<String> tables = dbSchema.getTableNames();
+ Map<String, MonitorRequest> mrMap = Maps.newHashMap();
+ for (String tableName : tables) {
+ TableSchema tableSchema = dbSchema.getTableSchema(tableName);
+ MonitorRequest monitorRequest = getAllColumnsMonitorRequest(tableSchema);
+ mrMap.put(tableName, monitorRequest);
+ }
+ return Lists.newArrayList(dbSchema.name(), monotorId, mrMap);
+ }
+
+ /**
+ * Returns params of transact method, refer to RFC7047's Section 4.1.3.
+ * @param dbSchema DatabaseSchema entity
+ * @param operations operation*, refer to RFC7047's Section 4.1.3.
+ * @return List of Object, the params of transact request
+ */
+ public static List<Object> getTransactParams(DatabaseSchema dbSchema, List<Operation> operations) {
+ List<Object> lists = Lists.newArrayList(dbSchema.name());
+ lists.addAll(operations);
+ return lists;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/StringEncoderUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/StringEncoderUtil.java
new file mode 100644
index 00000000..0e414d8b
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/StringEncoderUtil.java
@@ -0,0 +1,42 @@
+/*
+ * 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.utils;
+
+import io.netty.handler.codec.string.StringEncoder;
+import io.netty.util.CharsetUtil;
+
+/**
+ * StringEncoder utility class.Only UTF-8 encoding is supported refer to
+ * RFC7047's Section 3.1.
+ */
+public final class StringEncoderUtil {
+
+ /**
+ * Constructs a StringEncoderUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully. This
+ * class should not be instantiated.
+ */
+ private StringEncoderUtil() {
+ }
+
+ /**
+ * Returns StringEncoder of UTF_8 .
+ * @return StringEncoder
+ */
+ public static StringEncoder getEncoder() {
+ return new StringEncoder(CharsetUtil.UTF_8);
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/TransValueUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/TransValueUtil.java
new file mode 100644
index 00000000..49fbd375
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/TransValueUtil.java
@@ -0,0 +1,172 @@
+/*
+ * 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.utils;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
+import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
+import org.onosproject.ovsdb.rfc.notation.RefTableRow;
+import org.onosproject.ovsdb.rfc.notation.UUID;
+import org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType;
+import org.onosproject.ovsdb.rfc.schema.type.BaseType;
+import org.onosproject.ovsdb.rfc.schema.type.BooleanBaseType;
+import org.onosproject.ovsdb.rfc.schema.type.ColumnType;
+import org.onosproject.ovsdb.rfc.schema.type.IntegerBaseType;
+import org.onosproject.ovsdb.rfc.schema.type.KeyValuedColumnType;
+import org.onosproject.ovsdb.rfc.schema.type.RealBaseType;
+import org.onosproject.ovsdb.rfc.schema.type.StringBaseType;
+import org.onosproject.ovsdb.rfc.schema.type.UuidBaseType;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+/**
+ * Object value utility class.
+ */
+public final class TransValueUtil {
+
+ /**
+ * Constructs a TransValueUtil object. Utility classes should not have a
+ * public or default constructor, otherwise IDE will compile unsuccessfully.
+ * This class should not be instantiated.
+ */
+ private TransValueUtil() {
+ }
+
+ /**
+ * if the type is Set, convert into OvsdbSet, if Map, convert into OvsdbMap.
+ * @param value Object
+ * @return Object
+ */
+ public static Object getFormatData(Object value) {
+ if (value instanceof Map) {
+ return OvsdbMap.ovsdbMap((Map) value);
+ } else if (value instanceof Set) {
+ return OvsdbSet.ovsdbSet((Set) value);
+ } else {
+ return value;
+ }
+ }
+
+ /**
+ * Transform JsonNode to corresponding value.
+ * @param json the ColumnType JsonNode
+ * @param columnType AtomicColumnType or KeyValuedColumnType
+ * @return Object OvsdbMap or OvsdbSet
+ */
+ public static Object getValueFromJson(JsonNode json, ColumnType columnType) {
+ if (columnType instanceof AtomicColumnType) {
+ AtomicColumnType atoType = (AtomicColumnType) columnType;
+ return getValueFromAtoType(json, atoType);
+ } else if (columnType instanceof KeyValuedColumnType) {
+ KeyValuedColumnType kvType = (KeyValuedColumnType) columnType;
+ return getValueFromKvType(json, kvType);
+ }
+ return null;
+ }
+
+ /**
+ * Convert AtomicColumnType JsonNode into OvsdbSet value.
+ * @param json AtomicColumnType JsonNode
+ * @param atoType AtomicColumnType entity
+ * @return Object OvsdbSet or the value of JsonNode
+ */
+ private static Object getValueFromAtoType(JsonNode json, AtomicColumnType atoType) {
+ BaseType baseType = atoType.baseType();
+ // If "min" or "max" is not specified, If "min" is not 1 or "max" is not
+ // 1, or both, and "value" is not specified, the type is a set of scalar
+ // type "key". Refer to RFC 7047, Section 3.2 <type>.
+ if (atoType.min() != atoType.max()) {
+ Set set = Sets.newHashSet();
+ if (json.isArray()) {
+ if (json.size() == 2) {
+ if (json.get(0).isTextual() && "set".equals(json.get(0).asText())) {
+ for (JsonNode node : json.get(1)) {
+ set.add(transToValue(node, baseType));
+ }
+ } else {
+ set.add(transToValue(json, baseType));
+ }
+ }
+ } else {
+ set.add(transToValue(json, baseType));
+ }
+ return OvsdbSet.ovsdbSet(set);
+ } else {
+ return transToValue(json, baseType);
+ }
+ }
+
+ /**
+ * Convert KeyValuedColumnType JsonNode into OvsdbMap value.
+ * @param json KeyValuedColumnType JsonNode
+ * @param kvType KeyValuedColumnType entity
+ * @return Object OvsdbMap
+ */
+ private static Object getValueFromKvType(JsonNode json, KeyValuedColumnType kvType) {
+ if (json.isArray()) {
+ if (json.size() == 2) {
+ if (json.get(0).isTextual() && "map".equals(json.get(0).asText())) {
+ Map map = Maps.newHashMap();
+ for (JsonNode pairNode : json.get(1)) {
+ if (pairNode.isArray() && json.size() == 2) {
+ Object key = transToValue(pairNode.get(0), kvType.keyType());
+ Object value = transToValue(pairNode.get(1), kvType.valueType());
+ map.put(key, value);
+ }
+ }
+ return OvsdbMap.ovsdbMap(map);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * convert into value.
+ * @param valueNode the BaseType JsonNode
+ * @param baseType BooleanBaseType or IntegerBaseType or RealBaseType or
+ * StringBaseType or UuidBaseType
+ * @return Object the value of JsonNode
+ */
+ public static Object transToValue(JsonNode valueNode, BaseType baseType) {
+ if (baseType instanceof BooleanBaseType) {
+ return valueNode.asBoolean();
+ } else if (baseType instanceof IntegerBaseType) {
+ return valueNode.asInt();
+ } else if (baseType instanceof RealBaseType) {
+ return valueNode.asDouble();
+ } else if (baseType instanceof StringBaseType) {
+ return valueNode.asText();
+ } else if (baseType instanceof UuidBaseType) {
+ if (valueNode.isArray()) {
+ if (valueNode.size() == 2) {
+ if (valueNode.get(0).isTextual()
+ && ("uuid".equals(valueNode.get(0).asText()) || "named-uuid"
+ .equals(valueNode.get(0).asText()))) {
+ return UUID.uuid(valueNode.get(1).asText());
+ }
+ }
+ } else {
+ return new RefTableRow(((UuidBaseType) baseType).getRefTable(), valueNode);
+ }
+ }
+ return null;
+ }
+}
diff --git a/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/VersionUtil.java b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/VersionUtil.java
new file mode 100644
index 00000000..d05d90ed
--- /dev/null
+++ b/framework/src/onos/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/utils/VersionUtil.java
@@ -0,0 +1,69 @@
+/*
+ * 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.utils;
+
+/**
+ * Version utility class.
+ */
+public final class VersionUtil {
+
+ /**
+ * Constructs a VersionUtil object. Utility classes should not have a public
+ * or default constructor, otherwise IDE will compile unsuccessfully. This
+ * class should not be instantiated.
+ */
+ private VersionUtil() {
+ }
+
+ public static final String DEFAULT_VERSION_STRING = "0.0.0";
+ private static final String FORMAT = "(\\d+)\\.(\\d+)\\.(\\d+)";
+
+ /**
+ * Match version by the format.
+ * @param version the version String
+ * @throws IllegalArgumentException this is an illegal argument exception
+ */
+ public static void versionMatch(String version) {
+ if (!version.matches(FORMAT)) {
+ throw new IllegalArgumentException("<" + version
+ + "> does not match format " + FORMAT);
+ }
+ }
+
+ /**
+ * Compare fromVersion and toVersion.
+ * @param fromVersion the initial version
+ * @param toVersion the end of the version
+ * @return an int number
+ */
+ public static int versionCompare(String fromVersion, String toVersion) {
+ String[] fromArr = fromVersion.split("\\.");
+ String[] toArr = toVersion.split("\\.");
+ int fromFirst = Integer.parseInt(fromArr[0]);
+ int fromMiddle = Integer.parseInt(fromArr[1]);
+ int fromEnd = Integer.parseInt(fromArr[2]);
+ int toFirst = Integer.parseInt(toArr[0]);
+ int toMiddle = Integer.parseInt(toArr[1]);
+ int toEnd = Integer.parseInt(toArr[2]);
+ if (fromFirst - toFirst != 0) {
+ return fromFirst - toFirst;
+ } else if (fromMiddle - toMiddle != 0) {
+ return fromMiddle - toMiddle;
+ } else {
+ return fromEnd - toEnd;
+ }
+ }
+}