Committed by
Gerrit Code Review
[ONOS-2447]RFC7047's API and its implementation and five main tables.
provide RFC7047's API and its implementation, and five main table which contain Bridge, Controller, Interface, Open_vSwitch and Port Change-Id: I9e995a056fd55c986f5866c85ac712f1792cff4f
Showing
26 changed files
with
5456 additions
and
0 deletions
... | @@ -26,6 +26,14 @@ | ... | @@ -26,6 +26,14 @@ |
26 | <groupId>org.onosproject</groupId> | 26 | <groupId>org.onosproject</groupId> |
27 | <artifactId>onlab-junit</artifactId> | 27 | <artifactId>onlab-junit</artifactId> |
28 | </dependency> | 28 | </dependency> |
29 | + <dependency> | ||
30 | + <groupId>io.netty</groupId> | ||
31 | + <artifactId>netty-buffer</artifactId> | ||
32 | + </dependency> | ||
33 | + <dependency> | ||
34 | + <groupId>io.netty</groupId> | ||
35 | + <artifactId>netty-handler</artifactId> | ||
36 | + </dependency> | ||
29 | </dependencies> | 37 | </dependencies> |
30 | 38 | ||
31 | <build> | 39 | <build> | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.jsonrpc; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.ovsdb.rfc.message.UpdateNotification; | ||
21 | + | ||
22 | +/** | ||
23 | + * The callback function interface will be used when the server send to the | ||
24 | + * client report changes. | ||
25 | + */ | ||
26 | +public interface Callback { | ||
27 | + /** | ||
28 | + * The "update" notification is sent by the server to the client to report | ||
29 | + * changes in tables that are being monitored following a "*monitor" | ||
30 | + * request. | ||
31 | + * @param updateNotification the information of the update | ||
32 | + */ | ||
33 | + void update(UpdateNotification updateNotification); | ||
34 | + | ||
35 | + /** | ||
36 | + * The "locked" notification is provided to notify a client that it has been | ||
37 | + * granted a lock that it had previously requested with the "lock" method. | ||
38 | + * @param ids the locked ids | ||
39 | + */ | ||
40 | + void locked(List<String> ids); | ||
41 | + | ||
42 | + /** | ||
43 | + * The "stolen" notification is provided to notify a client, which had | ||
44 | + * previously obtained a lock, that another client has stolen ownership of | ||
45 | + * that lock. | ||
46 | + * @param ids the stolen ids | ||
47 | + */ | ||
48 | + void stolen(List<String> ids); | ||
49 | + | ||
50 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.jsonrpc; | ||
17 | + | ||
18 | +import java.util.Stack; | ||
19 | + | ||
20 | +/** | ||
21 | + * Context for decode parameters. | ||
22 | + */ | ||
23 | +public class JsonReadContext { | ||
24 | + private Stack<Byte> bufStack; | ||
25 | + private boolean isStartMatch; | ||
26 | + private int lastReadBytes; | ||
27 | + | ||
28 | + /** | ||
29 | + * Constructs a JsonReadContext object. This class only need initial | ||
30 | + * parameter value for the readToJsonNode method of JsonRpcReaderUtil | ||
31 | + * entity. | ||
32 | + */ | ||
33 | + public JsonReadContext() { | ||
34 | + bufStack = new Stack<Byte>(); | ||
35 | + isStartMatch = false; | ||
36 | + lastReadBytes = 0; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Return bufStack. | ||
41 | + * @return bufStack | ||
42 | + */ | ||
43 | + public Stack<Byte> getBufStack() { | ||
44 | + return bufStack; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Set bufStack, used for match the braces and double quotes. | ||
49 | + * @param bufStack Stack of Byte | ||
50 | + */ | ||
51 | + public void setBufStack(Stack<Byte> bufStack) { | ||
52 | + this.bufStack = bufStack; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * Return isStartMatch. | ||
57 | + * @return isStartMatch | ||
58 | + */ | ||
59 | + public boolean isStartMatch() { | ||
60 | + return isStartMatch; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * Set isStartMatch. | ||
65 | + * @param isStartMatch mark whether the matching has started | ||
66 | + */ | ||
67 | + public void setStartMatch(boolean isStartMatch) { | ||
68 | + this.isStartMatch = isStartMatch; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Return lastReadBytes. | ||
73 | + * @return lastReadBytes | ||
74 | + */ | ||
75 | + public int getLastReadBytes() { | ||
76 | + return lastReadBytes; | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * Set lastReadBytes. | ||
81 | + * @param lastReadBytes the bytes for last decoding incomplete record | ||
82 | + */ | ||
83 | + public void setLastReadBytes(int lastReadBytes) { | ||
84 | + this.lastReadBytes = lastReadBytes; | ||
85 | + } | ||
86 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.jsonrpc; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | + | ||
21 | +import java.util.List; | ||
22 | +import java.util.Objects; | ||
23 | + | ||
24 | +import com.google.common.collect.Lists; | ||
25 | + | ||
26 | +/** | ||
27 | + * Json Rpc Request information that include id,method,params. | ||
28 | + */ | ||
29 | +public class JsonRpcRequest { | ||
30 | + | ||
31 | + private final String id; | ||
32 | + private final String method; | ||
33 | + private final List<Object> params; | ||
34 | + | ||
35 | + /** | ||
36 | + * JsonRpcRequest Constructor. | ||
37 | + * @param id the id node of request information | ||
38 | + * @param method the method node of request information | ||
39 | + */ | ||
40 | + public JsonRpcRequest(String id, String method) { | ||
41 | + checkNotNull(id, "id cannot be null"); | ||
42 | + checkNotNull(method, "method cannot be null"); | ||
43 | + this.id = id; | ||
44 | + this.method = method; | ||
45 | + this.params = Lists.newArrayList(); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * JsonRpcRequest Constructor. | ||
50 | + * @param id the id node of request information | ||
51 | + * @param method the method node of request information | ||
52 | + * @param params the params node of request information | ||
53 | + */ | ||
54 | + public JsonRpcRequest(String id, String method, List<Object> params) { | ||
55 | + checkNotNull(id, "id cannot be null"); | ||
56 | + checkNotNull(method, "method cannot be null"); | ||
57 | + checkNotNull(params, "params cannot be null"); | ||
58 | + this.id = id; | ||
59 | + this.method = method; | ||
60 | + this.params = params; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
64 | + * Returns id. | ||
65 | + * @return id | ||
66 | + */ | ||
67 | + public String getId() { | ||
68 | + return id; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns method. | ||
73 | + * @return method | ||
74 | + */ | ||
75 | + public String getMethod() { | ||
76 | + return method; | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * Returns params. | ||
81 | + * @return params | ||
82 | + */ | ||
83 | + public List<Object> getParams() { | ||
84 | + return params; | ||
85 | + } | ||
86 | + | ||
87 | + @Override | ||
88 | + public int hashCode() { | ||
89 | + return Objects.hash(id, method, params); | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + public boolean equals(Object obj) { | ||
94 | + if (this == obj) { | ||
95 | + return true; | ||
96 | + } | ||
97 | + if (obj instanceof JsonRpcRequest) { | ||
98 | + final JsonRpcRequest other = (JsonRpcRequest) obj; | ||
99 | + return Objects.equals(this.id, other.id) | ||
100 | + && Objects.equals(this.method, other.method) | ||
101 | + && Objects.equals(this.params, other.params); | ||
102 | + } | ||
103 | + return false; | ||
104 | + } | ||
105 | + | ||
106 | + @Override | ||
107 | + public String toString() { | ||
108 | + return toStringHelper(this).add("id", id).add("method", method) | ||
109 | + .add("params", params).toString(); | ||
110 | + } | ||
111 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.jsonrpc; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | + | ||
21 | +import java.util.List; | ||
22 | +import java.util.Objects; | ||
23 | + | ||
24 | +import com.google.common.collect.Lists; | ||
25 | + | ||
26 | +/** | ||
27 | + * Json Rpc Response information that include id,error,result. | ||
28 | + */ | ||
29 | +public class JsonRpcResponse { | ||
30 | + | ||
31 | + private final String id; | ||
32 | + private final String error; | ||
33 | + private final List<Object> result; | ||
34 | + | ||
35 | + /** | ||
36 | + * JsonRpcResponse Constructor. | ||
37 | + * @param id the id node of response information | ||
38 | + */ | ||
39 | + public JsonRpcResponse(String id) { | ||
40 | + checkNotNull(id, "id cannot be null"); | ||
41 | + this.id = id; | ||
42 | + this.error = null; | ||
43 | + this.result = Lists.newArrayList(); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * JsonRpcResponse Constructor. | ||
48 | + * @param id the id node of response information | ||
49 | + * @param error the error node of response information | ||
50 | + */ | ||
51 | + public JsonRpcResponse(String id, String error) { | ||
52 | + checkNotNull(id, "id cannot be null"); | ||
53 | + checkNotNull(error, "error cannot be null"); | ||
54 | + this.id = id; | ||
55 | + this.error = error; | ||
56 | + this.result = Lists.newArrayList(); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * JsonRpcResponse Constructor. | ||
61 | + * @param id the id node of response information | ||
62 | + * @param error the error node of response information | ||
63 | + * @param result the result node of response information | ||
64 | + */ | ||
65 | + public JsonRpcResponse(String id, String error, List<Object> result) { | ||
66 | + checkNotNull(id, "id cannot be null"); | ||
67 | + checkNotNull(error, "error cannot be null"); | ||
68 | + checkNotNull(result, "result cannot be null"); | ||
69 | + this.id = id; | ||
70 | + this.error = error; | ||
71 | + this.result = result; | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns id. | ||
76 | + * @return id | ||
77 | + */ | ||
78 | + public String getId() { | ||
79 | + return id; | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Returns error. | ||
84 | + * @return error | ||
85 | + */ | ||
86 | + public String getError() { | ||
87 | + return error; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * Returns result. | ||
92 | + * @return result | ||
93 | + */ | ||
94 | + public List<Object> getResult() { | ||
95 | + return result; | ||
96 | + } | ||
97 | + | ||
98 | + @Override | ||
99 | + public int hashCode() { | ||
100 | + return Objects.hash(id, error, result); | ||
101 | + } | ||
102 | + | ||
103 | + @Override | ||
104 | + public boolean equals(Object obj) { | ||
105 | + if (this == obj) { | ||
106 | + return true; | ||
107 | + } | ||
108 | + if (obj instanceof JsonRpcResponse) { | ||
109 | + final JsonRpcResponse other = (JsonRpcResponse) obj; | ||
110 | + return Objects.equals(this.id, other.id) | ||
111 | + && Objects.equals(this.error, other.error) | ||
112 | + && Objects.equals(this.result, other.result); | ||
113 | + } | ||
114 | + return false; | ||
115 | + } | ||
116 | + | ||
117 | + @Override | ||
118 | + public String toString() { | ||
119 | + return toStringHelper(this).add("id", id).add("error", error) | ||
120 | + .add("result", result).toString(); | ||
121 | + } | ||
122 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.jsonrpc; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.ovsdb.rfc.operations.Operation; | ||
21 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
22 | + | ||
23 | +import com.fasterxml.jackson.databind.JsonNode; | ||
24 | +import com.google.common.util.concurrent.ListenableFuture; | ||
25 | + | ||
26 | +/** | ||
27 | + * The following interface describe the RPC7047's methods that are supported. | ||
28 | + */ | ||
29 | +public interface OvsdbRPC { | ||
30 | + | ||
31 | + /** | ||
32 | + * This operation retrieves a database-schema that describes hosted database | ||
33 | + * db-name. | ||
34 | + * @param dbnames database name | ||
35 | + * @return ListenableFuture of JsonNode | ||
36 | + */ | ||
37 | + ListenableFuture<JsonNode> getSchema(List<String> dbnames); | ||
38 | + | ||
39 | + /** | ||
40 | + * The "echo" method can be used by both clients and servers to verify the | ||
41 | + * liveness of a database connection. | ||
42 | + * @return return info | ||
43 | + */ | ||
44 | + ListenableFuture<List<String>> echo(); | ||
45 | + | ||
46 | + /** | ||
47 | + * The "monitor" request enables a client to replicate tables or subsets of | ||
48 | + * tables within an OVSDB database by requesting notifications of changes to | ||
49 | + * those tables and by receiving the complete initial state of a table or a | ||
50 | + * subset of a table. | ||
51 | + * @param dbSchema databse schema | ||
52 | + * @param monitorId a id for monitor | ||
53 | + * @return ListenableFuture of JsonNode | ||
54 | + */ | ||
55 | + ListenableFuture<JsonNode> monitor(DatabaseSchema dbSchema, String monitorId); | ||
56 | + | ||
57 | + /** | ||
58 | + * This operation retrieves an array whose elements are the names of the | ||
59 | + * databases that can be accessed over this management protocol connection. | ||
60 | + * @return database names | ||
61 | + */ | ||
62 | + ListenableFuture<List<String>> listDbs(); | ||
63 | + | ||
64 | + /** | ||
65 | + * This RPC method causes the database server to execute a series of | ||
66 | + * operations in the specified order on a given database. | ||
67 | + * @param dbSchema database schema | ||
68 | + * @param operations the operations to execute | ||
69 | + * @return result the transact result | ||
70 | + */ | ||
71 | + ListenableFuture<List<JsonNode>> transact(DatabaseSchema dbSchema, | ||
72 | + List<Operation> operations); | ||
73 | + | ||
74 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.table; | ||
17 | + | ||
18 | +import java.util.Map; | ||
19 | +import java.util.Set; | ||
20 | + | ||
21 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
22 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
23 | +import org.onosproject.ovsdb.rfc.notation.UUID; | ||
24 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
25 | +import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService; | ||
26 | +import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; | ||
27 | + | ||
28 | +/** | ||
29 | + * This class provides operations of Bridge Table. | ||
30 | + */ | ||
31 | +public class Bridge extends AbstractOvsdbTableService { | ||
32 | + | ||
33 | + /** | ||
34 | + * Bridge table column name. | ||
35 | + */ | ||
36 | + public enum BridgeColumn { | ||
37 | + NAME("name"), DATAPATHTYPE("datapath_type"), DATAPATHID("datapath_id"), | ||
38 | + STPENABLE("stpenable"), PORTS("ports"), MIRRORS("mirrors"), | ||
39 | + NETFLOW("netflow"), SFLOW("sflow"), IPFIX("ipfix"), | ||
40 | + CONTROLLER("controller"), PROTOCOLS("protocols"), | ||
41 | + FAILMODE("fail_mode"), STATUS("status"), OTHERCONFIG("other_config"), | ||
42 | + EXTERNALIDS("external_ids"), FLOODVLANS("flood_vlans"), | ||
43 | + FLOWTABLES("flow_tables"); | ||
44 | + | ||
45 | + private final String columnName; | ||
46 | + | ||
47 | + private BridgeColumn(String columnName) { | ||
48 | + this.columnName = columnName; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * Returns the table column name for BridgeColumn. | ||
53 | + * @return the table column name | ||
54 | + */ | ||
55 | + public String columnName() { | ||
56 | + return columnName; | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Constructs a Bridge object. Generate Bridge Table Description. | ||
62 | + * @param dbSchema DatabaseSchema | ||
63 | + * @param row Row | ||
64 | + */ | ||
65 | + public Bridge(DatabaseSchema dbSchema, Row row) { | ||
66 | + super(dbSchema, row, OvsdbTable.BRIDGE, VersionNum.VERSION100); | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * Get the Column entity which column name is "name" from the Row entity of | ||
71 | + * attributes. | ||
72 | + * @return the Column entity which column name is "name" | ||
73 | + */ | ||
74 | + public Column getNameColumn() { | ||
75 | + ColumnDescription columndesc = new ColumnDescription( | ||
76 | + BridgeColumn.NAME | ||
77 | + .columnName(), | ||
78 | + "getNameColumn", | ||
79 | + VersionNum.VERSION100); | ||
80 | + return (Column) super.getColumnHandler(columndesc); | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Add a Column entity which column name is "name" to the Row entity of | ||
85 | + * attributes. | ||
86 | + * @param name the column data which column name is "name" | ||
87 | + */ | ||
88 | + public void setName(String name) { | ||
89 | + ColumnDescription columndesc = new ColumnDescription( | ||
90 | + BridgeColumn.NAME | ||
91 | + .columnName(), | ||
92 | + "setName", | ||
93 | + VersionNum.VERSION100); | ||
94 | + super.setDataHandler(columndesc, name); | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * Get the column data which column name is "name" from the Row entity of | ||
99 | + * attributes. | ||
100 | + * @return the column data which column name is "name" | ||
101 | + */ | ||
102 | + public String getName() { | ||
103 | + ColumnDescription columndesc = new ColumnDescription( | ||
104 | + BridgeColumn.NAME | ||
105 | + .columnName(), | ||
106 | + "getName", | ||
107 | + VersionNum.VERSION100); | ||
108 | + return (String) super.getDataHandler(columndesc); | ||
109 | + } | ||
110 | + | ||
111 | + /** | ||
112 | + * Get the Column entity which column name is "datapath_type" from the Row | ||
113 | + * entity of attributes. | ||
114 | + * @return the Column entity which column name is "datapath_type" | ||
115 | + */ | ||
116 | + public Column getDatapathTypeColumn() { | ||
117 | + ColumnDescription columndesc = new ColumnDescription( | ||
118 | + BridgeColumn.DATAPATHTYPE | ||
119 | + .columnName(), | ||
120 | + "getDatapathTypeColumn", | ||
121 | + VersionNum.VERSION100); | ||
122 | + return (Column) super.getColumnHandler(columndesc); | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * Add a Column entity which column name is "datapath_type" to the Row | ||
127 | + * entity of attributes. | ||
128 | + * @param datapathType the column data which column name is "datapath_type" | ||
129 | + */ | ||
130 | + public void setDatapathType(String datapathType) { | ||
131 | + ColumnDescription columndesc = new ColumnDescription( | ||
132 | + BridgeColumn.DATAPATHTYPE | ||
133 | + .columnName(), | ||
134 | + "setDatapathType", | ||
135 | + VersionNum.VERSION100); | ||
136 | + super.setDataHandler(columndesc, datapathType); | ||
137 | + } | ||
138 | + | ||
139 | + /** | ||
140 | + * Get the Column entity which column name is "datapath_id" from the Row | ||
141 | + * entity of attributes. | ||
142 | + * @return the Column entity which column name is "datapath_id" | ||
143 | + */ | ||
144 | + public Column getDatapathIdColumn() { | ||
145 | + ColumnDescription columndesc = new ColumnDescription( | ||
146 | + BridgeColumn.DATAPATHID | ||
147 | + .columnName(), | ||
148 | + "getDatapathIdColumn", | ||
149 | + VersionNum.VERSION100); | ||
150 | + return (Column) super.getColumnHandler(columndesc); | ||
151 | + } | ||
152 | + | ||
153 | + /** | ||
154 | + * Add a Column entity which column name is "datapath_id" to the Row entity | ||
155 | + * of attributes. | ||
156 | + * @param datapathId the column data which column name is "datapath_id" | ||
157 | + */ | ||
158 | + public void setDatapathId(Set<String> datapathId) { | ||
159 | + ColumnDescription columndesc = new ColumnDescription( | ||
160 | + BridgeColumn.DATAPATHID | ||
161 | + .columnName(), | ||
162 | + "setDatapathId", | ||
163 | + VersionNum.VERSION100); | ||
164 | + super.setDataHandler(columndesc, datapathId); | ||
165 | + } | ||
166 | + | ||
167 | + /** | ||
168 | + * Get the Column entity which column name is "stpenable" from the Row | ||
169 | + * entity of attributes. | ||
170 | + * @return the Column entity which column name is "stpenable" | ||
171 | + */ | ||
172 | + public Column getStpEnableColumn() { | ||
173 | + ColumnDescription columndesc = new ColumnDescription( | ||
174 | + BridgeColumn.STPENABLE | ||
175 | + .columnName(), | ||
176 | + "getStpEnableColumn", | ||
177 | + VersionNum.VERSION620); | ||
178 | + return (Column) super.getColumnHandler(columndesc); | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * Add a Column entity which column name is "stpenable" to the Row entity of | ||
183 | + * attributes. | ||
184 | + * @param stpenable the column data which column name is "stpenable" | ||
185 | + */ | ||
186 | + public void setStpEnable(Boolean stpenable) { | ||
187 | + ColumnDescription columndesc = new ColumnDescription( | ||
188 | + BridgeColumn.STPENABLE | ||
189 | + .columnName(), | ||
190 | + "setStpEnable", | ||
191 | + VersionNum.VERSION620); | ||
192 | + super.setDataHandler(columndesc, stpenable); | ||
193 | + } | ||
194 | + | ||
195 | + /** | ||
196 | + * Get the Column entity which column name is "ports" from the Row entity of | ||
197 | + * attributes. | ||
198 | + * @return the Column entity which column name is "ports" | ||
199 | + */ | ||
200 | + public Column getPortsColumn() { | ||
201 | + ColumnDescription columndesc = new ColumnDescription( | ||
202 | + BridgeColumn.PORTS | ||
203 | + .columnName(), | ||
204 | + "getPortsColumn", | ||
205 | + VersionNum.VERSION100); | ||
206 | + return (Column) super.getColumnHandler(columndesc); | ||
207 | + } | ||
208 | + | ||
209 | + /** | ||
210 | + * Add a Column entity which column name is "ports" to the Row entity of | ||
211 | + * attributes. | ||
212 | + * @param ports the column data which column name is "ports" | ||
213 | + */ | ||
214 | + public void setPorts(Set<UUID> ports) { | ||
215 | + ColumnDescription columndesc = new ColumnDescription( | ||
216 | + BridgeColumn.PORTS | ||
217 | + .columnName(), | ||
218 | + "setPorts", | ||
219 | + VersionNum.VERSION100); | ||
220 | + super.setDataHandler(columndesc, ports); | ||
221 | + } | ||
222 | + | ||
223 | + /** | ||
224 | + * Get the Column entity which column name is "mirrors" from the Row entity | ||
225 | + * of attributes. | ||
226 | + * @return the Column entity which column name is "mirrors" | ||
227 | + */ | ||
228 | + public Column getMirrorsColumn() { | ||
229 | + ColumnDescription columndesc = new ColumnDescription( | ||
230 | + BridgeColumn.MIRRORS | ||
231 | + .columnName(), | ||
232 | + "getMirrorsColumn", | ||
233 | + VersionNum.VERSION100); | ||
234 | + return (Column) super.getColumnHandler(columndesc); | ||
235 | + } | ||
236 | + | ||
237 | + /** | ||
238 | + * Add a Column entity which column name is "mirrors" to the Row entity of | ||
239 | + * attributes. | ||
240 | + * @param mirrors the column data which column name is "mirrors" | ||
241 | + */ | ||
242 | + public void setMirrors(Set<UUID> mirrors) { | ||
243 | + ColumnDescription columndesc = new ColumnDescription( | ||
244 | + BridgeColumn.MIRRORS | ||
245 | + .columnName(), | ||
246 | + "setMirrors", | ||
247 | + VersionNum.VERSION100); | ||
248 | + super.setDataHandler(columndesc, mirrors); | ||
249 | + } | ||
250 | + | ||
251 | + /** | ||
252 | + * Get the Column entity which column name is "netflow" from the Row entity | ||
253 | + * of attributes. | ||
254 | + * @return the Column entity which column name is "netflow" | ||
255 | + */ | ||
256 | + public Column getNetflowColumn() { | ||
257 | + ColumnDescription columndesc = new ColumnDescription( | ||
258 | + BridgeColumn.NETFLOW | ||
259 | + .columnName(), | ||
260 | + "getNetflowColumn", | ||
261 | + VersionNum.VERSION100); | ||
262 | + return (Column) super.getColumnHandler(columndesc); | ||
263 | + } | ||
264 | + | ||
265 | + /** | ||
266 | + * Add a Column entity which column name is "netflow" to the Row entity of | ||
267 | + * attributes. | ||
268 | + * @param netflow the column data which column name is "netflow" | ||
269 | + */ | ||
270 | + public void setNetflow(Set<UUID> netflow) { | ||
271 | + ColumnDescription columndesc = new ColumnDescription( | ||
272 | + BridgeColumn.NETFLOW | ||
273 | + .columnName(), | ||
274 | + "setNetflow", | ||
275 | + VersionNum.VERSION100); | ||
276 | + super.setDataHandler(columndesc, netflow); | ||
277 | + } | ||
278 | + | ||
279 | + /** | ||
280 | + * Get the Column entity which column name is "sflow" from the Row entity of | ||
281 | + * attributes. | ||
282 | + * @return the Column entity which column name is "sflow" | ||
283 | + */ | ||
284 | + public Column getSflowColumn() { | ||
285 | + ColumnDescription columndesc = new ColumnDescription( | ||
286 | + BridgeColumn.SFLOW | ||
287 | + .columnName(), | ||
288 | + "getSflowColumn", | ||
289 | + VersionNum.VERSION100); | ||
290 | + return (Column) super.getColumnHandler(columndesc); | ||
291 | + } | ||
292 | + | ||
293 | + /** | ||
294 | + * Add a Column entity which column name is "sflow" to the Row entity of | ||
295 | + * attributes. | ||
296 | + * @param sflow the column data which column name is "sflow" | ||
297 | + */ | ||
298 | + public void setSflow(Set<UUID> sflow) { | ||
299 | + ColumnDescription columndesc = new ColumnDescription( | ||
300 | + BridgeColumn.SFLOW | ||
301 | + .columnName(), | ||
302 | + "setSflow", | ||
303 | + VersionNum.VERSION100); | ||
304 | + super.setDataHandler(columndesc, sflow); | ||
305 | + } | ||
306 | + | ||
307 | + /** | ||
308 | + * Get the Column entity which column name is "ipfix" from the Row entity of | ||
309 | + * attributes. | ||
310 | + * @return the Column entity which column name is "ipfix" | ||
311 | + */ | ||
312 | + public Column getIpfixColumn() { | ||
313 | + ColumnDescription columndesc = new ColumnDescription( | ||
314 | + BridgeColumn.IPFIX | ||
315 | + .columnName(), | ||
316 | + "getIpfixColumn", | ||
317 | + VersionNum.VERSION710); | ||
318 | + return (Column) super.getColumnHandler(columndesc); | ||
319 | + } | ||
320 | + | ||
321 | + /** | ||
322 | + * Add a Column entity which column name is "ipfix" to the Row entity of | ||
323 | + * attributes. | ||
324 | + * @param ipfix the column data which column name is "ipfix" | ||
325 | + */ | ||
326 | + public void setIpfix(Set<UUID> ipfix) { | ||
327 | + ColumnDescription columndesc = new ColumnDescription( | ||
328 | + BridgeColumn.IPFIX | ||
329 | + .columnName(), | ||
330 | + "setIpfix", | ||
331 | + VersionNum.VERSION710); | ||
332 | + super.setDataHandler(columndesc, ipfix); | ||
333 | + } | ||
334 | + | ||
335 | + /** | ||
336 | + * Get the Column entity which column name is "controller" from the Row | ||
337 | + * entity of attributes. | ||
338 | + * @return the Column entity which column name is "controller" | ||
339 | + */ | ||
340 | + public Column getControllerColumn() { | ||
341 | + ColumnDescription columndesc = new ColumnDescription( | ||
342 | + BridgeColumn.CONTROLLER | ||
343 | + .columnName(), | ||
344 | + "getControllerColumn", | ||
345 | + VersionNum.VERSION100); | ||
346 | + return (Column) super.getColumnHandler(columndesc); | ||
347 | + } | ||
348 | + | ||
349 | + /** | ||
350 | + * Add a Column entity which column name is "controller" to the Row entity | ||
351 | + * of attributes. | ||
352 | + * @param controller the column data which column name is "controller" | ||
353 | + */ | ||
354 | + public void setController(Set<UUID> controller) { | ||
355 | + ColumnDescription columndesc = new ColumnDescription( | ||
356 | + BridgeColumn.CONTROLLER | ||
357 | + .columnName(), | ||
358 | + "setController", | ||
359 | + VersionNum.VERSION100); | ||
360 | + super.setDataHandler(columndesc, controller); | ||
361 | + } | ||
362 | + | ||
363 | + /** | ||
364 | + * Get the Column entity which column name is "protocols" from the Row | ||
365 | + * entity of attributes. | ||
366 | + * @return the Column entity which column name is "protocols" | ||
367 | + */ | ||
368 | + public Column getProtocolsColumn() { | ||
369 | + ColumnDescription columndesc = new ColumnDescription( | ||
370 | + BridgeColumn.PROTOCOLS | ||
371 | + .columnName(), | ||
372 | + "getProtocolsColumn", | ||
373 | + VersionNum.VERSION6111); | ||
374 | + return (Column) super.getColumnHandler(columndesc); | ||
375 | + } | ||
376 | + | ||
377 | + /** | ||
378 | + * Add a Column entity which column name is "protocols" to the Row entity of | ||
379 | + * attributes. | ||
380 | + * @param protocols the column data which column name is "protocols" | ||
381 | + */ | ||
382 | + public void setProtocols(Set<String> protocols) { | ||
383 | + ColumnDescription columndesc = new ColumnDescription( | ||
384 | + BridgeColumn.PROTOCOLS | ||
385 | + .columnName(), | ||
386 | + "setProtocols", | ||
387 | + VersionNum.VERSION6111); | ||
388 | + super.setDataHandler(columndesc, protocols); | ||
389 | + } | ||
390 | + | ||
391 | + /** | ||
392 | + * Get the Column entity which column name is "fail_mode" from the Row | ||
393 | + * entity of attributes. | ||
394 | + * @return the Column entity which column name is "fail_mode" | ||
395 | + */ | ||
396 | + public Column getFailModeColumn() { | ||
397 | + ColumnDescription columndesc = new ColumnDescription( | ||
398 | + BridgeColumn.FAILMODE | ||
399 | + .columnName(), | ||
400 | + "getFailModeColumn", | ||
401 | + VersionNum.VERSION100); | ||
402 | + return (Column) super.getColumnHandler(columndesc); | ||
403 | + } | ||
404 | + | ||
405 | + /** | ||
406 | + * Add a Column entity which column name is "fail_mode" to the Row entity of | ||
407 | + * attributes. | ||
408 | + * @param failMode the column data which column name is "fail_mode" | ||
409 | + */ | ||
410 | + public void setFailMode(Set<String> failMode) { | ||
411 | + ColumnDescription columndesc = new ColumnDescription( | ||
412 | + BridgeColumn.FAILMODE | ||
413 | + .columnName(), | ||
414 | + "setFailMode", | ||
415 | + VersionNum.VERSION100); | ||
416 | + super.setDataHandler(columndesc, failMode); | ||
417 | + } | ||
418 | + | ||
419 | + /** | ||
420 | + * Get the Column entity which column name is "status" from the Row entity | ||
421 | + * of attributes. | ||
422 | + * @return the Column entity which column name is "status" | ||
423 | + */ | ||
424 | + public Column getStatusColumn() { | ||
425 | + ColumnDescription columndesc = new ColumnDescription( | ||
426 | + BridgeColumn.STATUS | ||
427 | + .columnName(), | ||
428 | + "getStatusColumn", | ||
429 | + VersionNum.VERSION620); | ||
430 | + return (Column) super.getColumnHandler(columndesc); | ||
431 | + } | ||
432 | + | ||
433 | + /** | ||
434 | + * Add a Column entity which column name is "status" to the Row entity of | ||
435 | + * attributes. | ||
436 | + * @param status the column data which column name is "status" | ||
437 | + */ | ||
438 | + public void setStatus(Map<String, String> status) { | ||
439 | + ColumnDescription columndesc = new ColumnDescription( | ||
440 | + BridgeColumn.STATUS | ||
441 | + .columnName(), | ||
442 | + "setStatus", | ||
443 | + VersionNum.VERSION620); | ||
444 | + super.setDataHandler(columndesc, status); | ||
445 | + } | ||
446 | + | ||
447 | + /** | ||
448 | + * Get the Column entity which column name is "other_config" from the Row | ||
449 | + * entity of attributes. | ||
450 | + * @return the Column entity which column name is "other_config" | ||
451 | + */ | ||
452 | + public Column getOtherConfigColumn() { | ||
453 | + ColumnDescription columndesc = new ColumnDescription( | ||
454 | + BridgeColumn.OTHERCONFIG | ||
455 | + .columnName(), | ||
456 | + "getOtherConfigColumn", | ||
457 | + VersionNum.VERSION100); | ||
458 | + return (Column) super.getColumnHandler(columndesc); | ||
459 | + } | ||
460 | + | ||
461 | + /** | ||
462 | + * Add a Column entity which column name is "other_config" to the Row entity | ||
463 | + * of attributes. | ||
464 | + * @param otherConfig the column data which column name is "other_config" | ||
465 | + */ | ||
466 | + public void setOtherConfig(Map<String, String> otherConfig) { | ||
467 | + ColumnDescription columndesc = new ColumnDescription( | ||
468 | + BridgeColumn.OTHERCONFIG | ||
469 | + .columnName(), | ||
470 | + "setOtherConfig", | ||
471 | + VersionNum.VERSION100); | ||
472 | + super.setDataHandler(columndesc, otherConfig); | ||
473 | + } | ||
474 | + | ||
475 | + /** | ||
476 | + * Get the Column entity which column name is "external_ids" from the Row | ||
477 | + * entity of attributes. | ||
478 | + * @return the Column entity which column name is "external_ids" | ||
479 | + */ | ||
480 | + public Column getExternalIdsColumn() { | ||
481 | + ColumnDescription columndesc = new ColumnDescription( | ||
482 | + BridgeColumn.EXTERNALIDS | ||
483 | + .columnName(), | ||
484 | + "getExternalIdsColumn", | ||
485 | + VersionNum.VERSION100); | ||
486 | + return (Column) super.getColumnHandler(columndesc); | ||
487 | + } | ||
488 | + | ||
489 | + /** | ||
490 | + * Add a Column entity which column name is "external_ids" to the Row entity | ||
491 | + * of attributes. | ||
492 | + * @param externalIds the column data which column name is "external_ids" | ||
493 | + */ | ||
494 | + public void setExternalIds(Map<String, String> externalIds) { | ||
495 | + ColumnDescription columndesc = new ColumnDescription( | ||
496 | + BridgeColumn.EXTERNALIDS | ||
497 | + .columnName(), | ||
498 | + "setExternalIds", | ||
499 | + VersionNum.VERSION100); | ||
500 | + super.setDataHandler(columndesc, externalIds); | ||
501 | + } | ||
502 | + | ||
503 | + /** | ||
504 | + * Get the Column entity which column name is "flood_vlans" from the Row | ||
505 | + * entity of attributes. | ||
506 | + * @return the Column entity which column name is "flood_vlans" | ||
507 | + */ | ||
508 | + public Column getFloodVlansColumn() { | ||
509 | + ColumnDescription columndesc = new ColumnDescription( | ||
510 | + BridgeColumn.FLOODVLANS | ||
511 | + .columnName(), | ||
512 | + "getFloodVlansColumn", | ||
513 | + VersionNum.VERSION100); | ||
514 | + return (Column) super.getColumnHandler(columndesc); | ||
515 | + } | ||
516 | + | ||
517 | + /** | ||
518 | + * Add a Column entity which column name is "flood_vlans" to the Row entity | ||
519 | + * of attributes. | ||
520 | + * @param vlans the column data which column name is "flood_vlans" | ||
521 | + */ | ||
522 | + public void setFloodVlans(Set<Long> vlans) { | ||
523 | + ColumnDescription columndesc = new ColumnDescription( | ||
524 | + BridgeColumn.FLOODVLANS | ||
525 | + .columnName(), | ||
526 | + "setFloodVlans", | ||
527 | + VersionNum.VERSION100); | ||
528 | + super.setDataHandler(columndesc, vlans); | ||
529 | + } | ||
530 | + | ||
531 | + /** | ||
532 | + * Get the Column entity which column name is "flow_tables" from the Row | ||
533 | + * entity of attributes. | ||
534 | + * @return the Column entity which column name is "flow_tables" | ||
535 | + */ | ||
536 | + public Column getFlowTablesColumn() { | ||
537 | + ColumnDescription columndesc = new ColumnDescription( | ||
538 | + BridgeColumn.FLOWTABLES | ||
539 | + .columnName(), | ||
540 | + "getFlowTablesColumn", | ||
541 | + VersionNum.VERSION650); | ||
542 | + return (Column) super.getColumnHandler(columndesc); | ||
543 | + } | ||
544 | + | ||
545 | + /** | ||
546 | + * Add a Column entity which column name is "flow_tables" to the Row entity | ||
547 | + * of attributes. | ||
548 | + * @param flowTables the column data which column name is "flow_tables" | ||
549 | + */ | ||
550 | + public void setFlowTables(Map<Long, UUID> flowTables) { | ||
551 | + ColumnDescription columndesc = new ColumnDescription( | ||
552 | + BridgeColumn.FLOWTABLES | ||
553 | + .columnName(), | ||
554 | + "setFlowTables", | ||
555 | + VersionNum.VERSION650); | ||
556 | + super.setDataHandler(columndesc, flowTables); | ||
557 | + } | ||
558 | + | ||
559 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.table; | ||
17 | + | ||
18 | +import java.util.Map; | ||
19 | +import java.util.Set; | ||
20 | + | ||
21 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
22 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
23 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
24 | +import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService; | ||
25 | +import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; | ||
26 | + | ||
27 | +/** | ||
28 | + * This class provides operations of Controller Table. | ||
29 | + */ | ||
30 | +public class Controller extends AbstractOvsdbTableService { | ||
31 | + | ||
32 | + /** | ||
33 | + * Controller table column name. | ||
34 | + */ | ||
35 | + public enum ControllerColumn { | ||
36 | + TARGET("target"), BURSTLIMIT("controller_burst_limit"), | ||
37 | + RATELIMIT("controller_rate_limit"), CONNECTIONMODE("connection_mode"), | ||
38 | + ENABLEASYNCMESSAGES("enable_async_messages"), | ||
39 | + EXTERNALIDS("external_ids"), LOCALNETMASK("local_netmask"), | ||
40 | + LOCALGATEWAY("local_gateway"), STATUS("status"), ROLE("role"), | ||
41 | + INACTIVITYPROBE("inactivity_probe"), ISCONNECTED("is_connected"), | ||
42 | + OTHERCONFIG("other_config"), MAXBACKOFF("max_backoff"), | ||
43 | + LOCALIP("local_ip"), | ||
44 | + DISCOVERUPDATERESOLVCONF("discover_update_resolv_conf"), | ||
45 | + DISCOVERACCEPTREGEX("discover_accept_regex"); | ||
46 | + | ||
47 | + private final String columnName; | ||
48 | + | ||
49 | + private ControllerColumn(String columnName) { | ||
50 | + this.columnName = columnName; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Returns the table column name for ControllerColumn. | ||
55 | + * @return the table column name | ||
56 | + */ | ||
57 | + public String columnName() { | ||
58 | + return columnName; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Constructs a Controller object. Generate Controller Table Description. | ||
64 | + * @param dbSchema DatabaseSchema | ||
65 | + * @param row Row | ||
66 | + */ | ||
67 | + public Controller(DatabaseSchema dbSchema, Row row) { | ||
68 | + super(dbSchema, row, OvsdbTable.CONTROLLER, VersionNum.VERSION100); | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Get the Column entity which column name is "target" from the Row entity | ||
73 | + * of attributes. | ||
74 | + * @return the Column entity which column name is "target" | ||
75 | + */ | ||
76 | + public Column getTargetColumn() { | ||
77 | + ColumnDescription columndesc = new ColumnDescription( | ||
78 | + ControllerColumn.TARGET | ||
79 | + .columnName(), | ||
80 | + "getTargetColumn", | ||
81 | + VersionNum.VERSION100); | ||
82 | + return (Column) super.getColumnHandler(columndesc); | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Add a Column entity which column name is "target" to the Row entity of | ||
87 | + * attributes. | ||
88 | + * @param target the column data which column name is "target" | ||
89 | + */ | ||
90 | + public void setTarget(String target) { | ||
91 | + ColumnDescription columndesc = new ColumnDescription( | ||
92 | + ControllerColumn.TARGET | ||
93 | + .columnName(), | ||
94 | + "setTarget", | ||
95 | + VersionNum.VERSION100); | ||
96 | + super.setDataHandler(columndesc, target); | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * Get the Column entity which column name is "controller_burst_limit" from | ||
101 | + * the Row entity of attributes. | ||
102 | + * @return the Column entity which column name is "controller_burst_limit" | ||
103 | + */ | ||
104 | + public Column getBurstLimitColumn() { | ||
105 | + ColumnDescription columndesc = new ColumnDescription( | ||
106 | + ControllerColumn.BURSTLIMIT | ||
107 | + .columnName(), | ||
108 | + "getBurstLimitColumn", | ||
109 | + VersionNum.VERSION100); | ||
110 | + return (Column) super.getColumnHandler(columndesc); | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * Add a Column entity which column name is "controller_burst_limit" to the | ||
115 | + * Row entity of attributes. | ||
116 | + * @param burstLimit the column data which column name is | ||
117 | + * "controller_burst_limit" | ||
118 | + */ | ||
119 | + public void setBurstLimit(Long burstLimit) { | ||
120 | + ColumnDescription columndesc = new ColumnDescription( | ||
121 | + ControllerColumn.BURSTLIMIT | ||
122 | + .columnName(), | ||
123 | + "setBurstLimit", | ||
124 | + VersionNum.VERSION100); | ||
125 | + super.setDataHandler(columndesc, burstLimit); | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * Get the Column entity which column name is "controller_rate_limit" from | ||
130 | + * the Row entity of attributes. | ||
131 | + * @return the Column entity which column name is "controller_rate_limit" | ||
132 | + */ | ||
133 | + public Column getRateLimitColumn() { | ||
134 | + ColumnDescription columndesc = new ColumnDescription( | ||
135 | + ControllerColumn.RATELIMIT | ||
136 | + .columnName(), | ||
137 | + "getRateLimitColumn", | ||
138 | + VersionNum.VERSION100); | ||
139 | + return (Column) super.getColumnHandler(columndesc); | ||
140 | + } | ||
141 | + | ||
142 | + /** | ||
143 | + * Add a Column entity which column name is "controller_rate_limit" to the | ||
144 | + * Row entity of attributes. | ||
145 | + * @param rateLimit the column data which column name is | ||
146 | + * "controller_rate_limit" | ||
147 | + */ | ||
148 | + public void setRateLimit(Long rateLimit) { | ||
149 | + ColumnDescription columndesc = new ColumnDescription( | ||
150 | + "controller_rate_limit", | ||
151 | + "setRateLimit", | ||
152 | + VersionNum.VERSION100); | ||
153 | + super.setDataHandler(columndesc, rateLimit); | ||
154 | + } | ||
155 | + | ||
156 | + /** | ||
157 | + * Get the Column entity which column name is "connection_mode" from the Row | ||
158 | + * entity of attributes. | ||
159 | + * @return the Column entity which column name is "connection_mode" | ||
160 | + */ | ||
161 | + public Column getConnectionModeColumn() { | ||
162 | + ColumnDescription columndesc = new ColumnDescription( | ||
163 | + "connection_mode", | ||
164 | + "getConnectionModeColumn", | ||
165 | + VersionNum.VERSION100); | ||
166 | + return (Column) super.getColumnHandler(columndesc); | ||
167 | + } | ||
168 | + | ||
169 | + /** | ||
170 | + * Add a Column entity which column name is "connection_mode" to the Row | ||
171 | + * entity of attributes. | ||
172 | + * @param connectionMode the column data which column name is | ||
173 | + * "connection_mode" | ||
174 | + */ | ||
175 | + public void setConnectionMode(Set<String> connectionMode) { | ||
176 | + ColumnDescription columndesc = new ColumnDescription( | ||
177 | + ControllerColumn.RATELIMIT | ||
178 | + .columnName(), | ||
179 | + "setConnectionMode", | ||
180 | + VersionNum.VERSION100); | ||
181 | + super.setDataHandler(columndesc, connectionMode); | ||
182 | + } | ||
183 | + | ||
184 | + /** | ||
185 | + * Get the Column entity which column name is "enable_async_messages" from | ||
186 | + * the Row entity of attributes. | ||
187 | + * @return the Column entity which column name is "enable_async_messages" | ||
188 | + */ | ||
189 | + public Column getEnableAsyncMessagesColumn() { | ||
190 | + ColumnDescription columndesc = new ColumnDescription( | ||
191 | + ControllerColumn.ENABLEASYNCMESSAGES | ||
192 | + .columnName(), | ||
193 | + "getEnableAsyncMessagesColumn", | ||
194 | + VersionNum.VERSION670); | ||
195 | + return (Column) super.getColumnHandler(columndesc); | ||
196 | + } | ||
197 | + | ||
198 | + /** | ||
199 | + * Add a Column entity which column name is "enable_async_messages" to the | ||
200 | + * Row entity of attributes. | ||
201 | + * @param enableAsyncMessages the column data which column name is | ||
202 | + * "enable_async_messages" | ||
203 | + */ | ||
204 | + public void setEnableAsyncMessages(Set<Boolean> enableAsyncMessages) { | ||
205 | + ColumnDescription columndesc = new ColumnDescription( | ||
206 | + ControllerColumn.ENABLEASYNCMESSAGES | ||
207 | + .columnName(), | ||
208 | + "setEnableAsyncMessages", | ||
209 | + VersionNum.VERSION670); | ||
210 | + super.setDataHandler(columndesc, enableAsyncMessages); | ||
211 | + } | ||
212 | + | ||
213 | + /** | ||
214 | + * Get the Column entity which column name is "external_ids" from the Row | ||
215 | + * entity of attributes. | ||
216 | + * @return the Column entity which column name is "external_ids" | ||
217 | + */ | ||
218 | + public Column getExternalIdsColumn() { | ||
219 | + ColumnDescription columndesc = new ColumnDescription( | ||
220 | + ControllerColumn.EXTERNALIDS | ||
221 | + .columnName(), | ||
222 | + "getExternalIdsColumn", | ||
223 | + VersionNum.VERSION100); | ||
224 | + return (Column) super.getColumnHandler(columndesc); | ||
225 | + } | ||
226 | + | ||
227 | + /** | ||
228 | + * Add a Column entity which column name is "external_ids" to the Row entity | ||
229 | + * of attributes. | ||
230 | + * @param externalIds the column data which column name is "external_ids" | ||
231 | + */ | ||
232 | + public void setExternalIds(Map<String, String> externalIds) { | ||
233 | + ColumnDescription columndesc = new ColumnDescription( | ||
234 | + ControllerColumn.EXTERNALIDS | ||
235 | + .columnName(), | ||
236 | + "setExternalIds", | ||
237 | + VersionNum.VERSION100); | ||
238 | + super.setDataHandler(columndesc, externalIds); | ||
239 | + } | ||
240 | + | ||
241 | + /** | ||
242 | + * Get the Column entity which column name is "local_netmask" from the Row | ||
243 | + * entity of attributes. | ||
244 | + * @return the Column entity which column name is "local_netmask" | ||
245 | + */ | ||
246 | + public Column getLocalNetmaskColumn() { | ||
247 | + ColumnDescription columndesc = new ColumnDescription( | ||
248 | + ControllerColumn.LOCALNETMASK | ||
249 | + .columnName(), | ||
250 | + "getLocalNetmaskColumn", | ||
251 | + VersionNum.VERSION100); | ||
252 | + return (Column) super.getColumnHandler(columndesc); | ||
253 | + } | ||
254 | + | ||
255 | + /** | ||
256 | + * Add a Column entity which column name is "local_netmask" to the Row | ||
257 | + * entity of attributes. | ||
258 | + * @param localNetmask the column data which column name is "local_netmask" | ||
259 | + */ | ||
260 | + public void setLocalNetmask(Set<String> localNetmask) { | ||
261 | + ColumnDescription columndesc = new ColumnDescription( | ||
262 | + ControllerColumn.LOCALNETMASK | ||
263 | + .columnName(), | ||
264 | + "setLocalNetmask", | ||
265 | + VersionNum.VERSION100); | ||
266 | + super.setDataHandler(columndesc, localNetmask); | ||
267 | + } | ||
268 | + | ||
269 | + /** | ||
270 | + * Get the Column entity which column name is "local_gateway" from the Row | ||
271 | + * entity of attributes. | ||
272 | + * @return the Column entity which column name is "local_gateway" | ||
273 | + */ | ||
274 | + public Column getLocalGatewayColumn() { | ||
275 | + ColumnDescription columndesc = new ColumnDescription( | ||
276 | + ControllerColumn.LOCALGATEWAY | ||
277 | + .columnName(), | ||
278 | + "getLocalGatewayColumn", | ||
279 | + VersionNum.VERSION100); | ||
280 | + return (Column) super.getColumnHandler(columndesc); | ||
281 | + } | ||
282 | + | ||
283 | + /** | ||
284 | + * Add a Column entity which column name is "local_gateway" to the Row | ||
285 | + * entity of attributes. | ||
286 | + * @param localGateway the column data which column name is "local_gateway" | ||
287 | + */ | ||
288 | + public void setLocalGateway(Set<String> localGateway) { | ||
289 | + ColumnDescription columndesc = new ColumnDescription( | ||
290 | + ControllerColumn.LOCALGATEWAY | ||
291 | + .columnName(), | ||
292 | + "setLocalGateway", | ||
293 | + VersionNum.VERSION100); | ||
294 | + super.setDataHandler(columndesc, localGateway); | ||
295 | + } | ||
296 | + | ||
297 | + /** | ||
298 | + * Get the Column entity which column name is "status" from the Row entity | ||
299 | + * of attributes. | ||
300 | + * @return the Column entity which column name is "status" | ||
301 | + */ | ||
302 | + public Column getStatusColumn() { | ||
303 | + ColumnDescription columndesc = new ColumnDescription( | ||
304 | + ControllerColumn.STATUS | ||
305 | + .columnName(), | ||
306 | + "getStatusColumn", | ||
307 | + VersionNum.VERSION100); | ||
308 | + return (Column) super.getColumnHandler(columndesc); | ||
309 | + } | ||
310 | + | ||
311 | + /** | ||
312 | + * Add a Column entity which column name is "status" to the Row entity of | ||
313 | + * attributes. | ||
314 | + * @param status the column data which column name is "status" | ||
315 | + */ | ||
316 | + public void setStatus(Map<String, String> status) { | ||
317 | + ColumnDescription columndesc = new ColumnDescription( | ||
318 | + ControllerColumn.STATUS | ||
319 | + .columnName(), | ||
320 | + "setStatus", | ||
321 | + VersionNum.VERSION100); | ||
322 | + super.setDataHandler(columndesc, status); | ||
323 | + } | ||
324 | + | ||
325 | + /** | ||
326 | + * Get the Column entity which column name is "role" from the Row entity of | ||
327 | + * attributes. | ||
328 | + * @return the Column entity which column name is "role" | ||
329 | + */ | ||
330 | + public Column getRoleColumn() { | ||
331 | + ColumnDescription columndesc = new ColumnDescription( | ||
332 | + ControllerColumn.ROLE | ||
333 | + .columnName(), | ||
334 | + "getRoleColumn", | ||
335 | + VersionNum.VERSION110); | ||
336 | + return (Column) super.getColumnHandler(columndesc); | ||
337 | + } | ||
338 | + | ||
339 | + /** | ||
340 | + * Add a Column entity which column name is "role" to the Row entity of | ||
341 | + * attributes. | ||
342 | + * @param role the column data which column name is "role" | ||
343 | + */ | ||
344 | + public void setRole(Set<String> role) { | ||
345 | + ColumnDescription columndesc = new ColumnDescription( | ||
346 | + ControllerColumn.ROLE | ||
347 | + .columnName(), | ||
348 | + "setRole", | ||
349 | + VersionNum.VERSION110); | ||
350 | + super.setDataHandler(columndesc, role); | ||
351 | + } | ||
352 | + | ||
353 | + /** | ||
354 | + * Get the Column entity which column name is "inactivity_probe" from the | ||
355 | + * Row entity of attributes. | ||
356 | + * @return the Column entity which column name is "inactivity_probe" | ||
357 | + */ | ||
358 | + public Column getInactivityProbeColumn() { | ||
359 | + ColumnDescription columndesc = new ColumnDescription( | ||
360 | + ControllerColumn.INACTIVITYPROBE | ||
361 | + .columnName(), | ||
362 | + "getInactivityProbeColumn", | ||
363 | + VersionNum.VERSION100); | ||
364 | + return (Column) super.getColumnHandler(columndesc); | ||
365 | + } | ||
366 | + | ||
367 | + /** | ||
368 | + * Add a Column entity which column name is "inactivity_probe" to the Row | ||
369 | + * entity of attributes. | ||
370 | + * @param inactivityProbe the column data which column name is | ||
371 | + * "inactivity_probe" | ||
372 | + */ | ||
373 | + public void setInactivityProbe(Set<Long> inactivityProbe) { | ||
374 | + ColumnDescription columndesc = new ColumnDescription( | ||
375 | + ControllerColumn.INACTIVITYPROBE | ||
376 | + .columnName(), | ||
377 | + "setInactivityProbe", | ||
378 | + VersionNum.VERSION100); | ||
379 | + super.setDataHandler(columndesc, inactivityProbe); | ||
380 | + } | ||
381 | + | ||
382 | + /** | ||
383 | + * Get the Column entity which column name is "is_connected" from the Row | ||
384 | + * entity of attributes. | ||
385 | + * @return the Column entity which column name is "is_connected" | ||
386 | + */ | ||
387 | + public Column getIsConnectedColumn() { | ||
388 | + ColumnDescription columndesc = new ColumnDescription( | ||
389 | + ControllerColumn.ISCONNECTED | ||
390 | + .columnName(), | ||
391 | + "getIsConnectedColumn", | ||
392 | + VersionNum.VERSION110); | ||
393 | + return (Column) super.getColumnHandler(columndesc); | ||
394 | + } | ||
395 | + | ||
396 | + /** | ||
397 | + * Add a Column entity which column name is "is_connected" to the Row entity | ||
398 | + * of attributes. | ||
399 | + * @param isConnected the column data which column name is "is_connected" | ||
400 | + */ | ||
401 | + public void setIsConnected(Boolean isConnected) { | ||
402 | + ColumnDescription columndesc = new ColumnDescription( | ||
403 | + ControllerColumn.ISCONNECTED | ||
404 | + .columnName(), | ||
405 | + "setIsConnected", | ||
406 | + VersionNum.VERSION110); | ||
407 | + super.setDataHandler(columndesc, isConnected); | ||
408 | + } | ||
409 | + | ||
410 | + /** | ||
411 | + * Get the Column entity which column name is "other_config" from the Row | ||
412 | + * entity of attributes. | ||
413 | + * @return the Column entity which column name is "other_config" | ||
414 | + */ | ||
415 | + public Column getOtherConfigColumn() { | ||
416 | + ColumnDescription columndesc = new ColumnDescription( | ||
417 | + ControllerColumn.OTHERCONFIG | ||
418 | + .columnName(), | ||
419 | + "getOtherConfigColumn", | ||
420 | + VersionNum.VERSION680); | ||
421 | + return (Column) super.getColumnHandler(columndesc); | ||
422 | + } | ||
423 | + | ||
424 | + /** | ||
425 | + * Add a Column entity which column name is "other_config" to the Row entity | ||
426 | + * of attributes. | ||
427 | + * @param otherConfig the column data which column name is "other_config" | ||
428 | + */ | ||
429 | + public void setOtherConfig(Map<String, String> otherConfig) { | ||
430 | + ColumnDescription columndesc = new ColumnDescription( | ||
431 | + ControllerColumn.OTHERCONFIG | ||
432 | + .columnName(), | ||
433 | + "setOtherConfig", | ||
434 | + VersionNum.VERSION680); | ||
435 | + super.setDataHandler(columndesc, otherConfig); | ||
436 | + } | ||
437 | + | ||
438 | + /** | ||
439 | + * Get the Column entity which column name is "max_backoff" from the Row | ||
440 | + * entity of attributes. | ||
441 | + * @return the Column entity which column name is "max_backoff" | ||
442 | + */ | ||
443 | + public Column getMaxBackoffColumn() { | ||
444 | + ColumnDescription columndesc = new ColumnDescription( | ||
445 | + ControllerColumn.MAXBACKOFF | ||
446 | + .columnName(), | ||
447 | + "getMaxBackoffColumn", | ||
448 | + VersionNum.VERSION100); | ||
449 | + return (Column) super.getColumnHandler(columndesc); | ||
450 | + } | ||
451 | + | ||
452 | + /** | ||
453 | + * Add a Column entity which column name is "max_backoff" to the Row entity | ||
454 | + * of attributes. | ||
455 | + * @param maxBackoff the column data which column name is "max_backoff" | ||
456 | + */ | ||
457 | + public void setMaxBackoff(Long maxBackoff) { | ||
458 | + ColumnDescription columndesc = new ColumnDescription( | ||
459 | + ControllerColumn.MAXBACKOFF | ||
460 | + .columnName(), | ||
461 | + "setMaxBackoff", | ||
462 | + VersionNum.VERSION100); | ||
463 | + super.setDataHandler(columndesc, maxBackoff); | ||
464 | + } | ||
465 | + | ||
466 | + /** | ||
467 | + * Get the Column entity which column name is "local_ip" from the Row entity | ||
468 | + * of attributes. | ||
469 | + * @return the Column entity which column name is "local_ip" | ||
470 | + */ | ||
471 | + public Column getLocalIpColumn() { | ||
472 | + ColumnDescription columndesc = new ColumnDescription( | ||
473 | + ControllerColumn.LOCALIP | ||
474 | + .columnName(), | ||
475 | + "getLocalIpColumn", | ||
476 | + VersionNum.VERSION100); | ||
477 | + return (Column) super.getColumnHandler(columndesc); | ||
478 | + } | ||
479 | + | ||
480 | + /** | ||
481 | + * Add a Column entity which column name is "local_ip" to the Row entity of | ||
482 | + * attributes. | ||
483 | + * @param localIp the column data which column name is "local_ip" | ||
484 | + */ | ||
485 | + public void setLocalIp(Set<String> localIp) { | ||
486 | + ColumnDescription columndesc = new ColumnDescription( | ||
487 | + ControllerColumn.LOCALIP | ||
488 | + .columnName(), | ||
489 | + "setLocalIp", | ||
490 | + VersionNum.VERSION100); | ||
491 | + super.setDataHandler(columndesc, localIp); | ||
492 | + } | ||
493 | + | ||
494 | + /** | ||
495 | + * Get the Column entity which column name is "discover_update_resolv_conf" | ||
496 | + * from the Row entity of attributes. | ||
497 | + * @return the Column entity which column name is | ||
498 | + * "discover_update_resolv_conf" | ||
499 | + */ | ||
500 | + public Column getDiscoverUpdateResolvConfColumn() { | ||
501 | + ColumnDescription columndesc = new ColumnDescription( | ||
502 | + ControllerColumn.DISCOVERUPDATERESOLVCONF | ||
503 | + .columnName(), | ||
504 | + "getDiscoverUpdateResolvConfColumn", | ||
505 | + VersionNum.VERSION100, | ||
506 | + VersionNum.VERSION300); | ||
507 | + return (Column) super.getColumnHandler(columndesc); | ||
508 | + } | ||
509 | + | ||
510 | + /** | ||
511 | + * Add a Column entity which column name is "discover_update_resolv_conf" to | ||
512 | + * the Row entity of attributes. | ||
513 | + * @param discoverUpdateResolvConf the column data which column name is | ||
514 | + * "discover_update_resolv_conf" | ||
515 | + */ | ||
516 | + public void setDiscoverUpdateResolvConf(Set<String> discoverUpdateResolvConf) { | ||
517 | + ColumnDescription columndesc = new ColumnDescription( | ||
518 | + ControllerColumn.DISCOVERUPDATERESOLVCONF | ||
519 | + .columnName(), | ||
520 | + "setDiscoverUpdateResolvConf", | ||
521 | + VersionNum.VERSION100, | ||
522 | + VersionNum.VERSION300); | ||
523 | + super.setDataHandler(columndesc, discoverUpdateResolvConf); | ||
524 | + } | ||
525 | + | ||
526 | + /** | ||
527 | + * Get the Column entity which column name is "discover_accept_regex" from | ||
528 | + * the Row entity of attributes. | ||
529 | + * @return the Column entity which column name is "discover_accept_regex" | ||
530 | + */ | ||
531 | + public Column getDiscoverAcceptRegexColumn() { | ||
532 | + ColumnDescription columndesc = new ColumnDescription( | ||
533 | + ControllerColumn.DISCOVERACCEPTREGEX | ||
534 | + .columnName(), | ||
535 | + "getDiscoverAcceptRegexColumn", | ||
536 | + VersionNum.VERSION100, | ||
537 | + VersionNum.VERSION300); | ||
538 | + return (Column) super.getColumnHandler(columndesc); | ||
539 | + } | ||
540 | + | ||
541 | + /** | ||
542 | + * Add a Column entity which column name is "discover_accept_regex" to the | ||
543 | + * Row entity of attributes. | ||
544 | + * @param discoverAcceptRegex the column data which column name is | ||
545 | + * "discover_accept_regex" | ||
546 | + */ | ||
547 | + public void setDiscoverAcceptRegex(Set<String> discoverAcceptRegex) { | ||
548 | + ColumnDescription columndesc = new ColumnDescription( | ||
549 | + ControllerColumn.DISCOVERACCEPTREGEX | ||
550 | + .columnName(), | ||
551 | + "setDiscoverAcceptRegex", | ||
552 | + VersionNum.VERSION100, | ||
553 | + VersionNum.VERSION300); | ||
554 | + super.setDataHandler(columndesc, discoverAcceptRegex); | ||
555 | + } | ||
556 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.table; | ||
17 | + | ||
18 | +import java.util.Map; | ||
19 | +import java.util.Set; | ||
20 | + | ||
21 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
22 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
23 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
24 | +import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService; | ||
25 | +import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; | ||
26 | + | ||
27 | +/** | ||
28 | + * This class provides operations of Interface Table. | ||
29 | + */ | ||
30 | +public class Interface extends AbstractOvsdbTableService { | ||
31 | + | ||
32 | + /** | ||
33 | + * Interface table column name. | ||
34 | + */ | ||
35 | + public enum InterfaceColumn { | ||
36 | + NAME("name"), TYPE("type"), OPTIONS("options"), | ||
37 | + INGRESSPOLICINGRATE("ingress_policing_rate"), | ||
38 | + INGRESSPOLICINGBURST("ingress_policing_burst"), MACINUSE("mac_in_use"), | ||
39 | + MAC("mac"), IFINDEX("ifindex"), EXTERNALIDS("external_ids"), | ||
40 | + OFPORT("ofport"), OFPORTREQUEST("ofport_request"), BFD("bfd"), | ||
41 | + BFDSTATUS("bfd_status"), MONITOR("monitor"), CFMMPID("cfm_mpid"), | ||
42 | + CFMREMOTEMPID("cfm_remote_mpid"), CFMREMOTEMPIDS("cfm_remote_mpids"), | ||
43 | + CFMFLAPCOUNT("cfm_flap_count"), CFMFAULT("cfm_fault"), | ||
44 | + CFMFAULTSTATUS("cfm_fault_status"), | ||
45 | + CFMREMOTEOPSTATE("cfm_remote_opstate"), CFMHEALTH("cfm_health"), | ||
46 | + LACPCURRENT("lacp_current"), OTHERCONFIG("other_config"), | ||
47 | + STATISTICS("statistics"), STATUS("status"), ADMINSTATE("admin_state"), | ||
48 | + LINKSTATE("link_state"), LINKRESETS("link_resets"), | ||
49 | + LINKSPEED("link_speed"), DUPLEX("duplex"), MTU("mtu"), ERROR("error"); | ||
50 | + | ||
51 | + private final String columnName; | ||
52 | + | ||
53 | + private InterfaceColumn(String columnName) { | ||
54 | + this.columnName = columnName; | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Returns the table column name for InterfaceColumn. | ||
59 | + * @return the table column name | ||
60 | + */ | ||
61 | + public String columnName() { | ||
62 | + return columnName; | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * Constructs a Interface object. Generate Interface Table Description. | ||
68 | + * @param dbSchema DatabaseSchema | ||
69 | + * @param row Row | ||
70 | + */ | ||
71 | + public Interface(DatabaseSchema dbSchema, Row row) { | ||
72 | + super(dbSchema, row, OvsdbTable.INTERFACE, VersionNum.VERSION100); | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * Get the Column entity which column name is "name" from the Row entity of | ||
77 | + * attributes. | ||
78 | + * @return the Column entity which column name is "name" | ||
79 | + */ | ||
80 | + public Column getNameColumn() { | ||
81 | + ColumnDescription columndesc = new ColumnDescription( | ||
82 | + InterfaceColumn.NAME | ||
83 | + .columnName(), | ||
84 | + "getNameColumn", | ||
85 | + VersionNum.VERSION100); | ||
86 | + return (Column) super.getColumnHandler(columndesc); | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Add a Column entity which column name is "name" to the Row entity of | ||
91 | + * attributes. | ||
92 | + * @param name the column data which column name is "name" | ||
93 | + */ | ||
94 | + public void setName(String name) { | ||
95 | + ColumnDescription columndesc = new ColumnDescription( | ||
96 | + InterfaceColumn.NAME | ||
97 | + .columnName(), | ||
98 | + "setName", | ||
99 | + VersionNum.VERSION100); | ||
100 | + super.setDataHandler(columndesc, name); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * Get the column data which column name is "name" from the Row entity of | ||
105 | + * attributes. | ||
106 | + * @return the column data which column name is "name" | ||
107 | + */ | ||
108 | + public String getName() { | ||
109 | + ColumnDescription columndesc = new ColumnDescription( | ||
110 | + InterfaceColumn.NAME | ||
111 | + .columnName(), | ||
112 | + "getName", | ||
113 | + VersionNum.VERSION100); | ||
114 | + return (String) super.getDataHandler(columndesc); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * Get the Column entity which column name is "type" from the Row entity of | ||
119 | + * attributes. | ||
120 | + * @return the Column entity which column name is "type" | ||
121 | + */ | ||
122 | + public Column getTypeColumn() { | ||
123 | + ColumnDescription columndesc = new ColumnDescription( | ||
124 | + InterfaceColumn.TYPE | ||
125 | + .columnName(), | ||
126 | + "getTypeColumn", | ||
127 | + VersionNum.VERSION100); | ||
128 | + return (Column) super.getColumnHandler(columndesc); | ||
129 | + } | ||
130 | + | ||
131 | + /** | ||
132 | + * Add a Column entity which column name is "type" to the Row entity of | ||
133 | + * attributes. | ||
134 | + * @param type the column data which column name is "type" | ||
135 | + */ | ||
136 | + public void setType(String type) { | ||
137 | + ColumnDescription columndesc = new ColumnDescription( | ||
138 | + InterfaceColumn.TYPE | ||
139 | + .columnName(), | ||
140 | + "setType", | ||
141 | + VersionNum.VERSION100); | ||
142 | + super.setDataHandler(columndesc, type); | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * Get the Column entity which column name is "options" from the Row entity | ||
147 | + * of attributes. | ||
148 | + * @return the Column entity which column name is "options" | ||
149 | + */ | ||
150 | + public Column getOptionsColumn() { | ||
151 | + ColumnDescription columndesc = new ColumnDescription( | ||
152 | + InterfaceColumn.OPTIONS | ||
153 | + .columnName(), | ||
154 | + "getOptionsColumn", | ||
155 | + VersionNum.VERSION100); | ||
156 | + return (Column) super.getColumnHandler(columndesc); | ||
157 | + } | ||
158 | + | ||
159 | + /** | ||
160 | + * Add a Column entity which column name is "options" to the Row entity of | ||
161 | + * attributes. | ||
162 | + * @param options the column data which column name is "options" | ||
163 | + */ | ||
164 | + public void setOptions(Map<String, String> options) { | ||
165 | + ColumnDescription columndesc = new ColumnDescription( | ||
166 | + InterfaceColumn.OPTIONS | ||
167 | + .columnName(), | ||
168 | + "setOptions", | ||
169 | + VersionNum.VERSION100); | ||
170 | + super.setDataHandler(columndesc, options); | ||
171 | + } | ||
172 | + | ||
173 | + /** | ||
174 | + * Get the Column entity which column name is "ingress_policing_rate" from | ||
175 | + * the Row entity of attributes. | ||
176 | + * @return the Column entity which column name is "ingress_policing_rate" | ||
177 | + */ | ||
178 | + public Column getIngressPolicingRateColumn() { | ||
179 | + ColumnDescription columndesc = new ColumnDescription( | ||
180 | + InterfaceColumn.INGRESSPOLICINGRATE | ||
181 | + .columnName(), | ||
182 | + "getIngressPolicingRateColumn", | ||
183 | + VersionNum.VERSION100); | ||
184 | + return (Column) super.getColumnHandler(columndesc); | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * Add a Column entity which column name is "ingress_policing_rate" to the | ||
189 | + * Row entity of attributes. | ||
190 | + * @param ingressPolicingRate the column data which column name is | ||
191 | + * "ingress_policing_rate" | ||
192 | + */ | ||
193 | + public void setIngressPolicingRate(Set<Long> ingressPolicingRate) { | ||
194 | + ColumnDescription columndesc = new ColumnDescription( | ||
195 | + InterfaceColumn.INGRESSPOLICINGRATE | ||
196 | + .columnName(), | ||
197 | + "setIngressPolicingRate", | ||
198 | + VersionNum.VERSION100); | ||
199 | + super.setDataHandler(columndesc, ingressPolicingRate); | ||
200 | + } | ||
201 | + | ||
202 | + /** | ||
203 | + * Get the Column entity which column name is "ingress_policing_burst" from | ||
204 | + * the Row entity of attributes. | ||
205 | + * @return the Column entity which column name is "ingress_policing_burst" | ||
206 | + */ | ||
207 | + public Column getIngressPolicingBurstColumn() { | ||
208 | + ColumnDescription columndesc = new ColumnDescription( | ||
209 | + InterfaceColumn.INGRESSPOLICINGBURST | ||
210 | + .columnName(), | ||
211 | + "getIngressPolicingBurstColumn", | ||
212 | + VersionNum.VERSION100); | ||
213 | + return (Column) super.getColumnHandler(columndesc); | ||
214 | + } | ||
215 | + | ||
216 | + /** | ||
217 | + * Add a Column entity which column name is "ingress_policing_burst" to the | ||
218 | + * Row entity of attributes. | ||
219 | + * @param ingressPolicingBurst the column data which column name is | ||
220 | + * "ingress_policing_burst" | ||
221 | + */ | ||
222 | + public void setIngressPolicingBurst(Set<Long> ingressPolicingBurst) { | ||
223 | + ColumnDescription columndesc = new ColumnDescription( | ||
224 | + InterfaceColumn.INGRESSPOLICINGBURST | ||
225 | + .columnName(), | ||
226 | + "setIngressPolicingBurst", | ||
227 | + VersionNum.VERSION100); | ||
228 | + super.setDataHandler(columndesc, ingressPolicingBurst); | ||
229 | + } | ||
230 | + | ||
231 | + /** | ||
232 | + * Get the Column entity which column name is "mac_in_use" from the Row | ||
233 | + * entity of attributes. | ||
234 | + * @return the Column entity which column name is "mac_in_use" | ||
235 | + */ | ||
236 | + public Column getMacInUseColumn() { | ||
237 | + ColumnDescription columndesc = new ColumnDescription( | ||
238 | + InterfaceColumn.MACINUSE | ||
239 | + .columnName(), | ||
240 | + "getMacInUseColumn", | ||
241 | + VersionNum.VERSION710); | ||
242 | + return (Column) super.getColumnHandler(columndesc); | ||
243 | + } | ||
244 | + | ||
245 | + /** | ||
246 | + * Add a Column entity which column name is "mac_in_use" to the Row entity | ||
247 | + * of attributes. | ||
248 | + * @param macInUse the column data which column name is "mac_in_use" | ||
249 | + */ | ||
250 | + public void setMacInUse(Set<String> macInUse) { | ||
251 | + ColumnDescription columndesc = new ColumnDescription( | ||
252 | + InterfaceColumn.MACINUSE | ||
253 | + .columnName(), | ||
254 | + "setMacInUse", | ||
255 | + VersionNum.VERSION710); | ||
256 | + super.setDataHandler(columndesc, macInUse); | ||
257 | + } | ||
258 | + | ||
259 | + /** | ||
260 | + * Get the Column entity which column name is "mac" from the Row entity of | ||
261 | + * attributes. | ||
262 | + * @return the Column entity which column name is "mac" | ||
263 | + */ | ||
264 | + public Column getMacColumn() { | ||
265 | + ColumnDescription columndesc = new ColumnDescription( | ||
266 | + InterfaceColumn.MAC | ||
267 | + .columnName(), | ||
268 | + "getMacColumn", | ||
269 | + VersionNum.VERSION100); | ||
270 | + return (Column) super.getColumnHandler(columndesc); | ||
271 | + } | ||
272 | + | ||
273 | + /** | ||
274 | + * Add a Column entity which column name is "mac" to the Row entity of | ||
275 | + * attributes. | ||
276 | + * @param mac the column data which column name is "mac" | ||
277 | + */ | ||
278 | + public void setMac(Set<String> mac) { | ||
279 | + ColumnDescription columndesc = new ColumnDescription( | ||
280 | + InterfaceColumn.MAC | ||
281 | + .columnName(), | ||
282 | + "setMac", | ||
283 | + VersionNum.VERSION100); | ||
284 | + super.setDataHandler(columndesc, mac); | ||
285 | + } | ||
286 | + | ||
287 | + /** | ||
288 | + * Get the Column entity which column name is "ifindex" from the Row entity | ||
289 | + * of attributes. | ||
290 | + * @return the Column entity which column name is "ifindex" | ||
291 | + */ | ||
292 | + public Column getIfIndexColumn() { | ||
293 | + ColumnDescription columndesc = new ColumnDescription( | ||
294 | + InterfaceColumn.IFINDEX | ||
295 | + .columnName(), | ||
296 | + "getIfIndexColumn", | ||
297 | + VersionNum.VERSION721); | ||
298 | + return (Column) super.getColumnHandler(columndesc); | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
302 | + * Add a Column entity which column name is "ifindex" to the Row entity of | ||
303 | + * attributes. | ||
304 | + * @param ifIndex the column data which column name is "ifindex" | ||
305 | + */ | ||
306 | + public void setIfIndex(Long ifIndex) { | ||
307 | + ColumnDescription columndesc = new ColumnDescription( | ||
308 | + InterfaceColumn.IFINDEX | ||
309 | + .columnName(), | ||
310 | + "setIfIndex", | ||
311 | + VersionNum.VERSION721); | ||
312 | + super.setDataHandler(columndesc, ifIndex); | ||
313 | + } | ||
314 | + | ||
315 | + /** | ||
316 | + * Get the Column entity which column name is "external_ids" from the Row | ||
317 | + * entity of attributes. | ||
318 | + * @return the Column entity which column name is "external_ids" | ||
319 | + */ | ||
320 | + public Column getExternalIdsColumn() { | ||
321 | + ColumnDescription columndesc = new ColumnDescription( | ||
322 | + InterfaceColumn.EXTERNALIDS | ||
323 | + .columnName(), | ||
324 | + "getExternalIdsColumn", | ||
325 | + VersionNum.VERSION100); | ||
326 | + return (Column) super.getColumnHandler(columndesc); | ||
327 | + } | ||
328 | + | ||
329 | + /** | ||
330 | + * Add a Column entity which column name is "external_ids" to the Row entity | ||
331 | + * of attributes. | ||
332 | + * @param externalIds the column data which column name is "external_ids" | ||
333 | + */ | ||
334 | + public void setExternalIds(Map<String, String> externalIds) { | ||
335 | + ColumnDescription columndesc = new ColumnDescription( | ||
336 | + InterfaceColumn.EXTERNALIDS | ||
337 | + .columnName(), | ||
338 | + "setExternalIds", | ||
339 | + VersionNum.VERSION100); | ||
340 | + super.setDataHandler(columndesc, externalIds); | ||
341 | + } | ||
342 | + | ||
343 | + /** | ||
344 | + * Get the Column entity which column name is "ofport" from the Row entity | ||
345 | + * of attributes. | ||
346 | + * @return the Column entity which column name is "ofport" | ||
347 | + */ | ||
348 | + public Column getOpenFlowPortColumn() { | ||
349 | + ColumnDescription columndesc = new ColumnDescription( | ||
350 | + InterfaceColumn.OFPORT | ||
351 | + .columnName(), | ||
352 | + "getOpenFlowPortColumn", | ||
353 | + VersionNum.VERSION100); | ||
354 | + return (Column) super.getColumnHandler(columndesc); | ||
355 | + } | ||
356 | + | ||
357 | + /** | ||
358 | + * Add a Column entity which column name is "ofport" to the Row entity of | ||
359 | + * attributes. | ||
360 | + * @param openFlowPort the column data which column name is "ofport" | ||
361 | + */ | ||
362 | + public void setOpenFlowPort(Set<Long> openFlowPort) { | ||
363 | + ColumnDescription columndesc = new ColumnDescription( | ||
364 | + InterfaceColumn.OFPORT | ||
365 | + .columnName(), | ||
366 | + "setOpenFlowPort", | ||
367 | + VersionNum.VERSION100); | ||
368 | + super.setDataHandler(columndesc, openFlowPort); | ||
369 | + } | ||
370 | + | ||
371 | + /** | ||
372 | + * Get the Column entity which column name is "ofport_request" from the Row | ||
373 | + * entity of attributes. | ||
374 | + * @return the Column entity which column name is "ofport_request" | ||
375 | + */ | ||
376 | + public Column getOpenFlowPortRequestColumn() { | ||
377 | + ColumnDescription columndesc = new ColumnDescription( | ||
378 | + InterfaceColumn.OFPORTREQUEST | ||
379 | + .columnName(), | ||
380 | + "getOpenFlowPortRequestColumn", | ||
381 | + VersionNum.VERSION620); | ||
382 | + return (Column) super.getColumnHandler(columndesc); | ||
383 | + } | ||
384 | + | ||
385 | + /** | ||
386 | + * Add a Column entity which column name is "ofport_request" to the Row | ||
387 | + * entity of attributes. | ||
388 | + * @param openFlowPortRequest the column data which column name is | ||
389 | + * "ofport_request" | ||
390 | + */ | ||
391 | + public void setOpenFlowPortRequest(String openFlowPortRequest) { | ||
392 | + ColumnDescription columndesc = new ColumnDescription( | ||
393 | + InterfaceColumn.OFPORTREQUEST | ||
394 | + .columnName(), | ||
395 | + "setOpenFlowPortRequest", | ||
396 | + VersionNum.VERSION620); | ||
397 | + super.setDataHandler(columndesc, openFlowPortRequest); | ||
398 | + } | ||
399 | + | ||
400 | + /** | ||
401 | + * Get the Column entity which column name is "bfd" from the Row entity of | ||
402 | + * attributes. | ||
403 | + * @return the Column entity which column name is "bfd" | ||
404 | + */ | ||
405 | + public Column getBfdColumn() { | ||
406 | + ColumnDescription columndesc = new ColumnDescription( | ||
407 | + InterfaceColumn.BFD | ||
408 | + .columnName(), | ||
409 | + "getBfdColumn", | ||
410 | + VersionNum.VERSION720); | ||
411 | + return (Column) super.getColumnHandler(columndesc); | ||
412 | + } | ||
413 | + | ||
414 | + /** | ||
415 | + * Add a Column entity which column name is "bfd" to the Row entity of | ||
416 | + * attributes. | ||
417 | + * @param bfd the column data which column name is "bfd" | ||
418 | + */ | ||
419 | + public void setBfd(Map<String, String> bfd) { | ||
420 | + ColumnDescription columndesc = new ColumnDescription( | ||
421 | + InterfaceColumn.BFD | ||
422 | + .columnName(), | ||
423 | + "setBfd", | ||
424 | + VersionNum.VERSION720); | ||
425 | + super.setDataHandler(columndesc, bfd); | ||
426 | + } | ||
427 | + | ||
428 | + /** | ||
429 | + * Get the Column entity which column name is "bfd_status" from the Row | ||
430 | + * entity of attributes. | ||
431 | + * @return the Column entity which column name is "bfd_status" | ||
432 | + */ | ||
433 | + public Column getBfdStatusColumn() { | ||
434 | + ColumnDescription columndesc = new ColumnDescription( | ||
435 | + InterfaceColumn.BFDSTATUS | ||
436 | + .columnName(), | ||
437 | + "getBfdStatusColumn", | ||
438 | + VersionNum.VERSION720); | ||
439 | + return (Column) super.getColumnHandler(columndesc); | ||
440 | + } | ||
441 | + | ||
442 | + /** | ||
443 | + * Add a Column entity which column name is "bfd_status" to the Row entity | ||
444 | + * of attributes. | ||
445 | + * @param bfdStatus the column data which column name is "bfd_status" | ||
446 | + */ | ||
447 | + public void setBfdStatus(Map<String, String> bfdStatus) { | ||
448 | + ColumnDescription columndesc = new ColumnDescription( | ||
449 | + InterfaceColumn.BFDSTATUS | ||
450 | + .columnName(), | ||
451 | + "setBfdStatus", | ||
452 | + VersionNum.VERSION720); | ||
453 | + super.setDataHandler(columndesc, bfdStatus); | ||
454 | + } | ||
455 | + | ||
456 | + /** | ||
457 | + * Get the Column entity which column name is "monitor" from the Row entity | ||
458 | + * of attributes. | ||
459 | + * @return the Column entity which column name is "monitor" | ||
460 | + */ | ||
461 | + public Column getMonitorColumn() { | ||
462 | + ColumnDescription columndesc = new ColumnDescription( | ||
463 | + InterfaceColumn.MONITOR | ||
464 | + .columnName(), | ||
465 | + "getMonitorColumn", | ||
466 | + VersionNum.VERSION100, | ||
467 | + VersionNum.VERSION350); | ||
468 | + return (Column) super.getColumnHandler(columndesc); | ||
469 | + } | ||
470 | + | ||
471 | + /** | ||
472 | + * Add a Column entity which column name is "monitor" to the Row entity of | ||
473 | + * attributes. | ||
474 | + * @param monitor the column data which column name is "monitor" | ||
475 | + */ | ||
476 | + public void setMonitor(String monitor) { | ||
477 | + ColumnDescription columndesc = new ColumnDescription( | ||
478 | + InterfaceColumn.MONITOR | ||
479 | + .columnName(), | ||
480 | + "setMonitor", | ||
481 | + VersionNum.VERSION100, | ||
482 | + VersionNum.VERSION350); | ||
483 | + super.setDataHandler(columndesc, monitor); | ||
484 | + } | ||
485 | + | ||
486 | + /** | ||
487 | + * Get the Column entity which column name is "cfm_mpid" from the Row entity | ||
488 | + * of attributes. | ||
489 | + * @return the Column entity which column name is "cfm_mpid" | ||
490 | + */ | ||
491 | + public Column getCfmMpidColumn() { | ||
492 | + ColumnDescription columndesc = new ColumnDescription( | ||
493 | + InterfaceColumn.CFMMPID | ||
494 | + .columnName(), | ||
495 | + "getCfmMpidColumn", | ||
496 | + VersionNum.VERSION400); | ||
497 | + return (Column) super.getColumnHandler(columndesc); | ||
498 | + } | ||
499 | + | ||
500 | + /** | ||
501 | + * Add a Column entity which column name is "cfm_mpid" to the Row entity of | ||
502 | + * attributes. | ||
503 | + * @param cfmMpid the column data which column name is "cfm_mpid" | ||
504 | + */ | ||
505 | + public void setCfmMpid(Set<Long> cfmMpid) { | ||
506 | + ColumnDescription columndesc = new ColumnDescription( | ||
507 | + InterfaceColumn.CFMMPID | ||
508 | + .columnName(), | ||
509 | + "setCfmMpid", | ||
510 | + VersionNum.VERSION400); | ||
511 | + super.setDataHandler(columndesc, cfmMpid); | ||
512 | + } | ||
513 | + | ||
514 | + /** | ||
515 | + * Get the Column entity which column name is "cfm_remote_mpid" from the Row | ||
516 | + * entity of attributes. | ||
517 | + * @return the Column entity which column name is "cfm_remote_mpid" | ||
518 | + */ | ||
519 | + public Column getCfmRemoteMpidColumn() { | ||
520 | + ColumnDescription columndesc = new ColumnDescription( | ||
521 | + InterfaceColumn.CFMREMOTEMPID | ||
522 | + .columnName(), | ||
523 | + "getCfmRemoteMpidColumn", | ||
524 | + VersionNum.VERSION400, | ||
525 | + VersionNum.VERSION520); | ||
526 | + return (Column) super.getColumnHandler(columndesc); | ||
527 | + } | ||
528 | + | ||
529 | + /** | ||
530 | + * Add a Column entity which column name is "cfm_remote_mpid" to the Row | ||
531 | + * entity of attributes. | ||
532 | + * @param cfmRemoteMpid the column data which column name is | ||
533 | + * "cfm_remote_mpid" | ||
534 | + */ | ||
535 | + public void setCfmRemoteMpid(Set<Long> cfmRemoteMpid) { | ||
536 | + ColumnDescription columndesc = new ColumnDescription( | ||
537 | + InterfaceColumn.CFMREMOTEMPID | ||
538 | + .columnName(), | ||
539 | + "setCfmRemoteMpid", | ||
540 | + VersionNum.VERSION400, | ||
541 | + VersionNum.VERSION520); | ||
542 | + super.setDataHandler(columndesc, cfmRemoteMpid); | ||
543 | + } | ||
544 | + | ||
545 | + /** | ||
546 | + * Get the Column entity which column name is "cfm_remote_mpids" from the | ||
547 | + * Row entity of attributes. | ||
548 | + * @return the Column entity which column name is "cfm_remote_mpids" | ||
549 | + */ | ||
550 | + public Column getCfmRemoteMpidsColumn() { | ||
551 | + ColumnDescription columndesc = new ColumnDescription( | ||
552 | + InterfaceColumn.CFMREMOTEMPIDS | ||
553 | + .columnName(), | ||
554 | + "getCfmRemoteMpidsColumn", | ||
555 | + VersionNum.VERSION600); | ||
556 | + return (Column) super.getColumnHandler(columndesc); | ||
557 | + } | ||
558 | + | ||
559 | + /** | ||
560 | + * Add a Column entity which column name is "cfm_remote_mpids" to the Row | ||
561 | + * entity of attributes. | ||
562 | + * @param cfmRemoteMpids the column data which column name is | ||
563 | + * "cfm_remote_mpids" | ||
564 | + */ | ||
565 | + public void setCfmRemoteMpids(Set<Long> cfmRemoteMpids) { | ||
566 | + ColumnDescription columndesc = new ColumnDescription( | ||
567 | + InterfaceColumn.CFMREMOTEMPIDS | ||
568 | + .columnName(), | ||
569 | + "setCfmRemoteMpids", | ||
570 | + VersionNum.VERSION600); | ||
571 | + super.setDataHandler(columndesc, cfmRemoteMpids); | ||
572 | + } | ||
573 | + | ||
574 | + /** | ||
575 | + * Get the Column entity which column name is "cfm_flap_count" from the Row | ||
576 | + * entity of attributes. | ||
577 | + * @return the Column entity which column name is "cfm_flap_count" | ||
578 | + */ | ||
579 | + public Column getCfmFlapCountColumn() { | ||
580 | + ColumnDescription columndesc = new ColumnDescription( | ||
581 | + InterfaceColumn.CFMFLAPCOUNT | ||
582 | + .columnName(), | ||
583 | + "getCfmFlapCountColumn", | ||
584 | + VersionNum.VERSION730); | ||
585 | + return (Column) super.getColumnHandler(columndesc); | ||
586 | + } | ||
587 | + | ||
588 | + /** | ||
589 | + * Add a Column entity which column name is "cfm_flap_count" to the Row | ||
590 | + * entity of attributes. | ||
591 | + * @param cfmFlapCount the column data which column name is "cfm_flap_count" | ||
592 | + */ | ||
593 | + public void setCfmFlapCount(Set<Long> cfmFlapCount) { | ||
594 | + ColumnDescription columndesc = new ColumnDescription( | ||
595 | + InterfaceColumn.CFMFLAPCOUNT | ||
596 | + .columnName(), | ||
597 | + "setCfmFlapCount", | ||
598 | + VersionNum.VERSION730); | ||
599 | + super.setDataHandler(columndesc, cfmFlapCount); | ||
600 | + } | ||
601 | + | ||
602 | + /** | ||
603 | + * Get the Column entity which column name is "cfm_fault" from the Row | ||
604 | + * entity of attributes. | ||
605 | + * @return the Column entity which column name is "cfm_fault" | ||
606 | + */ | ||
607 | + public Column getCfmFaultColumn() { | ||
608 | + ColumnDescription columndesc = new ColumnDescription( | ||
609 | + InterfaceColumn.CFMFAULT | ||
610 | + .columnName(), | ||
611 | + "getCfmFaultColumn", | ||
612 | + VersionNum.VERSION400); | ||
613 | + return (Column) super.getColumnHandler(columndesc); | ||
614 | + } | ||
615 | + | ||
616 | + /** | ||
617 | + * Add a Column entity which column name is "cfm_fault" to the Row entity of | ||
618 | + * attributes. | ||
619 | + * @param cfmFault the column data which column name is "cfm_fault" | ||
620 | + */ | ||
621 | + public void setCfmFault(Set<Boolean> cfmFault) { | ||
622 | + ColumnDescription columndesc = new ColumnDescription( | ||
623 | + InterfaceColumn.CFMFAULT | ||
624 | + .columnName(), | ||
625 | + "setCfmFault", | ||
626 | + VersionNum.VERSION400); | ||
627 | + super.setDataHandler(columndesc, cfmFault); | ||
628 | + } | ||
629 | + | ||
630 | + /** | ||
631 | + * Get the Column entity which column name is "cfm_fault_status" from the | ||
632 | + * Row entity of attributes. | ||
633 | + * @return the Column entity which column name is "cfm_fault_status" | ||
634 | + */ | ||
635 | + public Column getCfmFaultStatusColumn() { | ||
636 | + ColumnDescription columndesc = new ColumnDescription( | ||
637 | + InterfaceColumn.CFMFAULTSTATUS | ||
638 | + .columnName(), | ||
639 | + "getCfmFaultStatusColumn", | ||
640 | + VersionNum.VERSION660); | ||
641 | + return (Column) super.getColumnHandler(columndesc); | ||
642 | + } | ||
643 | + | ||
644 | + /** | ||
645 | + * Add a Column entity which column name is "cfm_fault_status" to the Row | ||
646 | + * entity of attributes. | ||
647 | + * @param cfmFaultStatus the column data which column name is | ||
648 | + * "cfm_fault_status" | ||
649 | + */ | ||
650 | + public void setCfmFaultStatus(Set<String> cfmFaultStatus) { | ||
651 | + ColumnDescription columndesc = new ColumnDescription( | ||
652 | + InterfaceColumn.CFMFAULTSTATUS | ||
653 | + .columnName(), | ||
654 | + "setCfmFaultStatus", | ||
655 | + VersionNum.VERSION660); | ||
656 | + super.setDataHandler(columndesc, cfmFaultStatus); | ||
657 | + } | ||
658 | + | ||
659 | + /** | ||
660 | + * Get the Column entity which column name is "cfm_remote_opstate" from the | ||
661 | + * Row entity of attributes. | ||
662 | + * @return the Column entity which column name is "cfm_remote_opstate" | ||
663 | + */ | ||
664 | + public Column getCfmRemoteOpStateColumn() { | ||
665 | + ColumnDescription columndesc = new ColumnDescription( | ||
666 | + InterfaceColumn.CFMREMOTEOPSTATE | ||
667 | + .columnName(), | ||
668 | + "getCfmRemoteOpStateColumn", | ||
669 | + VersionNum.VERSION6100); | ||
670 | + return (Column) super.getColumnHandler(columndesc); | ||
671 | + } | ||
672 | + | ||
673 | + /** | ||
674 | + * Add a Column entity which column name is "cfm_remote_opstate" to the Row | ||
675 | + * entity of attributes. | ||
676 | + * @param cfmRemoteOpState the column data which column name is | ||
677 | + * "cfm_remote_opstate" | ||
678 | + */ | ||
679 | + public void setCfmRemoteOpState(Set<String> cfmRemoteOpState) { | ||
680 | + ColumnDescription columndesc = new ColumnDescription( | ||
681 | + InterfaceColumn.CFMREMOTEOPSTATE | ||
682 | + .columnName(), | ||
683 | + "setCfmRemoteOpState", | ||
684 | + VersionNum.VERSION6100); | ||
685 | + super.setDataHandler(columndesc, cfmRemoteOpState); | ||
686 | + } | ||
687 | + | ||
688 | + /** | ||
689 | + * Get the Column entity which column name is "cfm_health" from the Row | ||
690 | + * entity of attributes. | ||
691 | + * @return the Column entity which column name is "cfm_health" | ||
692 | + */ | ||
693 | + public Column getCfmHealthColumn() { | ||
694 | + ColumnDescription columndesc = new ColumnDescription( | ||
695 | + InterfaceColumn.CFMHEALTH | ||
696 | + .columnName(), | ||
697 | + "getCfmHealthColumn", | ||
698 | + VersionNum.VERSION690); | ||
699 | + return (Column) super.getColumnHandler(columndesc); | ||
700 | + } | ||
701 | + | ||
702 | + /** | ||
703 | + * Add a Column entity which column name is "cfm_health" to the Row entity | ||
704 | + * of attributes. | ||
705 | + * @param cfmHealth the column data which column name is "cfm_health" | ||
706 | + */ | ||
707 | + public void setCfmHealth(Set<Long> cfmHealth) { | ||
708 | + ColumnDescription columndesc = new ColumnDescription( | ||
709 | + InterfaceColumn.CFMHEALTH | ||
710 | + .columnName(), | ||
711 | + "setCfmHealth", | ||
712 | + VersionNum.VERSION690); | ||
713 | + super.setDataHandler(columndesc, cfmHealth); | ||
714 | + } | ||
715 | + | ||
716 | + /** | ||
717 | + * Get the Column entity which column name is "lacp_current" from the Row | ||
718 | + * entity of attributes. | ||
719 | + * @return the Column entity which column name is "lacp_current" | ||
720 | + */ | ||
721 | + public Column getLacpCurrentColumn() { | ||
722 | + ColumnDescription columndesc = new ColumnDescription( | ||
723 | + InterfaceColumn.LACPCURRENT | ||
724 | + .columnName(), | ||
725 | + "getLacpCurrentColumn", | ||
726 | + VersionNum.VERSION330); | ||
727 | + return (Column) super.getColumnHandler(columndesc); | ||
728 | + } | ||
729 | + | ||
730 | + /** | ||
731 | + * Add a Column entity which column name is "lacp_current" to the Row entity | ||
732 | + * of attributes. | ||
733 | + * @param lacpCurrent the column data which column name is "lacp_current" | ||
734 | + */ | ||
735 | + public void setLacpCurrent(Set<Boolean> lacpCurrent) { | ||
736 | + ColumnDescription columndesc = new ColumnDescription( | ||
737 | + InterfaceColumn.LACPCURRENT | ||
738 | + .columnName(), | ||
739 | + "setLacpCurrent", | ||
740 | + VersionNum.VERSION330); | ||
741 | + super.setDataHandler(columndesc, lacpCurrent); | ||
742 | + } | ||
743 | + | ||
744 | + /** | ||
745 | + * Get the Column entity which column name is "other_config" from the Row | ||
746 | + * entity of attributes. | ||
747 | + * @return the Column entity which column name is "other_config" | ||
748 | + */ | ||
749 | + public Column getOtherConfigColumn() { | ||
750 | + ColumnDescription columndesc = new ColumnDescription( | ||
751 | + InterfaceColumn.OTHERCONFIG | ||
752 | + .columnName(), | ||
753 | + "getOtherConfigColumn", | ||
754 | + VersionNum.VERSION100); | ||
755 | + return (Column) super.getColumnHandler(columndesc); | ||
756 | + } | ||
757 | + | ||
758 | + /** | ||
759 | + * Add a Column entity which column name is "other_config" to the Row entity | ||
760 | + * of attributes. | ||
761 | + * @param otherConfig the column data which column name is "other_config" | ||
762 | + */ | ||
763 | + public void setOtherConfig(Map<String, String> otherConfig) { | ||
764 | + ColumnDescription columndesc = new ColumnDescription( | ||
765 | + InterfaceColumn.OTHERCONFIG | ||
766 | + .columnName(), | ||
767 | + "setOtherConfig", | ||
768 | + VersionNum.VERSION100); | ||
769 | + super.setDataHandler(columndesc, otherConfig); | ||
770 | + } | ||
771 | + | ||
772 | + /** | ||
773 | + * Get the Column entity which column name is "statistics" from the Row | ||
774 | + * entity of attributes. | ||
775 | + * @return the Column entity which column name is "statistics" | ||
776 | + */ | ||
777 | + public Column getStatisticsColumn() { | ||
778 | + ColumnDescription columndesc = new ColumnDescription( | ||
779 | + InterfaceColumn.STATISTICS | ||
780 | + .columnName(), | ||
781 | + "getStatisticsColumn", | ||
782 | + VersionNum.VERSION100); | ||
783 | + return (Column) super.getColumnHandler(columndesc); | ||
784 | + } | ||
785 | + | ||
786 | + /** | ||
787 | + * Add a Column entity which column name is "statistics" to the Row entity | ||
788 | + * of attributes. | ||
789 | + * @param statistics the column data which column name is "statistics" | ||
790 | + */ | ||
791 | + public void setStatistics(Map<String, Long> statistics) { | ||
792 | + ColumnDescription columndesc = new ColumnDescription( | ||
793 | + InterfaceColumn.STATISTICS | ||
794 | + .columnName(), | ||
795 | + "setStatistics", | ||
796 | + VersionNum.VERSION100); | ||
797 | + super.setDataHandler(columndesc, statistics); | ||
798 | + } | ||
799 | + | ||
800 | + /** | ||
801 | + * Get the Column entity which column name is "status" from the Row entity | ||
802 | + * of attributes. | ||
803 | + * @return the Column entity which column name is "status" | ||
804 | + */ | ||
805 | + public Column getStatusColumn() { | ||
806 | + ColumnDescription columndesc = new ColumnDescription( | ||
807 | + InterfaceColumn.STATUS | ||
808 | + .columnName(), | ||
809 | + "getStatusColumn", | ||
810 | + VersionNum.VERSION100); | ||
811 | + return (Column) super.getColumnHandler(columndesc); | ||
812 | + } | ||
813 | + | ||
814 | + /** | ||
815 | + * Add a Column entity which column name is "status" to the Row entity of | ||
816 | + * attributes. | ||
817 | + * @param status the column data which column name is "status" | ||
818 | + */ | ||
819 | + public void setStatus(Map<String, String> status) { | ||
820 | + ColumnDescription columndesc = new ColumnDescription( | ||
821 | + InterfaceColumn.STATUS | ||
822 | + .columnName(), | ||
823 | + "setStatus", | ||
824 | + VersionNum.VERSION100); | ||
825 | + super.setDataHandler(columndesc, status); | ||
826 | + } | ||
827 | + | ||
828 | + /** | ||
829 | + * Get the Column entity which column name is "admin_state" from the Row | ||
830 | + * entity of attributes. | ||
831 | + * @return the Column entity which column name is "admin_state" | ||
832 | + */ | ||
833 | + public Column getAdminStateColumn() { | ||
834 | + ColumnDescription columndesc = new ColumnDescription( | ||
835 | + InterfaceColumn.ADMINSTATE | ||
836 | + .columnName(), | ||
837 | + "getAdminStateColumn", | ||
838 | + VersionNum.VERSION106); | ||
839 | + return (Column) super.getColumnHandler(columndesc); | ||
840 | + } | ||
841 | + | ||
842 | + /** | ||
843 | + * Add a Column entity which column name is "admin_state" to the Row entity | ||
844 | + * of attributes. | ||
845 | + * @param adminState the column data which column name is "admin_state" | ||
846 | + */ | ||
847 | + public void setAdminState(Set<String> adminState) { | ||
848 | + ColumnDescription columndesc = new ColumnDescription( | ||
849 | + InterfaceColumn.ADMINSTATE | ||
850 | + .columnName(), | ||
851 | + "setAdminState", | ||
852 | + VersionNum.VERSION106); | ||
853 | + super.setDataHandler(columndesc, adminState); | ||
854 | + } | ||
855 | + | ||
856 | + /** | ||
857 | + * Get the Column entity which column name is "link_state" from the Row | ||
858 | + * entity of attributes. | ||
859 | + * @return the Column entity which column name is "link_state" | ||
860 | + */ | ||
861 | + public Column getLinkStateColumn() { | ||
862 | + ColumnDescription columndesc = new ColumnDescription( | ||
863 | + InterfaceColumn.LINKSTATE | ||
864 | + .columnName(), | ||
865 | + "getLinkStateColumn", | ||
866 | + VersionNum.VERSION106); | ||
867 | + return (Column) super.getColumnHandler(columndesc); | ||
868 | + } | ||
869 | + | ||
870 | + /** | ||
871 | + * Add a Column entity which column name is "link_state" to the Row entity | ||
872 | + * of attributes. | ||
873 | + * @param linkState the column data which column name is "link_state" | ||
874 | + */ | ||
875 | + public void setLinkState(Map<String, String> linkState) { | ||
876 | + ColumnDescription columndesc = new ColumnDescription( | ||
877 | + InterfaceColumn.LINKSTATE | ||
878 | + .columnName(), | ||
879 | + "setLinkState", | ||
880 | + VersionNum.VERSION106); | ||
881 | + super.setDataHandler(columndesc, linkState); | ||
882 | + } | ||
883 | + | ||
884 | + /** | ||
885 | + * Get the Column entity which column name is "link_resets" from the Row | ||
886 | + * entity of attributes. | ||
887 | + * @return the Column entity which column name is "link_resets" | ||
888 | + */ | ||
889 | + public Column getLinkResetsColumn() { | ||
890 | + ColumnDescription columndesc = new ColumnDescription( | ||
891 | + InterfaceColumn.LINKRESETS | ||
892 | + .columnName(), | ||
893 | + "getLinkResetsColumn", | ||
894 | + VersionNum.VERSION620); | ||
895 | + return (Column) super.getColumnHandler(columndesc); | ||
896 | + } | ||
897 | + | ||
898 | + /** | ||
899 | + * Add a Column entity which column name is "link_resets" to the Row entity | ||
900 | + * of attributes. | ||
901 | + * @param linkResets the column data which column name is "link_resets" | ||
902 | + */ | ||
903 | + public void setLinkResets(Set<String> linkResets) { | ||
904 | + ColumnDescription columndesc = new ColumnDescription( | ||
905 | + InterfaceColumn.LINKRESETS | ||
906 | + .columnName(), | ||
907 | + "setLinkResets", | ||
908 | + VersionNum.VERSION620); | ||
909 | + super.setDataHandler(columndesc, linkResets); | ||
910 | + } | ||
911 | + | ||
912 | + /** | ||
913 | + * Get the Column entity which column name is "link_speed" from the Row | ||
914 | + * entity of attributes. | ||
915 | + * @return the Column entity which column name is "link_speed" | ||
916 | + */ | ||
917 | + public Column getLinkSpeedColumn() { | ||
918 | + ColumnDescription columndesc = new ColumnDescription( | ||
919 | + InterfaceColumn.LINKSPEED | ||
920 | + .columnName(), | ||
921 | + "getLinkSpeedColumn", | ||
922 | + VersionNum.VERSION106); | ||
923 | + return (Column) super.getColumnHandler(columndesc); | ||
924 | + } | ||
925 | + | ||
926 | + /** | ||
927 | + * Add a Column entity which column name is "link_speed" to the Row entity | ||
928 | + * of attributes. | ||
929 | + * @param linkSpeed the column data which column name is "link_speed" | ||
930 | + */ | ||
931 | + public void setLinkSpeed(Set<Long> linkSpeed) { | ||
932 | + ColumnDescription columndesc = new ColumnDescription( | ||
933 | + InterfaceColumn.LINKSPEED | ||
934 | + .columnName(), | ||
935 | + "setLinkSpeed", | ||
936 | + VersionNum.VERSION106); | ||
937 | + super.setDataHandler(columndesc, linkSpeed); | ||
938 | + } | ||
939 | + | ||
940 | + /** | ||
941 | + * Get the Column entity which column name is "duplex" from the Row entity | ||
942 | + * of attributes. | ||
943 | + * @return the Column entity which column name is "duplex" | ||
944 | + */ | ||
945 | + public Column getDuplexColumn() { | ||
946 | + ColumnDescription columndesc = new ColumnDescription( | ||
947 | + InterfaceColumn.DUPLEX | ||
948 | + .columnName(), | ||
949 | + "getDuplexColumn", | ||
950 | + VersionNum.VERSION106); | ||
951 | + return (Column) super.getColumnHandler(columndesc); | ||
952 | + } | ||
953 | + | ||
954 | + /** | ||
955 | + * Add a Column entity which column name is "duplex" to the Row entity of | ||
956 | + * attributes. | ||
957 | + * @param duplex the column data which column name is "duplex" | ||
958 | + */ | ||
959 | + public void setDuplex(Set<Long> duplex) { | ||
960 | + ColumnDescription columndesc = new ColumnDescription( | ||
961 | + InterfaceColumn.DUPLEX | ||
962 | + .columnName(), | ||
963 | + "setDuplex", | ||
964 | + VersionNum.VERSION106); | ||
965 | + super.setDataHandler(columndesc, duplex); | ||
966 | + } | ||
967 | + | ||
968 | + /** | ||
969 | + * Get the Column entity which column name is "mtu" from the Row entity of | ||
970 | + * attributes. | ||
971 | + * @return the Column entity which column name is "mtu" | ||
972 | + */ | ||
973 | + public Column getMtuColumn() { | ||
974 | + ColumnDescription columndesc = new ColumnDescription( | ||
975 | + InterfaceColumn.MTU | ||
976 | + .columnName(), | ||
977 | + "getMtuColumn", | ||
978 | + VersionNum.VERSION106); | ||
979 | + return (Column) super.getColumnHandler(columndesc); | ||
980 | + } | ||
981 | + | ||
982 | + /** | ||
983 | + * Add a Column entity which column name is "mtu" to the Row entity of | ||
984 | + * attributes. | ||
985 | + * @param mtu the column data which column name is "mtu" | ||
986 | + */ | ||
987 | + public void setMtu(Set<Long> mtu) { | ||
988 | + ColumnDescription columndesc = new ColumnDescription( | ||
989 | + InterfaceColumn.MTU | ||
990 | + .columnName(), | ||
991 | + "setMtu", | ||
992 | + VersionNum.VERSION106); | ||
993 | + super.setDataHandler(columndesc, mtu); | ||
994 | + } | ||
995 | + | ||
996 | + /** | ||
997 | + * Get the Column entity which column name is "error" from the Row entity of | ||
998 | + * attributes. | ||
999 | + * @return the Column entity which column name is "error" | ||
1000 | + */ | ||
1001 | + public Column getErrorColumn() { | ||
1002 | + ColumnDescription columndesc = new ColumnDescription( | ||
1003 | + InterfaceColumn.ERROR | ||
1004 | + .columnName(), | ||
1005 | + "getErrorColumn", | ||
1006 | + VersionNum.VERSION770); | ||
1007 | + return (Column) super.getColumnHandler(columndesc); | ||
1008 | + } | ||
1009 | + | ||
1010 | + /** | ||
1011 | + * Add a Column entity which column name is "error" to the Row entity of | ||
1012 | + * attributes. | ||
1013 | + * @param error the column data which column name is "error" | ||
1014 | + */ | ||
1015 | + public void setError(Set<String> error) { | ||
1016 | + ColumnDescription columndesc = new ColumnDescription( | ||
1017 | + InterfaceColumn.ERROR | ||
1018 | + .columnName(), | ||
1019 | + "setError", | ||
1020 | + VersionNum.VERSION770); | ||
1021 | + super.setDataHandler(columndesc, error); | ||
1022 | + } | ||
1023 | + | ||
1024 | +} |
1 | +package org.onosproject.ovsdb.rfc.table; | ||
2 | + | ||
3 | +import java.util.Map; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
7 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
8 | +import org.onosproject.ovsdb.rfc.notation.UUID; | ||
9 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
10 | +import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService; | ||
11 | +import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; | ||
12 | + | ||
13 | +/** | ||
14 | + * This class provides operations of Open_vSwitch Table. | ||
15 | + */ | ||
16 | +public class OpenVSwitch extends AbstractOvsdbTableService { | ||
17 | + | ||
18 | + /** | ||
19 | + * OpenVSwitch table column name. | ||
20 | + */ | ||
21 | + public enum OpenVSwitchColumn { | ||
22 | + BRIDGES("bridges"), MANAGERS("managers"), | ||
23 | + MANAGEROPTIONS("manager_options"), SSL("ssl"), | ||
24 | + OTHERCONFIG("other_config"), EXTERNALIDS("external_ids"), | ||
25 | + NEXTCFG("next_cfg"), CURCFG("cur_cfg"), CAPABILITIES("capabilities"), | ||
26 | + STATISTICS("statistics"), OVSVERSION("ovs_version"), | ||
27 | + DBVERSION("db_version"), SYSTEMTYPE("system_type"), | ||
28 | + SYSTEMVERSION("system_version"); | ||
29 | + | ||
30 | + private final String columnName; | ||
31 | + | ||
32 | + private OpenVSwitchColumn(String columnName) { | ||
33 | + this.columnName = columnName; | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * Returns the table column name for OpenVSwitchColumn. | ||
38 | + * @return the table column name | ||
39 | + */ | ||
40 | + public String columnName() { | ||
41 | + return columnName; | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * Constructs a OpenVSwitch object. Generate Open_vSwitch Table Description. | ||
47 | + * @param dbSchema DatabaseSchema | ||
48 | + * @param row Row | ||
49 | + */ | ||
50 | + public OpenVSwitch(DatabaseSchema dbSchema, Row row) { | ||
51 | + super(dbSchema, row, OvsdbTable.OPENVSWITCH, VersionNum.VERSION100); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * Get the Column entity which column name is "bridges" from the Row entity | ||
56 | + * of attributes. | ||
57 | + * @return the Column entity which column name is "bridges" | ||
58 | + */ | ||
59 | + public Column getBridgesColumn() { | ||
60 | + ColumnDescription columndesc = new ColumnDescription( | ||
61 | + OpenVSwitchColumn.BRIDGES | ||
62 | + .columnName(), | ||
63 | + "getBridgesColumn", | ||
64 | + VersionNum.VERSION100); | ||
65 | + return (Column) super.getColumnHandler(columndesc); | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Add a Column entity which column name is "bridges" to the Row entity of | ||
70 | + * attributes. | ||
71 | + * @param bridges the column data which column name is "bridges" | ||
72 | + */ | ||
73 | + public void setBridges(Set<UUID> bridges) { | ||
74 | + ColumnDescription columndesc = new ColumnDescription( | ||
75 | + OpenVSwitchColumn.BRIDGES | ||
76 | + .columnName(), | ||
77 | + "setBridges", | ||
78 | + VersionNum.VERSION100); | ||
79 | + super.setDataHandler(columndesc, bridges); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Get the Column entity which column name is "managers" from the Row entity | ||
84 | + * of attributes. | ||
85 | + * @return the Column entity which column name is "managers" | ||
86 | + */ | ||
87 | + public Column getManagersColumn() { | ||
88 | + ColumnDescription columndesc = new ColumnDescription( | ||
89 | + OpenVSwitchColumn.MANAGERS | ||
90 | + .columnName(), | ||
91 | + "getManagersColumn", | ||
92 | + VersionNum.VERSION100, | ||
93 | + VersionNum.VERSION200); | ||
94 | + return (Column) super.getDataHandler(columndesc); | ||
95 | + } | ||
96 | + | ||
97 | + /** | ||
98 | + * Add a Column entity which column name is "managers" to the Row entity of | ||
99 | + * attributes. | ||
100 | + * @param managers the column data which column name is "managers" | ||
101 | + */ | ||
102 | + public void setManagers(Set<UUID> managers) { | ||
103 | + ColumnDescription columndesc = new ColumnDescription( | ||
104 | + OpenVSwitchColumn.MANAGERS | ||
105 | + .columnName(), | ||
106 | + "setManagers", | ||
107 | + VersionNum.VERSION100, | ||
108 | + VersionNum.VERSION200); | ||
109 | + super.setDataHandler(columndesc, managers); | ||
110 | + } | ||
111 | + | ||
112 | + /** | ||
113 | + * Get the Column entity which column name is "manager_options" from the Row | ||
114 | + * entity of attributes. | ||
115 | + * @return the Column entity which column name is "manager_options" | ||
116 | + */ | ||
117 | + public Column getManagerOptionsColumn() { | ||
118 | + ColumnDescription columndesc = new ColumnDescription( | ||
119 | + OpenVSwitchColumn.MANAGEROPTIONS | ||
120 | + .columnName(), | ||
121 | + "getManagerOptionsColumn", | ||
122 | + VersionNum.VERSION100); | ||
123 | + return (Column) super.getDataHandler(columndesc); | ||
124 | + } | ||
125 | + | ||
126 | + /** | ||
127 | + * Add a Column entity which column name is "manager_options" to the Row | ||
128 | + * entity of attributes. | ||
129 | + * @param managerOptions the column data which column name is | ||
130 | + * "manager_options" | ||
131 | + */ | ||
132 | + public void setManagerOptions(Set<UUID> managerOptions) { | ||
133 | + ColumnDescription columndesc = new ColumnDescription( | ||
134 | + OpenVSwitchColumn.MANAGEROPTIONS | ||
135 | + .columnName(), | ||
136 | + "setManagerOptions", | ||
137 | + VersionNum.VERSION100); | ||
138 | + super.setDataHandler(columndesc, managerOptions); | ||
139 | + } | ||
140 | + | ||
141 | + /** | ||
142 | + * Get the Column entity which column name is "ssl" from the Row entity of | ||
143 | + * attributes. | ||
144 | + * @return the Column entity which column name is "ssl" | ||
145 | + */ | ||
146 | + public Column getSslColumn() { | ||
147 | + ColumnDescription columndesc = new ColumnDescription( | ||
148 | + OpenVSwitchColumn.SSL | ||
149 | + .columnName(), | ||
150 | + "getSslColumn", | ||
151 | + VersionNum.VERSION100); | ||
152 | + return (Column) super.getDataHandler(columndesc); | ||
153 | + } | ||
154 | + | ||
155 | + /** | ||
156 | + * Add a Column entity which column name is "ssl" to the Row entity of | ||
157 | + * attributes. | ||
158 | + * @param ssl the column data which column name is "ssl" | ||
159 | + */ | ||
160 | + public void setSsl(Set<UUID> ssl) { | ||
161 | + ColumnDescription columndesc = new ColumnDescription( | ||
162 | + OpenVSwitchColumn.SSL | ||
163 | + .columnName(), | ||
164 | + "setSsl", | ||
165 | + VersionNum.VERSION100); | ||
166 | + super.setDataHandler(columndesc, ssl); | ||
167 | + } | ||
168 | + | ||
169 | + /** | ||
170 | + * Get the Column entity which column name is "other_config" from the Row | ||
171 | + * entity of attributes. | ||
172 | + * @return the Column entity which column name is "other_config" | ||
173 | + */ | ||
174 | + public Column getOtherConfigColumn() { | ||
175 | + ColumnDescription columndesc = new ColumnDescription( | ||
176 | + OpenVSwitchColumn.OTHERCONFIG | ||
177 | + .columnName(), | ||
178 | + "getOtherConfigColumn", | ||
179 | + VersionNum.VERSION510); | ||
180 | + return (Column) super.getColumnHandler(columndesc); | ||
181 | + } | ||
182 | + | ||
183 | + /** | ||
184 | + * Add a Column entity which column name is "other_config" to the Row entity | ||
185 | + * of attributes. | ||
186 | + * @param otherConfig the column data which column name is "other_config" | ||
187 | + */ | ||
188 | + public void setOtherConfig(Map<String, String> otherConfig) { | ||
189 | + ColumnDescription columndesc = new ColumnDescription( | ||
190 | + OpenVSwitchColumn.OTHERCONFIG | ||
191 | + .columnName(), | ||
192 | + "setOtherConfig", | ||
193 | + VersionNum.VERSION510); | ||
194 | + super.setDataHandler(columndesc, otherConfig); | ||
195 | + } | ||
196 | + | ||
197 | + /** | ||
198 | + * Get the Column entity which column name is "external_ids" from the Row | ||
199 | + * entity of attributes. | ||
200 | + * @return the Column entity which column name is "external_ids" | ||
201 | + */ | ||
202 | + public Column getExternalIdsColumn() { | ||
203 | + ColumnDescription columndesc = new ColumnDescription( | ||
204 | + OpenVSwitchColumn.EXTERNALIDS | ||
205 | + .columnName(), | ||
206 | + "getExternalIdsColumn", | ||
207 | + VersionNum.VERSION100); | ||
208 | + return (Column) super.getColumnHandler(columndesc); | ||
209 | + } | ||
210 | + | ||
211 | + /** | ||
212 | + * Add a Column entity which column name is "external_ids" to the Row entity | ||
213 | + * of attributes. | ||
214 | + * @param externalIds the column data which column name is "external_ids" | ||
215 | + */ | ||
216 | + public void setExternalIds(Map<String, String> externalIds) { | ||
217 | + ColumnDescription columndesc = new ColumnDescription( | ||
218 | + OpenVSwitchColumn.EXTERNALIDS | ||
219 | + .columnName(), | ||
220 | + "setExternalIds", | ||
221 | + VersionNum.VERSION100); | ||
222 | + super.setDataHandler(columndesc, externalIds); | ||
223 | + } | ||
224 | + | ||
225 | + /** | ||
226 | + * Get the Column entity which column name is "next_cfg" from the Row entity | ||
227 | + * of attributes. | ||
228 | + * @return the Column entity which column name is "next_cfg" | ||
229 | + */ | ||
230 | + public Column getNextConfigColumn() { | ||
231 | + ColumnDescription columndesc = new ColumnDescription( | ||
232 | + OpenVSwitchColumn.NEXTCFG | ||
233 | + .columnName(), | ||
234 | + "getNextConfigColumn", | ||
235 | + VersionNum.VERSION100); | ||
236 | + return (Column) super.getColumnHandler(columndesc); | ||
237 | + } | ||
238 | + | ||
239 | + /** | ||
240 | + * Add a Column entity which column name is "next_cfg" to the Row entity of | ||
241 | + * attributes. | ||
242 | + * @param nextConfig the column data which column name is "next_cfg" | ||
243 | + */ | ||
244 | + public void setNextConfig(Long nextConfig) { | ||
245 | + ColumnDescription columndesc = new ColumnDescription( | ||
246 | + OpenVSwitchColumn.NEXTCFG | ||
247 | + .columnName(), | ||
248 | + "setNextConfig", | ||
249 | + VersionNum.VERSION100); | ||
250 | + super.setDataHandler(columndesc, nextConfig); | ||
251 | + } | ||
252 | + | ||
253 | + /** | ||
254 | + * Get the Column entity which column name is "cur_cfg" from the Row entity | ||
255 | + * of attributes. | ||
256 | + * @return the Column entity which column name is "cur_cfg" | ||
257 | + */ | ||
258 | + public Column getCurrentConfigColumn() { | ||
259 | + ColumnDescription columndesc = new ColumnDescription( | ||
260 | + OpenVSwitchColumn.CURCFG | ||
261 | + .columnName(), | ||
262 | + "getCurrentConfigColumn", | ||
263 | + VersionNum.VERSION100); | ||
264 | + return (Column) super.getColumnHandler(columndesc); | ||
265 | + } | ||
266 | + | ||
267 | + /** | ||
268 | + * Add a Column entity which column name is "cur_cfg" to the Row entity of | ||
269 | + * attributes. | ||
270 | + * @param currentConfig the column data which column name is "cur_cfg" | ||
271 | + */ | ||
272 | + public void setCurrentConfig(Long currentConfig) { | ||
273 | + ColumnDescription columndesc = new ColumnDescription( | ||
274 | + OpenVSwitchColumn.CURCFG | ||
275 | + .columnName(), | ||
276 | + "setCurrentConfig", | ||
277 | + VersionNum.VERSION100); | ||
278 | + super.setDataHandler(columndesc, currentConfig); | ||
279 | + } | ||
280 | + | ||
281 | + /** | ||
282 | + * Get the Column entity which column name is "capabilities" from the Row | ||
283 | + * entity of attributes. | ||
284 | + * @return the Column entity which column name is "capabilities" | ||
285 | + */ | ||
286 | + public Column getCapabilitiesColumn() { | ||
287 | + ColumnDescription columndesc = new ColumnDescription( | ||
288 | + OpenVSwitchColumn.CAPABILITIES | ||
289 | + .columnName(), | ||
290 | + "getCapabilitiesColumn", | ||
291 | + VersionNum.VERSION100, | ||
292 | + VersionNum.VERSION670); | ||
293 | + return (Column) super.getColumnHandler(columndesc); | ||
294 | + } | ||
295 | + | ||
296 | + /** | ||
297 | + * Add a Column entity which column name is "capabilities" to the Row entity | ||
298 | + * of attributes. | ||
299 | + * @param capabilities the column data which column name is "capabilities" | ||
300 | + */ | ||
301 | + public void setCapabilities(Map<String, UUID> capabilities) { | ||
302 | + ColumnDescription columndesc = new ColumnDescription( | ||
303 | + OpenVSwitchColumn.CAPABILITIES | ||
304 | + .columnName(), | ||
305 | + "setCapabilities", | ||
306 | + VersionNum.VERSION100, | ||
307 | + VersionNum.VERSION670); | ||
308 | + super.setDataHandler(columndesc, capabilities); | ||
309 | + } | ||
310 | + | ||
311 | + /** | ||
312 | + * Get the Column entity which column name is "statistics" from the Row | ||
313 | + * entity of attributes. | ||
314 | + * @return the Column entity which column name is "statistics" | ||
315 | + */ | ||
316 | + public Column getStatisticsColumn() { | ||
317 | + ColumnDescription columndesc = new ColumnDescription( | ||
318 | + OpenVSwitchColumn.STATISTICS | ||
319 | + .columnName(), | ||
320 | + "getStatisticsColumn", | ||
321 | + VersionNum.VERSION100); | ||
322 | + return (Column) super.getColumnHandler(columndesc); | ||
323 | + } | ||
324 | + | ||
325 | + /** | ||
326 | + * Add a Column entity which column name is "statistics" to the Row entity | ||
327 | + * of attributes. | ||
328 | + * @param statistics the column data which column name is "statistics" | ||
329 | + */ | ||
330 | + public void setStatistics(Map<String, Long> statistics) { | ||
331 | + ColumnDescription columndesc = new ColumnDescription( | ||
332 | + OpenVSwitchColumn.STATISTICS | ||
333 | + .columnName(), | ||
334 | + "setStatistics", | ||
335 | + VersionNum.VERSION100); | ||
336 | + super.setDataHandler(columndesc, statistics); | ||
337 | + } | ||
338 | + | ||
339 | + /** | ||
340 | + * Get the Column entity which column name is "ovs_version" from the Row | ||
341 | + * entity of attributes. | ||
342 | + * @return the Column entity which column name is "ovs_version" | ||
343 | + */ | ||
344 | + public Column getOvsVersionColumn() { | ||
345 | + ColumnDescription columndesc = new ColumnDescription( | ||
346 | + OpenVSwitchColumn.OVSVERSION | ||
347 | + .columnName(), | ||
348 | + "getOvsVersionColumn", | ||
349 | + VersionNum.VERSION100); | ||
350 | + return (Column) super.getColumnHandler(columndesc); | ||
351 | + } | ||
352 | + | ||
353 | + /** | ||
354 | + * Add a Column entity which column name is "ovs_version" to the Row entity | ||
355 | + * of attributes. | ||
356 | + * @param ovsVersion the column data which column name is "ovs_version" | ||
357 | + */ | ||
358 | + public void setOvsVersion(Set<String> ovsVersion) { | ||
359 | + ColumnDescription columndesc = new ColumnDescription( | ||
360 | + OpenVSwitchColumn.OVSVERSION | ||
361 | + .columnName(), | ||
362 | + "setOvsVersion", | ||
363 | + VersionNum.VERSION100); | ||
364 | + super.setDataHandler(columndesc, ovsVersion); | ||
365 | + } | ||
366 | + | ||
367 | + /** | ||
368 | + * Get the Column entity which column name is "db_version" from the Row | ||
369 | + * entity of attributes. | ||
370 | + * @return the Column entity which column name is "db_version" | ||
371 | + */ | ||
372 | + public Column getDbVersionColumn() { | ||
373 | + ColumnDescription columndesc = new ColumnDescription( | ||
374 | + OpenVSwitchColumn.DBVERSION | ||
375 | + .columnName(), | ||
376 | + "getDbVersionColumn", | ||
377 | + VersionNum.VERSION100); | ||
378 | + return (Column) super.getColumnHandler(columndesc); | ||
379 | + } | ||
380 | + | ||
381 | + /** | ||
382 | + * Add a Column entity which column name is "db_version" to the Row entity | ||
383 | + * of attributes. | ||
384 | + * @param dbVersion the column data which column name is "db_version" | ||
385 | + */ | ||
386 | + public void setDbVersion(Set<String> dbVersion) { | ||
387 | + ColumnDescription columndesc = new ColumnDescription( | ||
388 | + OpenVSwitchColumn.DBVERSION | ||
389 | + .columnName(), | ||
390 | + "setDbVersion", | ||
391 | + VersionNum.VERSION100); | ||
392 | + super.setDataHandler(columndesc, dbVersion); | ||
393 | + } | ||
394 | + | ||
395 | + /** | ||
396 | + * Get the Column entity which column name is "system_type" from the Row | ||
397 | + * entity of attributes. | ||
398 | + * @return the Column entity which column name is "system_type" | ||
399 | + */ | ||
400 | + public Column getSystemTypeColumn() { | ||
401 | + ColumnDescription columndesc = new ColumnDescription( | ||
402 | + OpenVSwitchColumn.SYSTEMTYPE | ||
403 | + .columnName(), | ||
404 | + "getSystemTypeColumn", | ||
405 | + VersionNum.VERSION100); | ||
406 | + return (Column) super.getColumnHandler(columndesc); | ||
407 | + } | ||
408 | + | ||
409 | + /** | ||
410 | + * Add a Column entity which column name is "system_type" to the Row entity | ||
411 | + * of attributes. | ||
412 | + * @param systemType the column data which column name is "system_type" | ||
413 | + */ | ||
414 | + public void setSystemType(Set<String> systemType) { | ||
415 | + ColumnDescription columndesc = new ColumnDescription( | ||
416 | + OpenVSwitchColumn.SYSTEMTYPE | ||
417 | + .columnName(), | ||
418 | + "setSystemType", | ||
419 | + VersionNum.VERSION100); | ||
420 | + super.setDataHandler(columndesc, systemType); | ||
421 | + } | ||
422 | + | ||
423 | + /** | ||
424 | + * Get the Column entity which column name is "system_version" from the Row | ||
425 | + * entity of attributes. | ||
426 | + * @return the Column entity which column name is "system_version" | ||
427 | + */ | ||
428 | + public Column getSystemVersionColumn() { | ||
429 | + ColumnDescription columndesc = new ColumnDescription( | ||
430 | + OpenVSwitchColumn.SYSTEMVERSION | ||
431 | + .columnName(), | ||
432 | + "getSystemVersionColumn", | ||
433 | + VersionNum.VERSION100); | ||
434 | + return (Column) super.getColumnHandler(columndesc); | ||
435 | + } | ||
436 | + | ||
437 | + /** | ||
438 | + * Add a Column entity which column name is "system_version" to the Row | ||
439 | + * entity of attributes. | ||
440 | + * @param systemVersion the column data which column name is | ||
441 | + * "system_version" | ||
442 | + */ | ||
443 | + public void setSystemVersion(Set<String> systemVersion) { | ||
444 | + ColumnDescription columndesc = new ColumnDescription( | ||
445 | + OpenVSwitchColumn.SYSTEMVERSION | ||
446 | + .columnName(), | ||
447 | + "setSystemVersion", | ||
448 | + VersionNum.VERSION100); | ||
449 | + super.setDataHandler(columndesc, systemVersion); | ||
450 | + } | ||
451 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.table; | ||
17 | + | ||
18 | +/** | ||
19 | + * Ovsdb table name. Refer to RFC7047's Section 9.2. | ||
20 | + */ | ||
21 | +public enum OvsdbTable { | ||
22 | + INTERFACE("Interface"), BRIDGE("Bridge"), CONTROLLER("Controller"), | ||
23 | + PORT("Port"), OPENVSWITCH("Open_vSwitch"), FLWTABLE("Flow_Table"), | ||
24 | + QOS("Qos"), QUEUE("Queue"), MIRROR("Mirror"), MANAGER("Manager"), | ||
25 | + NETFLOW("NetFlow"), SSL("SSL"), SFLOW("sFlow"), IPFIX("IPFIX"), | ||
26 | + FLOWSAMPLECOLLECTORSET("Flow_Sample_Collector_Set"); | ||
27 | + | ||
28 | + private final String tableName; | ||
29 | + | ||
30 | + private OvsdbTable(String tableName) { | ||
31 | + this.tableName = tableName; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns the table name for OvsdbTable. | ||
36 | + * @return the table name | ||
37 | + */ | ||
38 | + public String tableName() { | ||
39 | + return tableName; | ||
40 | + } | ||
41 | +} |
1 | +package org.onosproject.ovsdb.rfc.table; | ||
2 | + | ||
3 | +import java.util.Map; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
7 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
8 | +import org.onosproject.ovsdb.rfc.notation.UUID; | ||
9 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
10 | +import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService; | ||
11 | +import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; | ||
12 | + | ||
13 | +/** | ||
14 | + * This class provides operations of Port Table. | ||
15 | + */ | ||
16 | +public class Port extends AbstractOvsdbTableService { | ||
17 | + | ||
18 | + /** | ||
19 | + * Port table column name. | ||
20 | + */ | ||
21 | + public enum PortColumn { | ||
22 | + NAME("name"), INTERFACES("interfaces"), TRUNKS("trunks"), TAG("tag"), | ||
23 | + VLANMODE("vlan_mode"), QOS("qos"), MAC("mac"), BONDTYPE("bond_type"), | ||
24 | + BONDMODE("bond_mode"), LACP("lacp"), BONDUPDELAY("bond_updelay"), | ||
25 | + BONDDOWNDELAY("bond_downdelay"), BONDFAKEIFACE("bond_fake_iface"), | ||
26 | + FAKEBRIDGE("fake_bridge"), STATUS("status"), STATISTICS("statistics"), | ||
27 | + OTHERCONFIG("other_config"), EXTERNALIDS("external_ids"); | ||
28 | + | ||
29 | + private final String columnName; | ||
30 | + | ||
31 | + private PortColumn(String columnName) { | ||
32 | + this.columnName = columnName; | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns the table column name for PortColumn. | ||
37 | + * @return the table column name | ||
38 | + */ | ||
39 | + public String columnName() { | ||
40 | + return columnName; | ||
41 | + } | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Constructs a Port object. Generate Port Table Description. | ||
46 | + * @param dbSchema DatabaseSchema | ||
47 | + * @param row Row | ||
48 | + */ | ||
49 | + public Port(DatabaseSchema dbSchema, Row row) { | ||
50 | + super(dbSchema, row, OvsdbTable.PORT, VersionNum.VERSION100); | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Get the Column entity which column name is "name" from the Row entity of | ||
55 | + * attributes. | ||
56 | + * @return the Column entity | ||
57 | + */ | ||
58 | + public Column getNameColumn() { | ||
59 | + ColumnDescription columndesc = new ColumnDescription( | ||
60 | + PortColumn.NAME | ||
61 | + .columnName(), | ||
62 | + "getNameColumn", | ||
63 | + VersionNum.VERSION100); | ||
64 | + return (Column) super.getColumnHandler(columndesc); | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Add a Column entity which column name is "name" to the Row entity of | ||
69 | + * attributes. | ||
70 | + * @param name the column data which column name is "name" | ||
71 | + */ | ||
72 | + public void setName(String name) { | ||
73 | + ColumnDescription columndesc = new ColumnDescription( | ||
74 | + PortColumn.NAME | ||
75 | + .columnName(), | ||
76 | + "setName", | ||
77 | + VersionNum.VERSION100); | ||
78 | + super.setDataHandler(columndesc, name); | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * Get the Column entity which column name is "name" from the Row entity of | ||
83 | + * attributes. | ||
84 | + * @return the Column entity | ||
85 | + */ | ||
86 | + public String getName() { | ||
87 | + ColumnDescription columndesc = new ColumnDescription( | ||
88 | + PortColumn.NAME | ||
89 | + .columnName(), | ||
90 | + "getName", | ||
91 | + VersionNum.VERSION100); | ||
92 | + return (String) super.getDataHandler(columndesc); | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * Get the Column entity which column name is "interfaces" from the Row | ||
97 | + * entity of attributes. | ||
98 | + * @return the Column entity | ||
99 | + */ | ||
100 | + public Column getInterfacesColumn() { | ||
101 | + ColumnDescription columndesc = new ColumnDescription( | ||
102 | + PortColumn.INTERFACES | ||
103 | + .columnName(), | ||
104 | + "getInterfacesColumn", | ||
105 | + VersionNum.VERSION100); | ||
106 | + return (Column) super.getColumnHandler(columndesc); | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Add a Column entity which column name is "interfaces" to the Row entity | ||
111 | + * of attributes. | ||
112 | + * @param interfaces the column data which column name is "interfaces" | ||
113 | + */ | ||
114 | + public void setInterfaces(Set<UUID> interfaces) { | ||
115 | + ColumnDescription columndesc = new ColumnDescription( | ||
116 | + PortColumn.INTERFACES | ||
117 | + .columnName(), | ||
118 | + "setInterfaces", | ||
119 | + VersionNum.VERSION100); | ||
120 | + super.setDataHandler(columndesc, interfaces); | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * Get the Column entity which column name is "trunks" from the Row entity | ||
125 | + * of attributes. | ||
126 | + * @return the Column entity | ||
127 | + */ | ||
128 | + public Column getTrunksColumn() { | ||
129 | + ColumnDescription columndesc = new ColumnDescription( | ||
130 | + PortColumn.TRUNKS | ||
131 | + .columnName(), | ||
132 | + "getTrunksColumn", | ||
133 | + VersionNum.VERSION100); | ||
134 | + return (Column) super.getColumnHandler(columndesc); | ||
135 | + } | ||
136 | + | ||
137 | + /** | ||
138 | + * Add a Column entity which column name is "trunks" to the Row entity of | ||
139 | + * attributes. | ||
140 | + * @param trunks the column data which column name is "trunks" | ||
141 | + */ | ||
142 | + public void setTrunks(Set<Long> trunks) { | ||
143 | + ColumnDescription columndesc = new ColumnDescription( | ||
144 | + PortColumn.TRUNKS | ||
145 | + .columnName(), | ||
146 | + "setTrunks", | ||
147 | + VersionNum.VERSION100); | ||
148 | + super.setDataHandler(columndesc, trunks); | ||
149 | + } | ||
150 | + | ||
151 | + /** | ||
152 | + * Get the Column entity which column name is "tag" from the Row entity of | ||
153 | + * attributes. | ||
154 | + * @return the Column entity | ||
155 | + */ | ||
156 | + public Column getTagColumn() { | ||
157 | + ColumnDescription columndesc = new ColumnDescription( | ||
158 | + PortColumn.TAG | ||
159 | + .columnName(), | ||
160 | + "getTagColumn", | ||
161 | + VersionNum.VERSION100); | ||
162 | + return (Column) super.getColumnHandler(columndesc); | ||
163 | + } | ||
164 | + | ||
165 | + /** | ||
166 | + * Add a Column entity which column name is "tag" to the Row entity of | ||
167 | + * attributes. | ||
168 | + * @param tag the column data which column name is "tag" | ||
169 | + */ | ||
170 | + public void setTag(Set<Long> tag) { | ||
171 | + ColumnDescription columndesc = new ColumnDescription( | ||
172 | + PortColumn.TAG | ||
173 | + .columnName(), | ||
174 | + "setTag", | ||
175 | + VersionNum.VERSION100); | ||
176 | + super.setDataHandler(columndesc, tag); | ||
177 | + } | ||
178 | + | ||
179 | + /** | ||
180 | + * Get the Column entity which column name is "vlan_mode" from the Row | ||
181 | + * entity of attributes. | ||
182 | + * @return the Column entity | ||
183 | + */ | ||
184 | + public Column getVlanModeColumn() { | ||
185 | + ColumnDescription columndesc = new ColumnDescription( | ||
186 | + PortColumn.VLANMODE | ||
187 | + .columnName(), | ||
188 | + "getVlanModeColumn", | ||
189 | + VersionNum.VERSION610); | ||
190 | + return (Column) super.getColumnHandler(columndesc); | ||
191 | + } | ||
192 | + | ||
193 | + /** | ||
194 | + * Add a Column entity which column name is "vlan_mode" to the Row entity of | ||
195 | + * attributes. | ||
196 | + * @param vlanMode the column data which column name is "vlan_mode" | ||
197 | + */ | ||
198 | + public void setVlanMode(Set<String> vlanMode) { | ||
199 | + ColumnDescription columndesc = new ColumnDescription( | ||
200 | + PortColumn.VLANMODE | ||
201 | + .columnName(), | ||
202 | + "setVlanMode", | ||
203 | + VersionNum.VERSION610); | ||
204 | + super.setDataHandler(columndesc, vlanMode); | ||
205 | + } | ||
206 | + | ||
207 | + /** | ||
208 | + * Get the Column entity which column name is "qos" from the Row entity of | ||
209 | + * attributes. | ||
210 | + * @return the Column entity | ||
211 | + */ | ||
212 | + public Column getQosColumn() { | ||
213 | + ColumnDescription columndesc = new ColumnDescription( | ||
214 | + PortColumn.QOS | ||
215 | + .columnName(), | ||
216 | + "getQosColumn", | ||
217 | + VersionNum.VERSION100); | ||
218 | + return (Column) super.getColumnHandler(columndesc); | ||
219 | + } | ||
220 | + | ||
221 | + /** | ||
222 | + * Add a Column entity which column name is "qos" to the Row entity of | ||
223 | + * attributes. | ||
224 | + * @param qos the column data which column name is "qos" | ||
225 | + */ | ||
226 | + public void setQos(Set<UUID> qos) { | ||
227 | + ColumnDescription columndesc = new ColumnDescription( | ||
228 | + PortColumn.QOS | ||
229 | + .columnName(), | ||
230 | + "setQos", | ||
231 | + VersionNum.VERSION100); | ||
232 | + super.setDataHandler(columndesc, qos); | ||
233 | + } | ||
234 | + | ||
235 | + /** | ||
236 | + * Get the Column entity which column name is "mac" from the Row entity of | ||
237 | + * attributes. | ||
238 | + * @return the Column entity | ||
239 | + */ | ||
240 | + public Column getMacColumn() { | ||
241 | + ColumnDescription columndesc = new ColumnDescription( | ||
242 | + PortColumn.MAC | ||
243 | + .columnName(), | ||
244 | + "getMacColumn", | ||
245 | + VersionNum.VERSION100); | ||
246 | + return (Column) super.getColumnHandler(columndesc); | ||
247 | + } | ||
248 | + | ||
249 | + /** | ||
250 | + * Add a Column entity which column name is "mac" to the Row entity of | ||
251 | + * attributes. | ||
252 | + * @param mac the column data which column name is "mac" | ||
253 | + */ | ||
254 | + public void setMac(Set<String> mac) { | ||
255 | + ColumnDescription columndesc = new ColumnDescription( | ||
256 | + PortColumn.MAC | ||
257 | + .columnName(), | ||
258 | + "setMac", | ||
259 | + VersionNum.VERSION100); | ||
260 | + super.setDataHandler(columndesc, mac); | ||
261 | + } | ||
262 | + | ||
263 | + /** | ||
264 | + * Get the Column entity which column name is "bond_type" from the Row | ||
265 | + * entity of attributes. | ||
266 | + * @return the Column entity | ||
267 | + */ | ||
268 | + public Column getBondTypeColumn() { | ||
269 | + ColumnDescription columndesc = new ColumnDescription( | ||
270 | + PortColumn.BONDTYPE | ||
271 | + .columnName(), | ||
272 | + "getBondTypeColumn", | ||
273 | + VersionNum.VERSION102, | ||
274 | + VersionNum.VERSION103); | ||
275 | + return (Column) super.getColumnHandler(columndesc); | ||
276 | + } | ||
277 | + | ||
278 | + /** | ||
279 | + * Add a Column entity which column name is "bond_type" to the Row entity of | ||
280 | + * attributes. | ||
281 | + * @param bondtype the column data which column name is "bond_type" | ||
282 | + */ | ||
283 | + public void setBondType(Set<String> bondtype) { | ||
284 | + ColumnDescription columndesc = new ColumnDescription( | ||
285 | + PortColumn.BONDTYPE | ||
286 | + .columnName(), | ||
287 | + "setBondType", | ||
288 | + VersionNum.VERSION102, | ||
289 | + VersionNum.VERSION103); | ||
290 | + super.setDataHandler(columndesc, bondtype); | ||
291 | + } | ||
292 | + | ||
293 | + /** | ||
294 | + * Get the Column entity which column name is "bond_mode" from the Row | ||
295 | + * entity of attributes. | ||
296 | + * @return the Column entity | ||
297 | + */ | ||
298 | + public Column getBondModeColumn() { | ||
299 | + ColumnDescription columndesc = new ColumnDescription( | ||
300 | + PortColumn.BONDMODE | ||
301 | + .columnName(), | ||
302 | + "getBondModeColumn", | ||
303 | + VersionNum.VERSION104); | ||
304 | + return (Column) super.getColumnHandler(columndesc); | ||
305 | + } | ||
306 | + | ||
307 | + /** | ||
308 | + * Add a Column entity which column name is "bond_mode" to the Row entity of | ||
309 | + * attributes. | ||
310 | + * @param bondmode the column data which column name is "bond_mode" | ||
311 | + */ | ||
312 | + public void setBondMode(Set<String> bondmode) { | ||
313 | + ColumnDescription columndesc = new ColumnDescription( | ||
314 | + PortColumn.BONDMODE | ||
315 | + .columnName(), | ||
316 | + "setBondMode", | ||
317 | + VersionNum.VERSION104); | ||
318 | + super.setDataHandler(columndesc, bondmode); | ||
319 | + } | ||
320 | + | ||
321 | + /** | ||
322 | + * Get the Column entity which column name is "lacp" from the Row entity of | ||
323 | + * attributes. | ||
324 | + * @return the Column entity | ||
325 | + */ | ||
326 | + public Column getLacpColumn() { | ||
327 | + ColumnDescription columndesc = new ColumnDescription( | ||
328 | + PortColumn.LACP | ||
329 | + .columnName(), | ||
330 | + "getLacpColumn", | ||
331 | + VersionNum.VERSION130); | ||
332 | + return (Column) super.getColumnHandler(columndesc); | ||
333 | + } | ||
334 | + | ||
335 | + /** | ||
336 | + * Add a Column entity which column name is "lacp" to the Row entity of | ||
337 | + * attributes. | ||
338 | + * @param lacp the column data which column name is "lacp" | ||
339 | + */ | ||
340 | + public void setLacp(Set<String> lacp) { | ||
341 | + ColumnDescription columndesc = new ColumnDescription( | ||
342 | + PortColumn.LACP | ||
343 | + .columnName(), | ||
344 | + "setLacp", | ||
345 | + VersionNum.VERSION130); | ||
346 | + super.setDataHandler(columndesc, lacp); | ||
347 | + } | ||
348 | + | ||
349 | + /** | ||
350 | + * Get the Column entity which column name is "bond_updelay" from the Row | ||
351 | + * entity of attributes. | ||
352 | + * @return the Column entity | ||
353 | + */ | ||
354 | + public Column getBondUpDelayColumn() { | ||
355 | + ColumnDescription columndesc = new ColumnDescription( | ||
356 | + PortColumn.BONDUPDELAY | ||
357 | + .columnName(), | ||
358 | + "getBondUpDelayColumn", | ||
359 | + VersionNum.VERSION100); | ||
360 | + return (Column) super.getColumnHandler(columndesc); | ||
361 | + } | ||
362 | + | ||
363 | + /** | ||
364 | + * Add a Column entity which column name is "bond_updelay" to the Row entity | ||
365 | + * of attributes. | ||
366 | + * @param bondUpDelay the column data which column name is "bond_updelay" | ||
367 | + */ | ||
368 | + public void setBondUpDelay(Set<Long> bondUpDelay) { | ||
369 | + ColumnDescription columndesc = new ColumnDescription( | ||
370 | + PortColumn.BONDUPDELAY | ||
371 | + .columnName(), | ||
372 | + "setBondUpDelay", | ||
373 | + VersionNum.VERSION100); | ||
374 | + super.setDataHandler(columndesc, bondUpDelay); | ||
375 | + } | ||
376 | + | ||
377 | + /** | ||
378 | + * Get the Column entity which column name is "bond_downdelay" from the Row | ||
379 | + * entity of attributes. | ||
380 | + * @return the Column entity | ||
381 | + */ | ||
382 | + public Column getBondDownDelayColumn() { | ||
383 | + ColumnDescription columndesc = new ColumnDescription( | ||
384 | + PortColumn.BONDDOWNDELAY | ||
385 | + .columnName(), | ||
386 | + "getBondDownDelayColumn", | ||
387 | + VersionNum.VERSION100); | ||
388 | + return (Column) super.getColumnHandler(columndesc); | ||
389 | + } | ||
390 | + | ||
391 | + /** | ||
392 | + * Add a Column entity which column name is "bond_downdelay" to the Row | ||
393 | + * entity of attributes. | ||
394 | + * @param bondDownDelay the column data which column name is | ||
395 | + * "bond_downdelay" | ||
396 | + */ | ||
397 | + public void setBondDownDelay(Set<Long> bondDownDelay) { | ||
398 | + ColumnDescription columndesc = new ColumnDescription( | ||
399 | + PortColumn.BONDDOWNDELAY | ||
400 | + .columnName(), | ||
401 | + "setBondDownDelay", | ||
402 | + VersionNum.VERSION100); | ||
403 | + super.setDataHandler(columndesc, bondDownDelay); | ||
404 | + } | ||
405 | + | ||
406 | + /** | ||
407 | + * Get the Column entity which column name is "bond_fake_iface" from the Row | ||
408 | + * entity of attributes. | ||
409 | + * @return the Column entity | ||
410 | + */ | ||
411 | + public Column getBondFakeInterfaceColumn() { | ||
412 | + ColumnDescription columndesc = new ColumnDescription( | ||
413 | + PortColumn.BONDFAKEIFACE | ||
414 | + .columnName(), | ||
415 | + "getBondFakeInterfaceColumn", | ||
416 | + VersionNum.VERSION100); | ||
417 | + return (Column) super.getColumnHandler(columndesc); | ||
418 | + } | ||
419 | + | ||
420 | + /** | ||
421 | + * Add a Column entity which column name is "bond_fake_iface" to the Row | ||
422 | + * entity of attributes. | ||
423 | + * @param bondFakeInterface the column data which column name is | ||
424 | + * "bond_fake_iface" | ||
425 | + */ | ||
426 | + public void setBondFakeInterface(Set<Boolean> bondFakeInterface) { | ||
427 | + ColumnDescription columndesc = new ColumnDescription( | ||
428 | + PortColumn.BONDFAKEIFACE | ||
429 | + .columnName(), | ||
430 | + "setBondFakeInterface", | ||
431 | + VersionNum.VERSION100); | ||
432 | + super.setDataHandler(columndesc, bondFakeInterface); | ||
433 | + } | ||
434 | + | ||
435 | + /** | ||
436 | + * Get the Column entity which column name is "fake_bridge" from the Row | ||
437 | + * entity of attributes. | ||
438 | + * @return the Column entity | ||
439 | + */ | ||
440 | + public Column getFakeBridgeColumn() { | ||
441 | + ColumnDescription columndesc = new ColumnDescription( | ||
442 | + PortColumn.FAKEBRIDGE | ||
443 | + .columnName(), | ||
444 | + "getFakeBridgeColumn", | ||
445 | + VersionNum.VERSION100); | ||
446 | + return (Column) super.getColumnHandler(columndesc); | ||
447 | + } | ||
448 | + | ||
449 | + /** | ||
450 | + * Add a Column entity which column name is "fake_bridge" to the Row entity | ||
451 | + * of attributes. | ||
452 | + * @param fakeBridge the column data which column name is "fake_bridge" | ||
453 | + */ | ||
454 | + public void setFakeBridge(Set<Boolean> fakeBridge) { | ||
455 | + ColumnDescription columndesc = new ColumnDescription( | ||
456 | + PortColumn.FAKEBRIDGE | ||
457 | + .columnName(), | ||
458 | + "setFakeBridge", | ||
459 | + VersionNum.VERSION100); | ||
460 | + super.setDataHandler(columndesc, fakeBridge); | ||
461 | + } | ||
462 | + | ||
463 | + /** | ||
464 | + * Get the Column entity which column name is "status" from the Row entity | ||
465 | + * of attributes. | ||
466 | + * @return the Column entity | ||
467 | + */ | ||
468 | + public Column getStatusColumn() { | ||
469 | + ColumnDescription columndesc = new ColumnDescription( | ||
470 | + PortColumn.STATUS | ||
471 | + .columnName(), | ||
472 | + "getStatusColumn", | ||
473 | + VersionNum.VERSION620); | ||
474 | + return (Column) super.getColumnHandler(columndesc); | ||
475 | + } | ||
476 | + | ||
477 | + /** | ||
478 | + * Add a Column entity which column name is "status" to the Row entity of | ||
479 | + * attributes. | ||
480 | + * @param status the column data which column name is "status" | ||
481 | + */ | ||
482 | + public void setStatus(Map<String, String> status) { | ||
483 | + ColumnDescription columndesc = new ColumnDescription( | ||
484 | + PortColumn.STATUS | ||
485 | + .columnName(), | ||
486 | + "setStatus", | ||
487 | + VersionNum.VERSION620); | ||
488 | + super.setDataHandler(columndesc, status); | ||
489 | + } | ||
490 | + | ||
491 | + /** | ||
492 | + * Get the Column entity which column name is "statistics" from the Row | ||
493 | + * entity of attributes. | ||
494 | + * @return the Column entity | ||
495 | + */ | ||
496 | + public Column getStatisticsColumn() { | ||
497 | + ColumnDescription columndesc = new ColumnDescription( | ||
498 | + PortColumn.STATISTICS | ||
499 | + .columnName(), | ||
500 | + "getStatisticsColumn", | ||
501 | + VersionNum.VERSION630); | ||
502 | + return (Column) super.getColumnHandler(columndesc); | ||
503 | + } | ||
504 | + | ||
505 | + /** | ||
506 | + * Add a Column entity which column name is "statistics" to the Row entity | ||
507 | + * of attributes. | ||
508 | + * @param statistics the column data which column name is "statistics" | ||
509 | + */ | ||
510 | + public void setStatistics(Map<String, Long> statistics) { | ||
511 | + ColumnDescription columndesc = new ColumnDescription( | ||
512 | + PortColumn.STATISTICS | ||
513 | + .columnName(), | ||
514 | + "setStatistics", | ||
515 | + VersionNum.VERSION630); | ||
516 | + super.setDataHandler(columndesc, statistics); | ||
517 | + } | ||
518 | + | ||
519 | + /** | ||
520 | + * Get the Column entity which column name is "other_config" from the Row | ||
521 | + * entity of attributes. | ||
522 | + * @return the Column entity | ||
523 | + */ | ||
524 | + public Column getOtherConfigColumn() { | ||
525 | + ColumnDescription columndesc = new ColumnDescription( | ||
526 | + PortColumn.OTHERCONFIG | ||
527 | + .columnName(), | ||
528 | + "getOtherConfigColumn", | ||
529 | + VersionNum.VERSION100); | ||
530 | + return (Column) super.getColumnHandler(columndesc); | ||
531 | + } | ||
532 | + | ||
533 | + /** | ||
534 | + * Add a Column entity which column name is "other_config" to the Row entity | ||
535 | + * of attributes. | ||
536 | + * @param otherConfig the column data which column name is "other_config" | ||
537 | + */ | ||
538 | + public void setOtherConfig(Map<String, String> otherConfig) { | ||
539 | + ColumnDescription columndesc = new ColumnDescription( | ||
540 | + PortColumn.OTHERCONFIG | ||
541 | + .columnName(), | ||
542 | + "setOtherConfig", | ||
543 | + VersionNum.VERSION100); | ||
544 | + super.setDataHandler(columndesc, otherConfig); | ||
545 | + } | ||
546 | + | ||
547 | + /** | ||
548 | + * Get the Column entity which column name is "external_ids" from the Row | ||
549 | + * entity of attributes. | ||
550 | + * @return the Column entity | ||
551 | + */ | ||
552 | + public Column getExternalIdsColumn() { | ||
553 | + ColumnDescription columndesc = new ColumnDescription( | ||
554 | + PortColumn.EXTERNALIDS | ||
555 | + .columnName(), | ||
556 | + "getExternalIdsColumn", | ||
557 | + VersionNum.VERSION100); | ||
558 | + return (Column) super.getColumnHandler(columndesc); | ||
559 | + } | ||
560 | + | ||
561 | + /** | ||
562 | + * Add a Column entity which column name is "external_ids" to the Row entity | ||
563 | + * of attributes. | ||
564 | + * @param externalIds the column data which column name is "external_ids" | ||
565 | + */ | ||
566 | + public void setExternalIds(Map<String, String> externalIds) { | ||
567 | + ColumnDescription columndesc = new ColumnDescription( | ||
568 | + PortColumn.EXTERNALIDS | ||
569 | + .columnName(), | ||
570 | + "setExternalIds", | ||
571 | + VersionNum.VERSION100); | ||
572 | + super.setDataHandler(columndesc, externalIds); | ||
573 | + } | ||
574 | + | ||
575 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.table; | ||
17 | + | ||
18 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
19 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
20 | + | ||
21 | +/** | ||
22 | + * Table generator. | ||
23 | + */ | ||
24 | +public final class TableGenerator { | ||
25 | + | ||
26 | + /** | ||
27 | + * Constructs a TableGenerator object. Utility classes should not have a | ||
28 | + * public or default constructor, otherwise it will compile failed. This | ||
29 | + * class should not be instantiated. | ||
30 | + */ | ||
31 | + private TableGenerator() { | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Create table. | ||
36 | + * @param dbSchema DatabaseSchema entity | ||
37 | + * @param tableName table name | ||
38 | + * @return Object table entity | ||
39 | + */ | ||
40 | + public static Object createTable(DatabaseSchema dbSchema, | ||
41 | + OvsdbTable tableName) { | ||
42 | + Row row = new Row(); | ||
43 | + return generateTable(dbSchema, row, tableName); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Get table from Row. | ||
48 | + * @param dbSchema DatabaseSchema entity | ||
49 | + * @param row Row entity | ||
50 | + * @param tableName table name | ||
51 | + * @return Object table entity | ||
52 | + */ | ||
53 | + public static Object getTable(DatabaseSchema dbSchema, Row row, | ||
54 | + OvsdbTable tableName) { | ||
55 | + return generateTable(dbSchema, row, tableName); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Generate the table by table name. | ||
60 | + * @param dbSchema DatabaseSchema entity | ||
61 | + * @param row Row entity | ||
62 | + * @param tableName table name | ||
63 | + * @return Object Table entity | ||
64 | + */ | ||
65 | + private static Object generateTable(DatabaseSchema dbSchema, Row row, | ||
66 | + OvsdbTable tableName) { | ||
67 | + switch (tableName) { | ||
68 | + case INTERFACE: | ||
69 | + return new Interface(dbSchema, row); | ||
70 | + case BRIDGE: | ||
71 | + return new Bridge(dbSchema, row); | ||
72 | + case CONTROLLER: | ||
73 | + return new Controller(dbSchema, row); | ||
74 | + case OPENVSWITCH: | ||
75 | + return new OpenVSwitch(dbSchema, row); | ||
76 | + case PORT: | ||
77 | + return new Port(dbSchema, row); | ||
78 | + default: | ||
79 | + return null; | ||
80 | + } | ||
81 | + } | ||
82 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.table; | ||
17 | + | ||
18 | +/** | ||
19 | + * The version number of tables and columns. | ||
20 | + */ | ||
21 | +public enum VersionNum { | ||
22 | + VERSION100("1.0.0"), VERSION102("1.0.2"), VERSION103("1.0.3"), | ||
23 | + VERSION104("1.0.4"), VERSION106("1.0.6"), VERSION110("1.1.0"), | ||
24 | + VERSION130("1.3.0"), VERSION200("2.0.0"), VERSION300("3.0.0"), | ||
25 | + VERSION330("3.3.0"), VERSION350("3.5.0"), VERSION400("4.0.0"), | ||
26 | + VERSION510("5.1.0"), VERSION520("5.2.0"), VERSION600("6.0.0"), | ||
27 | + VERSION610("6.1.0"), VERSION620("6.2.0"), VERSION630("6.3.0"), | ||
28 | + VERSION640("6.4.0"), VERSION650("6.5.0"), VERSION660("6.6.0"), | ||
29 | + VERSION670("6.7.0"), VERSION680("6.8.0"), VERSION690("6.9.0"), | ||
30 | + VERSION6100("6.10.0"), VERSION6111("6.11.1"), VERSION710("7.1.0"), | ||
31 | + VERSION720("7.2.0"), VERSION721("7.2.1"), VERSION730("7.3.0"), | ||
32 | + VERSION740("7.4.0"), VERSION750("7.5.0"), VERSION770("7.7.0"); | ||
33 | + | ||
34 | + private final String versionNum; | ||
35 | + | ||
36 | + private VersionNum(String versionNum) { | ||
37 | + this.versionNum = versionNum; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Returns the version number for VersionNum. | ||
42 | + * @return the version number | ||
43 | + */ | ||
44 | + public String versionNum() { | ||
45 | + return versionNum; | ||
46 | + } | ||
47 | +} |
ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.tableservice; | ||
17 | + | ||
18 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | + | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +import org.onosproject.ovsdb.rfc.error.ColumnSchemaNotFoundException; | ||
24 | +import org.onosproject.ovsdb.rfc.error.TableSchemaNotFoundException; | ||
25 | +import org.onosproject.ovsdb.rfc.error.TypedSchemaException; | ||
26 | +import org.onosproject.ovsdb.rfc.error.VersionMismatchException; | ||
27 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
28 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
29 | +import org.onosproject.ovsdb.rfc.notation.UUID; | ||
30 | +import org.onosproject.ovsdb.rfc.schema.ColumnSchema; | ||
31 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
32 | +import org.onosproject.ovsdb.rfc.schema.TableSchema; | ||
33 | +import org.onosproject.ovsdb.rfc.table.OvsdbTable; | ||
34 | +import org.onosproject.ovsdb.rfc.table.VersionNum; | ||
35 | +import org.onosproject.ovsdb.rfc.utils.VersionUtil; | ||
36 | + | ||
37 | +/** | ||
38 | + * Representation of conversion between Ovsdb table and Row. | ||
39 | + */ | ||
40 | +public abstract class AbstractOvsdbTableService implements OvsdbTableService { | ||
41 | + | ||
42 | + private final DatabaseSchema dbSchema; | ||
43 | + private final Row row; | ||
44 | + private final TableDescription tableDesc; | ||
45 | + | ||
46 | + /** | ||
47 | + * Constructs a AbstractOvsdbTableService object. | ||
48 | + * @param dbSchema DatabaseSchema entity | ||
49 | + * @param row Row entity | ||
50 | + * @param table table name | ||
51 | + * @param formVersion the initial version | ||
52 | + */ | ||
53 | + public AbstractOvsdbTableService(DatabaseSchema dbSchema, Row row, | ||
54 | + OvsdbTable table, VersionNum formVersion) { | ||
55 | + checkNotNull(dbSchema, "database schema cannot be null"); | ||
56 | + checkNotNull(row, "row cannot be null"); | ||
57 | + checkNotNull(table, "table cannot be null"); | ||
58 | + checkNotNull(formVersion, "the initial version cannot be null"); | ||
59 | + this.dbSchema = dbSchema; | ||
60 | + this.row = row; | ||
61 | + TableDescription tableDesc = new TableDescription(table, formVersion); | ||
62 | + this.tableDesc = tableDesc; | ||
63 | + row.setTableSchema(dbSchema.getTableSchema(table.tableName())); | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * Check whether the parameter of dbSchema is valid and check whether the | ||
68 | + * table is existent in Database Schema. | ||
69 | + */ | ||
70 | + private boolean isValid() { | ||
71 | + if (dbSchema == null) { | ||
72 | + return false; | ||
73 | + } | ||
74 | + if (!dbSchema.name().equalsIgnoreCase(tableDesc.database())) { | ||
75 | + return false; | ||
76 | + } | ||
77 | + checkTableSchemaVersion(); | ||
78 | + return true; | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * Check the table version. | ||
83 | + */ | ||
84 | + private void checkTableSchemaVersion() { | ||
85 | + String fromVersion = tableDesc.fromVersion(); | ||
86 | + String untilVersion = tableDesc.untilVersion(); | ||
87 | + String schemaVersion = dbSchema.version(); | ||
88 | + checkVersion(schemaVersion, fromVersion, untilVersion); | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * Check the column version. | ||
93 | + * @param columnDesc ColumnDescription entity | ||
94 | + */ | ||
95 | + private void checkColumnSchemaVersion(ColumnDescription columnDesc) { | ||
96 | + String fromVersion = columnDesc.fromVersion(); | ||
97 | + String untilVersion = columnDesc.untilVersion(); | ||
98 | + String schemaVersion = dbSchema.version(); | ||
99 | + checkVersion(schemaVersion, fromVersion, untilVersion); | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * Check whether the DatabaseSchema version between the initial version and | ||
104 | + * the end of the version. | ||
105 | + * @param schemaVersion DatabaseSchema version | ||
106 | + * @param fromVersion The initial version | ||
107 | + * @param untilVersion The end of the version | ||
108 | + * @throws VersionMismatchException this is a version mismatch exception | ||
109 | + */ | ||
110 | + private void checkVersion(String schemaVersion, String fromVersion, | ||
111 | + String untilVersion) { | ||
112 | + VersionUtil.versionMatch(fromVersion); | ||
113 | + VersionUtil.versionMatch(untilVersion); | ||
114 | + if (!fromVersion.equals(VersionUtil.DEFAULT_VERSION_STRING)) { | ||
115 | + if (VersionUtil.versionCompare(schemaVersion, fromVersion) < 0) { | ||
116 | + String message = VersionMismatchException | ||
117 | + .createFromMessage(schemaVersion, fromVersion); | ||
118 | + throw new VersionMismatchException(message); | ||
119 | + } | ||
120 | + } | ||
121 | + if (!untilVersion.equals(VersionUtil.DEFAULT_VERSION_STRING)) { | ||
122 | + if (VersionUtil.versionCompare(untilVersion, schemaVersion) < 0) { | ||
123 | + String message = VersionMismatchException | ||
124 | + .createToMessage(schemaVersion, untilVersion); | ||
125 | + throw new VersionMismatchException(message); | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * Returns TableSchema from dbSchema by table name. | ||
132 | + * @return TableSchema | ||
133 | + */ | ||
134 | + private TableSchema getTableSchema() { | ||
135 | + String tableName = tableDesc.name(); | ||
136 | + return dbSchema.getTableSchema(tableName); | ||
137 | + } | ||
138 | + | ||
139 | + /** | ||
140 | + * Returns ColumnSchema from TableSchema by column name. | ||
141 | + * @param tableSchema TableSchema entity | ||
142 | + * @param columnName column name | ||
143 | + * @return ColumnSchema | ||
144 | + */ | ||
145 | + private ColumnSchema getColumnSchema(TableSchema tableSchema, | ||
146 | + String columnName) { | ||
147 | + return tableSchema.getColumnSchema(columnName); | ||
148 | + } | ||
149 | + | ||
150 | + @Override | ||
151 | + public Column getColumnHandler(ColumnDescription columnDesc) { | ||
152 | + if (!isValid()) { | ||
153 | + return null; | ||
154 | + } | ||
155 | + String columnName = columnDesc.name(); | ||
156 | + checkColumnSchemaVersion(columnDesc); | ||
157 | + if (columnName == null) { | ||
158 | + throw new TypedSchemaException("Error processing GetColumn : " | ||
159 | + + tableDesc.name() + "." + columnDesc.method()); | ||
160 | + } | ||
161 | + TableSchema tableSchema = getTableSchema(); | ||
162 | + if (tableSchema == null) { | ||
163 | + String message = TableSchemaNotFoundException | ||
164 | + .createMessage(tableDesc.name(), dbSchema.name()); | ||
165 | + throw new TableSchemaNotFoundException(message); | ||
166 | + } | ||
167 | + ColumnSchema columnSchema = getColumnSchema(tableSchema, columnName); | ||
168 | + if (columnSchema == null) { | ||
169 | + String message = ColumnSchemaNotFoundException | ||
170 | + .createMessage(columnName, tableSchema.name()); | ||
171 | + throw new ColumnSchemaNotFoundException(message); | ||
172 | + } | ||
173 | + if (row == null) { | ||
174 | + return new Column(columnSchema, null); | ||
175 | + } | ||
176 | + return row.getColumn(columnSchema); | ||
177 | + } | ||
178 | + | ||
179 | + @Override | ||
180 | + public Object getDataHandler(ColumnDescription columnDesc) { | ||
181 | + if (!isValid()) { | ||
182 | + return null; | ||
183 | + } | ||
184 | + String columnName = columnDesc.name(); | ||
185 | + checkColumnSchemaVersion(columnDesc); | ||
186 | + if (columnName == null) { | ||
187 | + throw new TypedSchemaException("Error processing GetColumn : " | ||
188 | + + tableDesc.name() + "." + columnDesc.method()); | ||
189 | + } | ||
190 | + TableSchema tableSchema = getTableSchema(); | ||
191 | + if (tableSchema == null) { | ||
192 | + String message = TableSchemaNotFoundException | ||
193 | + .createMessage(tableDesc.name(), dbSchema.name()); | ||
194 | + throw new TableSchemaNotFoundException(message); | ||
195 | + } | ||
196 | + ColumnSchema columnSchema = getColumnSchema(tableSchema, columnName); | ||
197 | + if (columnSchema == null) { | ||
198 | + String message = ColumnSchemaNotFoundException | ||
199 | + .createMessage(columnName, tableSchema.name()); | ||
200 | + throw new ColumnSchemaNotFoundException(message); | ||
201 | + } | ||
202 | + if (row == null || row.getColumn(columnSchema) == null) { | ||
203 | + return null; | ||
204 | + } | ||
205 | + return row.getColumn(columnSchema).data(); | ||
206 | + } | ||
207 | + | ||
208 | + @Override | ||
209 | + public void setDataHandler(ColumnDescription columnDesc, Object obj) { | ||
210 | + if (!isValid()) { | ||
211 | + return; | ||
212 | + } | ||
213 | + String columnName = columnDesc.name(); | ||
214 | + checkColumnSchemaVersion(columnDesc); | ||
215 | + if (columnName == null) { | ||
216 | + throw new TypedSchemaException("Unable to locate Column Name for " | ||
217 | + + tableDesc.name() + "." + columnDesc.method()); | ||
218 | + } | ||
219 | + TableSchema tableSchema = getTableSchema(); | ||
220 | + ColumnSchema columnSchema = getColumnSchema(tableSchema, columnName); | ||
221 | + Column column = new Column(columnSchema, obj); | ||
222 | + row.addColumn(columnName, column); | ||
223 | + } | ||
224 | + | ||
225 | + @Override | ||
226 | + public Object getTbSchema() { | ||
227 | + if (!isValid()) { | ||
228 | + return null; | ||
229 | + } | ||
230 | + if (dbSchema == null) { | ||
231 | + return null; | ||
232 | + } | ||
233 | + return getTableSchema(); | ||
234 | + } | ||
235 | + | ||
236 | + @Override | ||
237 | + public UUID getUuid() { | ||
238 | + if (!isValid()) { | ||
239 | + return null; | ||
240 | + } | ||
241 | + ColumnDescription columnDesc = new ColumnDescription("_uuid", | ||
242 | + "getTbUuid"); | ||
243 | + return (UUID) getDataHandler(columnDesc); | ||
244 | + } | ||
245 | + | ||
246 | + @Override | ||
247 | + public Column getUuidColumn() { | ||
248 | + if (!isValid()) { | ||
249 | + return null; | ||
250 | + } | ||
251 | + ColumnDescription columnDesc = new ColumnDescription("_uuid", | ||
252 | + "getTbUuidColumn"); | ||
253 | + return (Column) getColumnHandler(columnDesc); | ||
254 | + } | ||
255 | + | ||
256 | + @Override | ||
257 | + public UUID getVersion() { | ||
258 | + if (!isValid()) { | ||
259 | + return null; | ||
260 | + } | ||
261 | + ColumnDescription columnDesc = new ColumnDescription("_version", | ||
262 | + "getTbVersion"); | ||
263 | + return (UUID) getDataHandler(columnDesc); | ||
264 | + } | ||
265 | + | ||
266 | + @Override | ||
267 | + public Column getVersionColumn() { | ||
268 | + if (!isValid()) { | ||
269 | + return null; | ||
270 | + } | ||
271 | + ColumnDescription columnDesc = new ColumnDescription("_version", | ||
272 | + "getTbVersionColumn"); | ||
273 | + return (Column) getColumnHandler(columnDesc); | ||
274 | + } | ||
275 | + | ||
276 | + /** | ||
277 | + * Get DatabaseSchema entity. | ||
278 | + * @return DatabaseSchema entity | ||
279 | + */ | ||
280 | + public DatabaseSchema dbSchema() { | ||
281 | + return dbSchema; | ||
282 | + } | ||
283 | + | ||
284 | + /** | ||
285 | + * Get Row entity. | ||
286 | + * @return Row entity | ||
287 | + */ | ||
288 | + public Row getRow() { | ||
289 | + if (!isValid()) { | ||
290 | + return null; | ||
291 | + } | ||
292 | + return this.row; | ||
293 | + } | ||
294 | + | ||
295 | + /** | ||
296 | + * Get TableDescription entity. | ||
297 | + * @return TableDescription entity | ||
298 | + */ | ||
299 | + public TableDescription tableDesc() { | ||
300 | + return tableDesc; | ||
301 | + } | ||
302 | + | ||
303 | + @Override | ||
304 | + public int hashCode() { | ||
305 | + return Objects.hash(row); | ||
306 | + } | ||
307 | + | ||
308 | + @Override | ||
309 | + public boolean equals(Object obj) { | ||
310 | + if (this == obj) { | ||
311 | + return true; | ||
312 | + } | ||
313 | + if (obj instanceof AbstractOvsdbTableService) { | ||
314 | + final AbstractOvsdbTableService other = (AbstractOvsdbTableService) obj; | ||
315 | + return Objects.equals(this.row, other.row); | ||
316 | + } | ||
317 | + return false; | ||
318 | + } | ||
319 | + | ||
320 | + @Override | ||
321 | + public String toString() { | ||
322 | + TableSchema schema = (TableSchema) getTbSchema(); | ||
323 | + String tableName = schema.name(); | ||
324 | + return toStringHelper(this).add("tableName", tableName).add("row", row) | ||
325 | + .toString(); | ||
326 | + } | ||
327 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.tableservice; | ||
17 | + | ||
18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | + | ||
20 | +import org.onosproject.ovsdb.rfc.table.VersionNum; | ||
21 | +import org.onosproject.ovsdb.rfc.utils.VersionUtil; | ||
22 | + | ||
23 | +/** | ||
24 | + * Column description. | ||
25 | + */ | ||
26 | +public class ColumnDescription { | ||
27 | + | ||
28 | + // The column name | ||
29 | + private final String name; | ||
30 | + // The method name | ||
31 | + private final String method; | ||
32 | + // The initial version | ||
33 | + private final String fromVersion; | ||
34 | + // The end of the version | ||
35 | + private final String untilVersion; | ||
36 | + | ||
37 | + /** | ||
38 | + * Constructs a MonitorRequest object. | ||
39 | + * @param name column name | ||
40 | + * @param method method name | ||
41 | + */ | ||
42 | + public ColumnDescription(String name, String method) { | ||
43 | + checkNotNull(name, "name cannot be null"); | ||
44 | + checkNotNull(method, "method cannot be null"); | ||
45 | + this.name = name; | ||
46 | + this.method = method; | ||
47 | + this.fromVersion = VersionUtil.DEFAULT_VERSION_STRING; | ||
48 | + this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING; | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * Constructs a MonitorRequest object. | ||
53 | + * @param name column name | ||
54 | + * @param method method name | ||
55 | + * @param fromVersion the initial version | ||
56 | + */ | ||
57 | + public ColumnDescription(String name, String method, VersionNum fromVersion) { | ||
58 | + checkNotNull(name, "name cannot be null"); | ||
59 | + checkNotNull(method, "method cannot be null"); | ||
60 | + checkNotNull(fromVersion, "the initial version cannot be null"); | ||
61 | + this.name = name; | ||
62 | + this.method = method; | ||
63 | + this.fromVersion = fromVersion.versionNum(); | ||
64 | + this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Constructs a MonitorRequest object. | ||
69 | + * @param name column name | ||
70 | + * @param method method name | ||
71 | + * @param fromVersion the initial version | ||
72 | + * @param untilVersion the end of the version | ||
73 | + */ | ||
74 | + public ColumnDescription(String name, String method, VersionNum fromVersion, | ||
75 | + VersionNum untilVersion) { | ||
76 | + checkNotNull(name, "name cannot be null"); | ||
77 | + checkNotNull(method, "method cannot be null"); | ||
78 | + checkNotNull(fromVersion, "the initial version cannot be null"); | ||
79 | + checkNotNull(untilVersion, "the end of the version cannot be null"); | ||
80 | + this.name = name; | ||
81 | + this.method = method; | ||
82 | + this.fromVersion = fromVersion.versionNum(); | ||
83 | + this.untilVersion = untilVersion.versionNum(); | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * Returns the column name. | ||
88 | + * @return the column name | ||
89 | + */ | ||
90 | + public String name() { | ||
91 | + return name; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * Returns the method name. | ||
96 | + * @return the method name | ||
97 | + */ | ||
98 | + public String method() { | ||
99 | + return method; | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * Returns the initial version. | ||
104 | + * @return the initial version | ||
105 | + */ | ||
106 | + public String fromVersion() { | ||
107 | + return fromVersion; | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * Returns the end of the version. | ||
112 | + * @return the end of the version | ||
113 | + */ | ||
114 | + public String untilVersion() { | ||
115 | + return untilVersion; | ||
116 | + } | ||
117 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.tableservice; | ||
17 | + | ||
18 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
19 | +import org.onosproject.ovsdb.rfc.notation.UUID; | ||
20 | + | ||
21 | +/** | ||
22 | + * Representation of conversion between Ovsdb table and Row. | ||
23 | + */ | ||
24 | +public interface OvsdbTableService { | ||
25 | + | ||
26 | + /** | ||
27 | + * Get Column from row. | ||
28 | + * @param columndesc Column description | ||
29 | + * @return Column | ||
30 | + */ | ||
31 | + public Column getColumnHandler(ColumnDescription columndesc); | ||
32 | + | ||
33 | + /** | ||
34 | + * Get Data from row. | ||
35 | + * @param columndesc Column description | ||
36 | + * @return Object column data | ||
37 | + */ | ||
38 | + public Object getDataHandler(ColumnDescription columndesc); | ||
39 | + | ||
40 | + /** | ||
41 | + * Set column data of row. | ||
42 | + * @param columndesc Column description | ||
43 | + * @param obj column data | ||
44 | + */ | ||
45 | + public void setDataHandler(ColumnDescription columndesc, Object obj); | ||
46 | + | ||
47 | + /** | ||
48 | + * Returns the TableSchema from row. | ||
49 | + * @return Object TableSchema | ||
50 | + */ | ||
51 | + public Object getTbSchema(); | ||
52 | + | ||
53 | + /** | ||
54 | + * Returns UUID which column name is _uuid. | ||
55 | + * @return UUID | ||
56 | + */ | ||
57 | + public UUID getUuid(); | ||
58 | + | ||
59 | + /** | ||
60 | + * Returns UUID Column which column name is _uuid. | ||
61 | + * @return UUID Column | ||
62 | + */ | ||
63 | + public Column getUuidColumn(); | ||
64 | + | ||
65 | + /** | ||
66 | + * Returns UUID which column name is _version. | ||
67 | + * @return UUID | ||
68 | + */ | ||
69 | + public UUID getVersion(); | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns UUID Column which column name is _version. | ||
73 | + * @return UUID Column | ||
74 | + */ | ||
75 | + public Column getVersionColumn(); | ||
76 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.tableservice; | ||
17 | + | ||
18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | + | ||
20 | +import org.onosproject.ovsdb.rfc.table.OvsdbTable; | ||
21 | +import org.onosproject.ovsdb.rfc.table.VersionNum; | ||
22 | +import org.onosproject.ovsdb.rfc.utils.VersionUtil; | ||
23 | + | ||
24 | +/** | ||
25 | + * Table description. | ||
26 | + */ | ||
27 | +public class TableDescription { | ||
28 | + | ||
29 | + // The table name | ||
30 | + private final String name; | ||
31 | + // The database name | ||
32 | + private final String database = "Open_vSwitch"; | ||
33 | + // The initial version | ||
34 | + private final String fromVersion; | ||
35 | + // The end of the version | ||
36 | + private final String untilVersion; | ||
37 | + | ||
38 | + /** | ||
39 | + * Constructs a MonitorRequest object. | ||
40 | + * @param table OvsdbTable entity | ||
41 | + */ | ||
42 | + public TableDescription(OvsdbTable table) { | ||
43 | + checkNotNull(table, "table cannot be null"); | ||
44 | + this.name = table.tableName(); | ||
45 | + this.fromVersion = VersionUtil.DEFAULT_VERSION_STRING; | ||
46 | + this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Constructs a MonitorRequest object. | ||
51 | + * @param table OvsdbTable entity | ||
52 | + * @param fromVersion the initial version | ||
53 | + */ | ||
54 | + public TableDescription(OvsdbTable table, VersionNum fromVersion) { | ||
55 | + checkNotNull(table, "table cannot be null"); | ||
56 | + checkNotNull(fromVersion, "the initial version cannot be null"); | ||
57 | + this.name = table.tableName(); | ||
58 | + this.fromVersion = fromVersion.versionNum(); | ||
59 | + this.untilVersion = VersionUtil.DEFAULT_VERSION_STRING; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Constructs a MonitorRequest object. | ||
64 | + * @param table OvsdbTable entity | ||
65 | + * @param fromVersion the initial version | ||
66 | + * @param untilVersion the end of the version | ||
67 | + */ | ||
68 | + public TableDescription(OvsdbTable table, VersionNum fromVersion, VersionNum untilVersion) { | ||
69 | + checkNotNull(table, "table cannot be null"); | ||
70 | + checkNotNull(fromVersion, "the initial version cannot be null"); | ||
71 | + checkNotNull(untilVersion, "the end of the version cannot be null"); | ||
72 | + this.name = table.tableName(); | ||
73 | + this.fromVersion = fromVersion.versionNum(); | ||
74 | + this.untilVersion = untilVersion.versionNum(); | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Returns the column name. | ||
79 | + * @return the column name | ||
80 | + */ | ||
81 | + public String name() { | ||
82 | + return name; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Returns the database name. | ||
87 | + * @return the database name | ||
88 | + */ | ||
89 | + public String database() { | ||
90 | + return database; | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * Returns the initial version. | ||
95 | + * @return the initial version | ||
96 | + */ | ||
97 | + public String fromVersion() { | ||
98 | + return fromVersion; | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * Returns the end of the version. | ||
103 | + * @return the end of the version | ||
104 | + */ | ||
105 | + public String untilVersion() { | ||
106 | + return untilVersion; | ||
107 | + } | ||
108 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +import org.onosproject.ovsdb.rfc.notation.Condition; | ||
19 | +import org.onosproject.ovsdb.rfc.notation.Condition.Function; | ||
20 | + | ||
21 | +/** | ||
22 | + * Condition utility class. | ||
23 | + */ | ||
24 | +public final class ConditionUtil { | ||
25 | + | ||
26 | + /** | ||
27 | + * Constructs a ConditionUtil object. Utility classes should not have a | ||
28 | + * public or default constructor, otherwise IDE will compile unsuccessfully. This | ||
29 | + * class should not be instantiated. | ||
30 | + */ | ||
31 | + private ConditionUtil() { | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns a Condition that means Function.EQUALS . | ||
36 | + * @param columnName column name | ||
37 | + * @param data column value | ||
38 | + * @return Condition | ||
39 | + */ | ||
40 | + public static Condition equals(String columnName, Object data) { | ||
41 | + Object value = TransValueUtil.getFormatData(data); | ||
42 | + return new Condition(columnName, Function.EQUALS, value); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * Returns a Condition that means Function.NOT_EQUALS . | ||
47 | + * @param columnName column name | ||
48 | + * @param data column value | ||
49 | + * @return Condition | ||
50 | + */ | ||
51 | + public static Condition unEquals(String columnName, Object data) { | ||
52 | + Object value = TransValueUtil.getFormatData(data); | ||
53 | + return new Condition(columnName, Function.NOT_EQUALS, value); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns a Condition that means Function.GREATER_THAN . | ||
58 | + * @param columnName column name | ||
59 | + * @param data column value | ||
60 | + * @return Condition | ||
61 | + */ | ||
62 | + public static Condition greaterThan(String columnName, Object data) { | ||
63 | + Object value = TransValueUtil.getFormatData(data); | ||
64 | + return new Condition(columnName, Function.GREATER_THAN, value); | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Returns a Condition that means Function.GREATER_THAN_OR_EQUALS . | ||
69 | + * @param columnName column name | ||
70 | + * @param data column value | ||
71 | + * @return Condition | ||
72 | + */ | ||
73 | + public static Condition greaterThanOrEquals(String columnName, Object data) { | ||
74 | + Object value = TransValueUtil.getFormatData(data); | ||
75 | + return new Condition(columnName, Function.GREATER_THAN_OR_EQUALS, value); | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Returns a Condition that means Function.LESS_THAN . | ||
80 | + * @param columnName column name | ||
81 | + * @param data column value | ||
82 | + * @return Condition | ||
83 | + */ | ||
84 | + public static Condition lesserThan(String columnName, Object data) { | ||
85 | + Object value = TransValueUtil.getFormatData(data); | ||
86 | + return new Condition(columnName, Function.LESS_THAN, value); | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Returns a Condition that means Function.LESS_THAN_OR_EQUALS . | ||
91 | + * @param columnName column name | ||
92 | + * @param data column value | ||
93 | + * @return Condition | ||
94 | + */ | ||
95 | + public static Condition lesserThanOrEquals(String columnName, Object data) { | ||
96 | + Object value = TransValueUtil.getFormatData(data); | ||
97 | + return new Condition(columnName, Function.LESS_THAN_OR_EQUALS, value); | ||
98 | + } | ||
99 | + | ||
100 | + /** | ||
101 | + * Returns a Condition that means Function.INCLUDES . | ||
102 | + * @param columnName column name | ||
103 | + * @param data column value | ||
104 | + * @return Condition | ||
105 | + */ | ||
106 | + public static Condition includes(String columnName, Object data) { | ||
107 | + Object value = TransValueUtil.getFormatData(data); | ||
108 | + return new Condition(columnName, Function.INCLUDES, value); | ||
109 | + } | ||
110 | + | ||
111 | + /** | ||
112 | + * Returns a Condition that means Function.EXCLUDES . | ||
113 | + * @param columnName column name | ||
114 | + * @param data column value | ||
115 | + * @return Condition | ||
116 | + */ | ||
117 | + public static Condition excludes(String columnName, Object data) { | ||
118 | + Object value = TransValueUtil.getFormatData(data); | ||
119 | + return new Condition(columnName, Function.EXCLUDES, value); | ||
120 | + } | ||
121 | + | ||
122 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +import java.util.ArrayList; | ||
19 | +import java.util.HashMap; | ||
20 | +import java.util.Iterator; | ||
21 | +import java.util.List; | ||
22 | +import java.util.Map; | ||
23 | +import java.util.Map.Entry; | ||
24 | + | ||
25 | +import org.onosproject.ovsdb.rfc.error.AbnormalSchemaException; | ||
26 | +import org.onosproject.ovsdb.rfc.error.JsonParsingException; | ||
27 | +import org.onosproject.ovsdb.rfc.error.UnknownResultException; | ||
28 | +import org.onosproject.ovsdb.rfc.jsonrpc.Callback; | ||
29 | +import org.onosproject.ovsdb.rfc.jsonrpc.JsonRpcResponse; | ||
30 | +import org.onosproject.ovsdb.rfc.message.OperationResult; | ||
31 | +import org.onosproject.ovsdb.rfc.message.RowUpdate; | ||
32 | +import org.onosproject.ovsdb.rfc.message.TableUpdate; | ||
33 | +import org.onosproject.ovsdb.rfc.message.TableUpdates; | ||
34 | +import org.onosproject.ovsdb.rfc.message.UpdateNotification; | ||
35 | +import org.onosproject.ovsdb.rfc.notation.Column; | ||
36 | +import org.onosproject.ovsdb.rfc.notation.Row; | ||
37 | +import org.onosproject.ovsdb.rfc.notation.UUID; | ||
38 | +import org.onosproject.ovsdb.rfc.operations.Operation; | ||
39 | +import org.onosproject.ovsdb.rfc.schema.ColumnSchema; | ||
40 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
41 | +import org.onosproject.ovsdb.rfc.schema.TableSchema; | ||
42 | +import org.onosproject.ovsdb.rfc.schema.type.ColumnTypeFactory; | ||
43 | +import org.slf4j.Logger; | ||
44 | +import org.slf4j.LoggerFactory; | ||
45 | + | ||
46 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
47 | +import com.fasterxml.jackson.databind.JsonNode; | ||
48 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
49 | +import com.google.common.collect.Lists; | ||
50 | +import com.google.common.collect.Maps; | ||
51 | + | ||
52 | +/** | ||
53 | + * JsonNode utility class. convert JsonNode into Object. | ||
54 | + */ | ||
55 | +public final class FromJsonUtil { | ||
56 | + | ||
57 | + private static final Logger log = LoggerFactory | ||
58 | + .getLogger(FromJsonUtil.class); | ||
59 | + | ||
60 | + /** | ||
61 | + * Constructs a FromJsonUtil object. Utility classes should not have a | ||
62 | + * public or default constructor, otherwise IDE will compile unsuccessfully. This | ||
63 | + * class should not be instantiated. | ||
64 | + */ | ||
65 | + private FromJsonUtil() { | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * convert JsonNode into DatabaseSchema. | ||
70 | + * @param dbName database name | ||
71 | + * @param json the JsonNode of get_schema result | ||
72 | + * @return DatabaseSchema | ||
73 | + * @throws JsonParsingException this is a JsonNode parse exception | ||
74 | + */ | ||
75 | + public static DatabaseSchema jsonNodeToDbSchema(String dbName, JsonNode json) { | ||
76 | + if (!json.isObject() || !json.has("tables")) { | ||
77 | + throw new JsonParsingException( | ||
78 | + "bad DatabaseSchema root, expected \"tables\" as child but was not found"); | ||
79 | + } | ||
80 | + if (!json.isObject() || !json.has("version")) { | ||
81 | + throw new JsonParsingException( | ||
82 | + "bad DatabaseSchema root, expected \"version\" as child but was not found"); | ||
83 | + } | ||
84 | + | ||
85 | + String dbVersion = json.get("version").asText(); | ||
86 | + | ||
87 | + Map<String, TableSchema> tables = new HashMap<>(); | ||
88 | + for (Iterator<Map.Entry<String, JsonNode>> iter = json.get("tables") | ||
89 | + .fields(); iter.hasNext();) { | ||
90 | + Map.Entry<String, JsonNode> table = iter.next(); | ||
91 | + tables.put(table.getKey(), | ||
92 | + jsonNodeToTableSchema(table.getKey(), table.getValue())); | ||
93 | + } | ||
94 | + | ||
95 | + return new DatabaseSchema(dbName, dbVersion, tables); | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * convert JsonNode into TableSchema. | ||
100 | + * @param tableName table name | ||
101 | + * @param json table JsonNode | ||
102 | + * @return TableSchema | ||
103 | + * @throws AbnormalSchemaException this is an abnormal schema exception | ||
104 | + */ | ||
105 | + private static TableSchema jsonNodeToTableSchema(String tableName, | ||
106 | + JsonNode json) { | ||
107 | + | ||
108 | + if (!json.isObject() || !json.has("columns")) { | ||
109 | + throw new AbnormalSchemaException( | ||
110 | + "bad tableschema root, expected \"columns\" as child"); | ||
111 | + } | ||
112 | + | ||
113 | + Map<String, ColumnSchema> columns = new HashMap<>(); | ||
114 | + for (Iterator<Map.Entry<String, JsonNode>> iter = json.get("columns") | ||
115 | + .fields(); iter.hasNext();) { | ||
116 | + Map.Entry<String, JsonNode> column = iter.next(); | ||
117 | + columns.put(column.getKey(), | ||
118 | + jsonNodeToColumnSchema(column.getKey(), | ||
119 | + column.getValue())); | ||
120 | + } | ||
121 | + | ||
122 | + return new TableSchema(tableName, columns); | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * convert JsonNode into ColumnSchema. | ||
127 | + * @param name column name | ||
128 | + * @param json JsonNode | ||
129 | + * @return ColumnSchema | ||
130 | + * @throws AbnormalSchemaException this is an abnormal schema exception | ||
131 | + */ | ||
132 | + private static ColumnSchema jsonNodeToColumnSchema(String name, | ||
133 | + JsonNode json) { | ||
134 | + if (!json.isObject() || !json.has("type")) { | ||
135 | + throw new AbnormalSchemaException( | ||
136 | + "bad column schema root, expected \"type\" as child"); | ||
137 | + } | ||
138 | + | ||
139 | + return new ColumnSchema(name, | ||
140 | + ColumnTypeFactory.getColumnTypeFromJson(json | ||
141 | + .get("type"))); | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * convert JsonNode into the returnType of methods in OvsdbRPC class. | ||
146 | + * @param resultJsonNode the result JsonNode | ||
147 | + * @param methodName the method name of methods in OvsdbRPC class | ||
148 | + * @param objectMapper ObjectMapper entity | ||
149 | + * @return Object | ||
150 | + * @throws UnknownResultException this is an unknown result exception | ||
151 | + */ | ||
152 | + private static Object convertResultType(JsonNode resultJsonNode, | ||
153 | + String methodName, | ||
154 | + ObjectMapper objectMapper) { | ||
155 | + switch (methodName) { | ||
156 | + case "getSchema": | ||
157 | + case "monitor": | ||
158 | + return resultJsonNode; | ||
159 | + case "echo": | ||
160 | + case "listDbs": | ||
161 | + return objectMapper | ||
162 | + .convertValue(resultJsonNode, objectMapper.getTypeFactory() | ||
163 | + .constructParametricType(List.class, String.class)); | ||
164 | + case "transact": | ||
165 | + return objectMapper | ||
166 | + .convertValue(resultJsonNode, | ||
167 | + objectMapper | ||
168 | + .getTypeFactory() | ||
169 | + .constructParametricType(List.class, | ||
170 | + JsonNode.class)); | ||
171 | + default: | ||
172 | + throw new UnknownResultException("Don't know how to handle this"); | ||
173 | + } | ||
174 | + } | ||
175 | + | ||
176 | + /** | ||
177 | + * convert JsonNode into the returnType of methods in OvsdbRPC class. | ||
178 | + * @param jsonNode the result JsonNode | ||
179 | + * @param methodName the method name of methods in OvsdbRPC class | ||
180 | + * @return Object | ||
181 | + */ | ||
182 | + public static Object jsonResultParser(JsonNode jsonNode, String methodName) { | ||
183 | + ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper(); | ||
184 | + JsonNode error = jsonNode.get("error"); | ||
185 | + if (error != null && !error.isNull()) { | ||
186 | + log.error("Error : {}", error.toString()); | ||
187 | + } | ||
188 | + JsonNode resultJsonNode = jsonNode.get("result"); | ||
189 | + Object result = convertResultType(resultJsonNode, methodName, | ||
190 | + objectMapper); | ||
191 | + return result; | ||
192 | + } | ||
193 | + | ||
194 | + /** | ||
195 | + * When monitor the ovsdb tables, if a table update, ovs send update | ||
196 | + * notification, then call callback function. | ||
197 | + * @param jsonNode the result JsonNode | ||
198 | + * @param callback the callback function | ||
199 | + * @throws UnknownResultException this is an unknown result exception | ||
200 | + */ | ||
201 | + public static void jsonCallbackRequestParser(JsonNode jsonNode, | ||
202 | + Callback callback) { | ||
203 | + ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper(); | ||
204 | + JsonNode params = jsonNode.get("params"); | ||
205 | + Object param = null; | ||
206 | + String methodName = jsonNode.get("method").asText(); | ||
207 | + switch (methodName) { | ||
208 | + case "update": | ||
209 | + param = objectMapper.convertValue(params, UpdateNotification.class); | ||
210 | + callback.update((UpdateNotification) param); | ||
211 | + break; | ||
212 | + default: | ||
213 | + throw new UnknownResultException("Cannot handle this method: " | ||
214 | + + methodName); | ||
215 | + } | ||
216 | + } | ||
217 | + | ||
218 | + /** | ||
219 | + * Ovs send echo request to keep the heart, need we return echo result. | ||
220 | + * @param jsonNode the result JsonNode | ||
221 | + * @return JsonRpcResponse String | ||
222 | + */ | ||
223 | + public static String getEchoRequestStr(JsonNode jsonNode) { | ||
224 | + ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper(); | ||
225 | + String str = null; | ||
226 | + if (jsonNode.get("method").asText().equals("echo")) { | ||
227 | + JsonRpcResponse response = new JsonRpcResponse(jsonNode.get("id") | ||
228 | + .asText()); | ||
229 | + try { | ||
230 | + str = objectMapper.writeValueAsString(response); | ||
231 | + } catch (JsonProcessingException e) { | ||
232 | + log.error("JsonProcessingException while converting JsonNode into string ", e); | ||
233 | + } | ||
234 | + } | ||
235 | + return str; | ||
236 | + } | ||
237 | + | ||
238 | + /** | ||
239 | + * Convert the List of Operation result into List of OperationResult . | ||
240 | + * @param input the List of JsonNode | ||
241 | + * @param operations the List of Operation | ||
242 | + * @return the List of OperationResult | ||
243 | + */ | ||
244 | + public static List<OperationResult> jsonNodeToOperationResult(List<JsonNode> input, | ||
245 | + List<Operation> operations) { | ||
246 | + ObjectMapper objectMapper = ObjectMapperUtil.getObjectMapper(false); | ||
247 | + List<OperationResult> operationResults = new ArrayList<OperationResult>(); | ||
248 | + for (int i = 0; i < input.size(); i++) { | ||
249 | + JsonNode jsonNode = input.get(i); | ||
250 | + Operation operation = operations.get(i); | ||
251 | + if (jsonNode != null && jsonNode.size() > 0) { | ||
252 | + if (i >= operations.size() || operation.getOp() != "select") { | ||
253 | + OperationResult or = objectMapper.convertValue(jsonNode, | ||
254 | + OperationResult.class); | ||
255 | + operationResults.add(or); | ||
256 | + } else { | ||
257 | + List<Row> rows = createRows(operation.getTableSchema(), jsonNode); | ||
258 | + OperationResult or = new OperationResult(rows); | ||
259 | + operationResults.add(or); | ||
260 | + } | ||
261 | + } | ||
262 | + } | ||
263 | + return operationResults; | ||
264 | + } | ||
265 | + | ||
266 | + /** | ||
267 | + * Convert Operation JsonNode into Rows. | ||
268 | + * @param tableSchema TableSchema entity | ||
269 | + * @param rowsNode JsonNode | ||
270 | + * @return ArrayList<Row> the List of Row | ||
271 | + */ | ||
272 | + private static ArrayList<Row> createRows(TableSchema tableSchema, | ||
273 | + JsonNode rowsNode) { | ||
274 | + ArrayList<Row> rows = Lists.newArrayList(); | ||
275 | + for (JsonNode rowNode : rowsNode.get("rows")) { | ||
276 | + rows.add(createRow(tableSchema, rowNode)); | ||
277 | + } | ||
278 | + return rows; | ||
279 | + } | ||
280 | + | ||
281 | + /** | ||
282 | + * convert the params of Update Notification into TableUpdates. | ||
283 | + * @param updatesJson the params of Update Notification | ||
284 | + * @param dbSchema DatabaseSchema entity | ||
285 | + * @return TableUpdates | ||
286 | + */ | ||
287 | + public static TableUpdates jsonNodeToTableUpdates(JsonNode updatesJson, | ||
288 | + DatabaseSchema dbSchema) { | ||
289 | + Map<String, TableUpdate> tableUpdateMap = Maps.newHashMap(); | ||
290 | + for (Iterator<Map.Entry<String, JsonNode>> itr = updatesJson.fields(); itr | ||
291 | + .hasNext();) { | ||
292 | + Map.Entry<String, JsonNode> entry = itr.next(); | ||
293 | + TableSchema tableSchema = dbSchema.getTableSchema(entry.getKey()); | ||
294 | + TableUpdate tableUpdate = jsonNodeToTableUpdate(tableSchema, | ||
295 | + entry.getValue()); | ||
296 | + tableUpdateMap.put(entry.getKey(), tableUpdate); | ||
297 | + } | ||
298 | + return TableUpdates.tableUpdates(tableUpdateMap); | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
302 | + * convert the params of Update Notification into TableUpdate. | ||
303 | + * @param tableSchema TableSchema entity | ||
304 | + * @param value the table-update in params of Update Notification | ||
305 | + * @return TableUpdate | ||
306 | + */ | ||
307 | + public static TableUpdate jsonNodeToTableUpdate(TableSchema tableSchema, | ||
308 | + JsonNode value) { | ||
309 | + Map<UUID, RowUpdate> rows = Maps.newHashMap(); | ||
310 | + Iterator<Entry<String, JsonNode>> fields = value.fields(); | ||
311 | + while (fields.hasNext()) { | ||
312 | + Map.Entry<String, JsonNode> idOldNew = fields.next(); | ||
313 | + String uuidStr = idOldNew.getKey(); | ||
314 | + UUID uuid = UUID.uuid(uuidStr); | ||
315 | + JsonNode newR = idOldNew.getValue().get("new"); | ||
316 | + JsonNode oldR = idOldNew.getValue().get("old"); | ||
317 | + Row newRow = newR != null ? createRow(tableSchema, newR) : null; | ||
318 | + Row oldRow = oldR != null ? createRow(tableSchema, oldR) : null; | ||
319 | + RowUpdate rowUpdate = new RowUpdate(uuid, oldRow, newRow); | ||
320 | + rows.put(uuid, rowUpdate); | ||
321 | + } | ||
322 | + return TableUpdate.tableUpdate(rows); | ||
323 | + } | ||
324 | + | ||
325 | + /** | ||
326 | + * Convert Operation JsonNode into Row. | ||
327 | + * @param tableSchema TableSchema entity | ||
328 | + * @param rowNode JsonNode | ||
329 | + * @return Row | ||
330 | + */ | ||
331 | + private static Row createRow(TableSchema tableSchema, JsonNode rowNode) { | ||
332 | + List<Column> columns = Lists.newArrayList(); | ||
333 | + for (Iterator<Map.Entry<String, JsonNode>> iter = rowNode.fields(); iter | ||
334 | + .hasNext();) { | ||
335 | + Map.Entry<String, JsonNode> next = iter.next(); | ||
336 | + ColumnSchema schema = tableSchema.getColumnSchema(next.getKey()); | ||
337 | + if (schema != null) { | ||
338 | + Object o = TransValueUtil.getValueFromJson(next.getValue(), schema.type()); | ||
339 | + columns.add(new Column(schema, o)); | ||
340 | + } | ||
341 | + } | ||
342 | + return new Row(tableSchema, columns); | ||
343 | + } | ||
344 | + | ||
345 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +import io.netty.buffer.ByteBuf; | ||
19 | +import io.netty.buffer.ByteBufInputStream; | ||
20 | + | ||
21 | +import java.io.IOException; | ||
22 | +import java.util.List; | ||
23 | +import java.util.Stack; | ||
24 | + | ||
25 | +import org.onosproject.ovsdb.rfc.error.UnsupportedEncodingException; | ||
26 | +import org.onosproject.ovsdb.rfc.jsonrpc.JsonReadContext; | ||
27 | + | ||
28 | +import com.fasterxml.jackson.core.JsonEncoding; | ||
29 | +import com.fasterxml.jackson.core.JsonParseException; | ||
30 | +import com.fasterxml.jackson.core.JsonParser; | ||
31 | +import com.fasterxml.jackson.core.io.IOContext; | ||
32 | +import com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper; | ||
33 | +import com.fasterxml.jackson.core.util.BufferRecycler; | ||
34 | +import com.fasterxml.jackson.databind.JsonNode; | ||
35 | +import com.fasterxml.jackson.databind.MappingJsonFactory; | ||
36 | + | ||
37 | +/** | ||
38 | + * Decoder utility class. | ||
39 | + */ | ||
40 | +public final class JsonRpcReaderUtil { | ||
41 | + | ||
42 | + /** | ||
43 | + * Constructs a JsonRpcReaderUtil object. Utility classes should not have a | ||
44 | + * public or default constructor, otherwise IDE will compile unsuccessfully. | ||
45 | + * This class should not be instantiated. | ||
46 | + */ | ||
47 | + private JsonRpcReaderUtil() { | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Decode the bytes to Json object. | ||
52 | + * @param in input of bytes | ||
53 | + * @param out ouput of Json object list | ||
54 | + * @param jrContext context for the last decoding process | ||
55 | + * @throws IOException IOException | ||
56 | + * @throws JsonParseException JsonParseException | ||
57 | + */ | ||
58 | + public static void readToJsonNode(ByteBuf in, List<Object> out, | ||
59 | + JsonReadContext jrContext) | ||
60 | + throws JsonParseException, IOException { | ||
61 | + int lastReadBytes = jrContext.getLastReadBytes(); | ||
62 | + if (lastReadBytes == 0) { | ||
63 | + if (in.readableBytes() < 4) { | ||
64 | + return; | ||
65 | + } | ||
66 | + checkEncoding(in); | ||
67 | + } | ||
68 | + | ||
69 | + int i = lastReadBytes + in.readerIndex(); | ||
70 | + Stack<Byte> bufStack = jrContext.getBufStack(); | ||
71 | + for (; i < in.writerIndex(); i++) { | ||
72 | + byte b = in.getByte(i); | ||
73 | + switch (b) { | ||
74 | + case '{': | ||
75 | + if (!isDoubleQuote(bufStack)) { | ||
76 | + bufStack.push(b); | ||
77 | + jrContext.setStartMatch(true); | ||
78 | + } | ||
79 | + break; | ||
80 | + case '}': | ||
81 | + if (!isDoubleQuote(bufStack)) { | ||
82 | + bufStack.pop(); | ||
83 | + } | ||
84 | + break; | ||
85 | + case '"': | ||
86 | + if (in.getByte(i - 1) != '\\') { | ||
87 | + if (!bufStack.isEmpty() && bufStack.peek() != '"') { | ||
88 | + bufStack.push(b); | ||
89 | + } else { | ||
90 | + bufStack.pop(); | ||
91 | + } | ||
92 | + } | ||
93 | + break; | ||
94 | + default: | ||
95 | + break; | ||
96 | + } | ||
97 | + | ||
98 | + if (jrContext.isStartMatch() && bufStack.isEmpty()) { | ||
99 | + ByteBuf buf = in.readSlice(i - in.readerIndex() + 1); | ||
100 | + JsonParser jf = new MappingJsonFactory() | ||
101 | + .createParser(new ByteBufInputStream(buf)); | ||
102 | + JsonNode jsonNode = jf.readValueAsTree(); | ||
103 | + out.add(jsonNode); | ||
104 | + lastReadBytes = 0; | ||
105 | + jrContext.setLastReadBytes(lastReadBytes); | ||
106 | + break; | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | + if (i >= in.writerIndex()) { | ||
111 | + lastReadBytes = in.readableBytes(); | ||
112 | + jrContext.setLastReadBytes(lastReadBytes); | ||
113 | + } | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * Filter the invalid characters before decoding. | ||
118 | + * @param in input of bytes | ||
119 | + * @param lastReadBytes the bytes for last decoding incomplete record | ||
120 | + */ | ||
121 | + private static void fliterCharaters(ByteBuf in) { | ||
122 | + while (in.isReadable()) { | ||
123 | + int ch = in.getByte(in.readerIndex()); | ||
124 | + if ((ch != ' ') && (ch != '\n') && (ch != '\t') && (ch != '\r')) { | ||
125 | + break; | ||
126 | + } else { | ||
127 | + in.readByte(); | ||
128 | + } | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + /** | ||
133 | + * Check whether the peek of the stack element is double quote. | ||
134 | + * @param jrContext context for the last decoding process | ||
135 | + * @return boolean | ||
136 | + */ | ||
137 | + private static boolean isDoubleQuote(Stack<Byte> bufStack) { | ||
138 | + if (!bufStack.isEmpty() && bufStack.peek() == '"') { | ||
139 | + return true; | ||
140 | + } | ||
141 | + return false; | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * Check whether the encoding is valid. | ||
146 | + * @param in input of bytes | ||
147 | + * @throws IOException this is an IO exception | ||
148 | + * @throws UnsupportedEncodingException this is an unsupported encode | ||
149 | + * exception | ||
150 | + */ | ||
151 | + private static void checkEncoding(ByteBuf in) throws IOException { | ||
152 | + int inputStart = 0; | ||
153 | + int inputLength = 4; | ||
154 | + fliterCharaters(in); | ||
155 | + byte[] buff = new byte[4]; | ||
156 | + in.getBytes(in.readerIndex(), buff); | ||
157 | + ByteSourceJsonBootstrapper strapper = new ByteSourceJsonBootstrapper( | ||
158 | + new IOContext( | ||
159 | + new BufferRecycler(), | ||
160 | + null, | ||
161 | + false), | ||
162 | + buff, | ||
163 | + inputStart, | ||
164 | + inputLength); | ||
165 | + JsonEncoding jsonEncoding = strapper.detectEncoding(); | ||
166 | + if (!JsonEncoding.UTF8.equals(jsonEncoding)) { | ||
167 | + throw new UnsupportedEncodingException( | ||
168 | + "Only UTF-8 encoding is supported."); | ||
169 | + } | ||
170 | + } | ||
171 | + | ||
172 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +import org.onosproject.ovsdb.rfc.jsonrpc.JsonRpcRequest; | ||
21 | +import org.onosproject.ovsdb.rfc.operations.Operation; | ||
22 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
23 | + | ||
24 | +/** | ||
25 | + * RPC Methods request utility class. Refer to RFC7047's Section 4.1. | ||
26 | + */ | ||
27 | +public final class JsonRpcWriterUtil { | ||
28 | + | ||
29 | + /** | ||
30 | + * Constructs a JsonRpcWriterUtil object. Utility classes should not have a | ||
31 | + * public or default constructor, otherwise IDE will compile unsuccessfully. | ||
32 | + * This class should not be instantiated. | ||
33 | + */ | ||
34 | + private JsonRpcWriterUtil() { | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Returns string of RPC request. | ||
39 | + * @param uuid id of request object | ||
40 | + * @param methodName method of request object | ||
41 | + * @param params params of request object | ||
42 | + * @return RPC Request String | ||
43 | + */ | ||
44 | + private static String getRequestStr(String uuid, String methodName, | ||
45 | + List params) { | ||
46 | + JsonRpcRequest request; | ||
47 | + if (params != null) { | ||
48 | + request = new JsonRpcRequest(uuid, methodName, params); | ||
49 | + } else { | ||
50 | + request = new JsonRpcRequest(uuid, methodName); | ||
51 | + } | ||
52 | + String str = ObjectMapperUtil.convertToString(request); | ||
53 | + return str; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns string of get_schema request. | ||
58 | + * @param uuid id of get_schema request | ||
59 | + * @param dbnames params of get_schema request | ||
60 | + * @return get_schema Request String | ||
61 | + */ | ||
62 | + public static String getSchemaStr(String uuid, List<String> dbnames) { | ||
63 | + String methodName = "get_schema"; | ||
64 | + return getRequestStr(uuid, methodName, dbnames); | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Returns string of echo request. | ||
69 | + * @param uuid id of echo request | ||
70 | + * @return echo Request String | ||
71 | + */ | ||
72 | + public static String echoStr(String uuid) { | ||
73 | + String methodName = "echo"; | ||
74 | + return getRequestStr(uuid, methodName, null); | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Returns string of monitor request. | ||
79 | + * @param uuid id of monitor request | ||
80 | + * @param monotorId json-value in params of monitor request | ||
81 | + * @param dbSchema DatabaseSchema entity | ||
82 | + * @return monitor Request String | ||
83 | + */ | ||
84 | + public static String monitorStr(String uuid, String monotorId, | ||
85 | + DatabaseSchema dbSchema) { | ||
86 | + String methodName = "monitor"; | ||
87 | + return getRequestStr(uuid, methodName, | ||
88 | + ParamUtil.getMonitorParams(monotorId, dbSchema)); | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * Returns string of list_dbs request. | ||
93 | + * @param uuid id of list_dbs request | ||
94 | + * @return list_dbs Request String | ||
95 | + */ | ||
96 | + public static String listDbsStr(String uuid) { | ||
97 | + String methodName = "list_dbs"; | ||
98 | + return getRequestStr(uuid, methodName, null); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * Returns string of transact request. | ||
103 | + * @param uuid id of transact request | ||
104 | + * @param dbSchema DatabaseSchema entity | ||
105 | + * @param operations operation* in params of transact request | ||
106 | + * @return transact Request String | ||
107 | + */ | ||
108 | + public static String transactStr(String uuid, DatabaseSchema dbSchema, | ||
109 | + List<Operation> operations) { | ||
110 | + String methodName = "transact"; | ||
111 | + return getRequestStr(uuid, methodName, | ||
112 | + ParamUtil.getTransactParams(dbSchema, operations)); | ||
113 | + } | ||
114 | +} |
1 | +package org.onosproject.ovsdb.rfc.utils; | ||
2 | + | ||
3 | +import org.onosproject.ovsdb.rfc.notation.Mutation; | ||
4 | +import org.onosproject.ovsdb.rfc.notation.Mutation.Mutator; | ||
5 | + | ||
6 | +public final class MutationUtil { | ||
7 | + | ||
8 | + /** | ||
9 | + * Constructs a MutationUtil object. Utility classes should not have a | ||
10 | + * public or default constructor, otherwise IDE will compile unsuccessfully. This | ||
11 | + * class should not be instantiated. | ||
12 | + */ | ||
13 | + private MutationUtil() { | ||
14 | + } | ||
15 | + | ||
16 | + /** | ||
17 | + * Returns a Mutation that means += . | ||
18 | + * @param columnName column name | ||
19 | + * @param data column value | ||
20 | + * @return Mutation | ||
21 | + */ | ||
22 | + public static Mutation sum(String columnName, Object data) { | ||
23 | + Object value = TransValueUtil.getFormatData(data); | ||
24 | + return new Mutation(columnName, Mutator.SUM, value); | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * Returns a Mutation that means -= . | ||
29 | + * @param columnName column name | ||
30 | + * @param data column value | ||
31 | + * @return Mutation | ||
32 | + */ | ||
33 | + public static Mutation difference(String columnName, Object data) { | ||
34 | + Object value = TransValueUtil.getFormatData(data); | ||
35 | + return new Mutation(columnName, Mutator.DIFFERENCE, value); | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * Returns a Mutation that means *= . | ||
40 | + * @param columnName column name | ||
41 | + * @param data column value | ||
42 | + * @return Mutation | ||
43 | + */ | ||
44 | + public static Mutation product(String columnName, Object data) { | ||
45 | + Object value = TransValueUtil.getFormatData(data); | ||
46 | + return new Mutation(columnName, Mutator.PRODUCT, value); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Returns a Mutation that means /= . | ||
51 | + * @param columnName column name | ||
52 | + * @param data column value | ||
53 | + * @return Mutation | ||
54 | + */ | ||
55 | + public static Mutation quotient(String columnName, Object data) { | ||
56 | + Object value = TransValueUtil.getFormatData(data); | ||
57 | + return new Mutation(columnName, Mutator.QUOTIENT, value); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Returns a Mutation that means %= . | ||
62 | + * @param columnName column name | ||
63 | + * @param data column value | ||
64 | + * @return Mutation | ||
65 | + */ | ||
66 | + public static Mutation remainder(String columnName, Object data) { | ||
67 | + Object value = TransValueUtil.getFormatData(data); | ||
68 | + return new Mutation(columnName, Mutator.REMAINDER, value); | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Returns a Mutation that means insert . | ||
73 | + * @param columnName column name | ||
74 | + * @param data column value | ||
75 | + * @return Mutation | ||
76 | + */ | ||
77 | + public static Mutation insert(String columnName, Object data) { | ||
78 | + Object value = TransValueUtil.getFormatData(data); | ||
79 | + return new Mutation(columnName, Mutator.INSERT, value); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Returns a Mutation that means delete . | ||
84 | + * @param columnName column name | ||
85 | + * @param data column value | ||
86 | + * @return Mutation | ||
87 | + */ | ||
88 | + public static Mutation delete(String columnName, Object data) { | ||
89 | + Object value = TransValueUtil.getFormatData(data); | ||
90 | + return new Mutation(columnName, Mutator.DELETE, value); | ||
91 | + } | ||
92 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +import java.util.List; | ||
19 | +import java.util.Set; | ||
20 | + | ||
21 | +import org.onosproject.ovsdb.rfc.message.MonitorRequest; | ||
22 | +import org.onosproject.ovsdb.rfc.message.MonitorSelect; | ||
23 | +import org.onosproject.ovsdb.rfc.operations.Operation; | ||
24 | +import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | ||
25 | +import org.onosproject.ovsdb.rfc.schema.TableSchema; | ||
26 | + | ||
27 | +import com.google.common.base.Function; | ||
28 | +import com.google.common.collect.ImmutableMap; | ||
29 | +import com.google.common.collect.Lists; | ||
30 | +import com.google.common.collect.Maps; | ||
31 | + | ||
32 | +/** | ||
33 | + * Params utility class. Params of the request object, refer to RFC7047's Section | ||
34 | + * 4.1. | ||
35 | + */ | ||
36 | +public final class ParamUtil { | ||
37 | + | ||
38 | + /** | ||
39 | + * Constructs a ParamUtil object. Utility classes should not have a | ||
40 | + * public or default constructor, otherwise IDE will compile unsuccessfully. This | ||
41 | + * class should not be instantiated. | ||
42 | + */ | ||
43 | + private ParamUtil() { | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Returns MonitorRequest, refer to RFC7047's Section 4.1.5. | ||
48 | + * @param tableSchema entity | ||
49 | + * @return MonitorRequest | ||
50 | + */ | ||
51 | + private static MonitorRequest getAllColumnsMonitorRequest(TableSchema tableSchema) { | ||
52 | + String tableName = tableSchema.name(); | ||
53 | + Set<String> columns = tableSchema.getColumnNames(); | ||
54 | + MonitorSelect select = new MonitorSelect(true, true, true, true); | ||
55 | + MonitorRequest monitorRequest = new MonitorRequest(tableName, columns, | ||
56 | + select); | ||
57 | + return monitorRequest; | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Returns params of monitor method, refer to RFC7047's Section 4.1.5. | ||
62 | + * @param monotorId json-value, refer to RFC7047's Section 4.1.5. | ||
63 | + * @param dbSchema DatabaseSchema entity | ||
64 | + * @return List of Object, the params of monitor request | ||
65 | + */ | ||
66 | + public static List<Object> getMonitorParams(String monotorId, | ||
67 | + DatabaseSchema dbSchema) { | ||
68 | + Set<String> tables = dbSchema.getTableNames(); | ||
69 | + List<MonitorRequest> monitorRequests = Lists.newArrayList(); | ||
70 | + for (String tableName : tables) { | ||
71 | + TableSchema tableSchema = dbSchema.getTableSchema(tableName); | ||
72 | + monitorRequests.add(getAllColumnsMonitorRequest(tableSchema)); | ||
73 | + } | ||
74 | + ImmutableMap<String, MonitorRequest> reqMap = Maps | ||
75 | + .uniqueIndex(monitorRequests, | ||
76 | + new Function<MonitorRequest, String>() { | ||
77 | + @Override | ||
78 | + public String apply(MonitorRequest input) { | ||
79 | + return input.getTableName(); | ||
80 | + } | ||
81 | + }); | ||
82 | + return Lists.<Object>newArrayList(dbSchema.name(), monotorId, | ||
83 | + reqMap); | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * Returns params of transact method, refer to RFC7047's Section 4.1.3. | ||
88 | + * @param dbSchema DatabaseSchema entity | ||
89 | + * @param operations operation*, refer to RFC7047's Section 4.1.3. | ||
90 | + * @return List of Object, the params of transact request | ||
91 | + */ | ||
92 | + public static List<Object> getTransactParams(DatabaseSchema dbSchema, | ||
93 | + List<Operation> operations) { | ||
94 | + List<Object> lists = Lists.newArrayList((Object) dbSchema.name()); | ||
95 | + lists.addAll(operations); | ||
96 | + return lists; | ||
97 | + } | ||
98 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +import io.netty.handler.codec.string.StringEncoder; | ||
19 | +import io.netty.util.CharsetUtil; | ||
20 | + | ||
21 | +/** | ||
22 | + * StringEncoder utility class.Only UTF-8 encoding is supported refer to | ||
23 | + * RFC7047's Section 3.1. | ||
24 | + */ | ||
25 | +public final class StringEncoderUtil { | ||
26 | + | ||
27 | + /** | ||
28 | + * Constructs a StringEncoderUtil object. Utility classes should not have a | ||
29 | + * public or default constructor, otherwise IDE will compile unsuccessfully. This | ||
30 | + * class should not be instantiated. | ||
31 | + */ | ||
32 | + private StringEncoderUtil() { | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Returns StringEncoder of UTF_8 . | ||
37 | + * @return StringEncoder | ||
38 | + */ | ||
39 | + public static StringEncoder getEncoder() { | ||
40 | + return new StringEncoder(CharsetUtil.UTF_8); | ||
41 | + } | ||
42 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.ovsdb.rfc.utils; | ||
17 | + | ||
18 | +/** | ||
19 | + * Version utility class. | ||
20 | + */ | ||
21 | +public final class VersionUtil { | ||
22 | + | ||
23 | + /** | ||
24 | + * Constructs a VersionUtil object. Utility classes should not have a public | ||
25 | + * or default constructor, otherwise IDE will compile unsuccessfully. This | ||
26 | + * class should not be instantiated. | ||
27 | + */ | ||
28 | + private VersionUtil() { | ||
29 | + } | ||
30 | + | ||
31 | + public static final String DEFAULT_VERSION_STRING = "0.0.0"; | ||
32 | + private static final String FORMAT = "(\\d+)\\.(\\d+)\\.(\\d+)"; | ||
33 | + | ||
34 | + /** | ||
35 | + * Match version by the format. | ||
36 | + * @param version the version String | ||
37 | + * @throws IllegalArgumentException this is an illegal argument exception | ||
38 | + */ | ||
39 | + public static void versionMatch(String version) { | ||
40 | + if (!version.matches(FORMAT)) { | ||
41 | + throw new IllegalArgumentException("<" + version | ||
42 | + + "> does not match format " + FORMAT); | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Compare fromVersion and toVersion. | ||
48 | + * @param fromVersion the initial version | ||
49 | + * @param toVersion the end of the version | ||
50 | + * @return a long number | ||
51 | + */ | ||
52 | + public static long versionCompare(String fromVersion, String toVersion) { | ||
53 | + Long fromNum = Long.parseLong(fromVersion.replace(".", "")); | ||
54 | + Long toNum = Long.parseLong(toVersion.replace(".", "")); | ||
55 | + return (fromNum - toNum); | ||
56 | + } | ||
57 | +} |
-
Please register or login to post a comment