2 * Copyright (C) 2014 EBay Software Foundation
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 * Authors : Ashwin Raveendran
10 package org.opendaylight.ovsdb.lib.schema.temp;
12 import org.opendaylight.ovsdb.lib.OvsDBClient;
13 import org.opendaylight.ovsdb.lib.OvsDBClientImpl;
14 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
15 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
16 import org.opendaylight.ovsdb.lib.schema.TableSchema;
18 import java.util.concurrent.ExecutionException;
21 public class SchemaObjs {
23 public static class Bridge extends TableSchema<Bridge> {
24 public static String NAME = "Bridge";
27 ColumnSchema<Bridge, String> name;
28 ColumnSchema<Bridge, Boolean> flood_vlans;
31 public Bridge(TableSchema<Bridge> target) {
33 name = target.column("name", String.class);
34 flood_vlans = target.column("statistics", Boolean.class);
39 public static class Port extends TableSchema<Port> {
40 public static String NAME = "Port";
43 ColumnSchema<Port, String> name;
44 ColumnSchema<Port, String> statistics;
46 public Port(TableSchema<Port> target) {
48 name = target.column("name", String.class);
49 statistics = target.column("statistics", String.class);
54 public static void main(String[] args) throws ExecutionException, InterruptedException {
56 OvsDBClientImpl ovs = new OvsDBClientImpl(null, null);
57 DatabaseSchema db = ovs.getSchema(OvsDBClient.OPEN_VSWITCH_SCHEMA, true).get();
58 Bridge bridge = db.table(Bridge.NAME, Bridge.class);
59 Port port = db.table(Port.NAME, Port.class);
63 .value(bridge.flood_vlans, true)
64 .value(bridge.name, "br-int"))
66 .value(port.statistics, "stats")
67 //.value(port.statistics, 2) ## will not type check as stats is a string
68 .value(port.name, "newport")
72 //todo untyped version