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 java.util.concurrent.ExecutionException;
14 import org.opendaylight.ovsdb.lib.OvsDBClientImpl;
15 import org.opendaylight.ovsdb.lib.OvsdbTestBase;
16 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
17 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
18 import org.opendaylight.ovsdb.lib.schema.TableSchema;
21 public class SchemaObjs {
22 public static class Bridge extends TableSchema<Bridge> {
23 public static String NAME = "Bridge";
26 ColumnSchema<Bridge, String> name;
27 ColumnSchema<Bridge, Boolean> flood_vlans;
30 public Bridge(TableSchema<Bridge> target) {
32 name = target.column("name", String.class);
33 flood_vlans = target.column("statistics", Boolean.class);
38 public static class Port extends TableSchema<Port> {
39 public static String NAME = "Port";
42 ColumnSchema<Port, String> name;
43 ColumnSchema<Port, String> statistics;
45 public Port(TableSchema<Port> target) {
47 name = target.column("name", String.class);
48 statistics = target.column("statistics", String.class);
53 public static void main(String[] args) throws ExecutionException, InterruptedException {
55 OvsDBClientImpl ovs = new OvsDBClientImpl(null, null);
56 DatabaseSchema db = ovs.getSchema(OvsdbTestBase.OPEN_VSWITCH_SCHEMA, true).get();
57 Bridge bridge = db.table(Bridge.NAME, Bridge.class);
58 Port port = db.table(Port.NAME, Port.class);
62 .value(bridge.flood_vlans, true)
63 .value(bridge.name, "br-int"))
65 .value(port.statistics, "stats")
66 //.value(port.statistics, 2) ## will not type check as stats is a string
67 .value(port.name, "newport")
71 //todo untyped version