当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseSchema.getTableSchema方法代码示例

本文整理汇总了Java中org.onosproject.ovsdb.rfc.schema.DatabaseSchema.getTableSchema方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseSchema.getTableSchema方法的具体用法?Java DatabaseSchema.getTableSchema怎么用?Java DatabaseSchema.getTableSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.ovsdb.rfc.schema.DatabaseSchema的用法示例。


在下文中一共展示了DatabaseSchema.getTableSchema方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateConfig

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
/**
 * Update transact config.
 *
 * @param tableName  table name
 * @param columnName column name
 * @param uuid       uuid
 * @param row        the config data
 */
private void updateConfig(String tableName, String columnName, String uuid,
                          Row row) {
    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
    TableSchema tableSchema = dbSchema.getTableSchema(tableName);

    List<Condition> conditions = Lists.newArrayList();
    Condition condition = ConditionUtil.isEqual(columnName, Uuid.uuid(uuid));
    conditions.add(condition);

    Update update = new Update(tableSchema, row, conditions);

    ArrayList<Operation> operations = Lists.newArrayList();
    operations.add(update);

    transactConfig(OvsdbConstant.DATABASENAME, operations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DefaultOvsdbClient.java

示例2: handlePortInsertTable

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
/**
 * Handles port insert.
 *
 * @param tableName ovsdb table interface
 * @param portRow   row of port
 * @return insert, empty if null
 */
private Insert handlePortInsertTable(String tableName, Row portRow) {
    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);

    TableSchema portTableSchema = dbSchema
            .getTableSchema(OvsdbConstant.PORT);
    ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");

    String portName = (String) portRow.getColumn(portColumnSchema.name()).data();

    Interface inf = (Interface) TableGenerator
            .createTable(dbSchema, OvsdbTable.INTERFACE);

    inf.setName(portName);

    TableSchema intfTableSchema = dbSchema
            .getTableSchema(OvsdbConstant.INTERFACE);
    Insert insert = new Insert(intfTableSchema, OvsdbConstant.INTERFACE,
                               inf.getRow());
    return insert;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:DefaultOvsdbClient.java

示例3: createQueue

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
@Override
public boolean createQueue(OvsdbQueue ovsdbQueue) {
    DatabaseSchema dbSchema = schema.get(DATABASENAME);
    Queue queue = (Queue) TableGenerator.createTable(dbSchema, OvsdbTable.QUEUE);
    ArrayList<Operation> operations = Lists.newArrayList();
    OvsdbRowStore rowStore = getRowStore(DATABASENAME, QUEUE);
    if (rowStore == null) {
        log.debug("The queue uuid is null");
        return false;
    }

    if (ovsdbQueue.dscp().isPresent()) {
        queue.setDscp(ImmutableSet.of(ovsdbQueue.dscp().get()));
    }
    queue.setOtherConfig(ovsdbQueue.otherConfigs());
    queue.setExternalIds(ovsdbQueue.externalIds());
    Insert queueInsert = new Insert(dbSchema.getTableSchema(QUEUE), QUEUE, queue.getRow());
    operations.add(queueInsert);

    try {
        transactConfig(DATABASENAME, operations).get();
    } catch (InterruptedException | ExecutionException e) {
        log.error("createQueue transactConfig get exception !");
    }
    return true;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:DefaultOvsdbClient.java

示例4: updateConfig

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
/**
 * Update transact config.
 *
 * @param tableName  table name
 * @param columnName column name
 * @param uuid       uuid
 * @param row        the config data
 */
private void updateConfig(String tableName, String columnName, String uuid,
                          Row row) {
    DatabaseSchema dbSchema = schema.get(DATABASENAME);
    TableSchema tableSchema = dbSchema.getTableSchema(tableName);

    List<Condition> conditions = Lists.newArrayList();
    Condition condition = ConditionUtil.isEqual(columnName, Uuid.uuid(uuid));
    conditions.add(condition);

    Update update = new Update(tableSchema, row, conditions);

    ArrayList<Operation> operations = Lists.newArrayList();
    operations.add(update);

    transactConfig(DATABASENAME, operations);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:25,代码来源:DefaultOvsdbClient.java

示例5: getMonitorParams

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
/**
 * Returns params of monitor method, refer to RFC7047's Section 4.1.5.
 * @param monotorId json-value, refer to RFC7047's Section 4.1.5.
 * @param dbSchema DatabaseSchema entity
 * @return List of Object, the params of monitor request
 */
public static List<Object> getMonitorParams(String monotorId, DatabaseSchema dbSchema) {
    Set<String> tables = dbSchema.getTableNames();
    Map<String, MonitorRequest> mrMap = Maps.newHashMap();
    for (String tableName : tables) {
        TableSchema tableSchema = dbSchema.getTableSchema(tableName);
        MonitorRequest monitorRequest = getAllColumnsMonitorRequest(tableSchema);
        mrMap.put(tableName, monitorRequest);
    }
    return Lists.newArrayList(dbSchema.name(), monotorId, mrMap);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:ParamUtil.java

示例6: jsonNodeToTableUpdates

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
/**
 * convert the params of Update Notification into TableUpdates.
 * @param updatesJson the params of Update Notification
 * @param dbSchema DatabaseSchema entity
 * @return TableUpdates
 */
public static TableUpdates jsonNodeToTableUpdates(JsonNode updatesJson, DatabaseSchema dbSchema) {
    Map<String, TableUpdate> tableUpdateMap = Maps.newHashMap();
    Iterator<Map.Entry<String, JsonNode>> tableUpdatesItr = updatesJson.fields();
    while (tableUpdatesItr.hasNext()) {
        Map.Entry<String, JsonNode> entry = tableUpdatesItr.next();
        TableSchema tableSchema = dbSchema.getTableSchema(entry.getKey());
        TableUpdate tableUpdate = jsonNodeToTableUpdate(tableSchema, entry.getValue());
        tableUpdateMap.put(entry.getKey(), tableUpdate);
    }
    return TableUpdates.tableUpdates(tableUpdateMap);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:FromJsonUtil.java

示例7: removeQos

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
@Override
public void removeQos(PortNumber portNumber) {
    DatabaseSchema dbSchema = schema.get(DATABASENAME);
    OvsdbRowStore rowStore = getRowStore(DATABASENAME, PORT);
    if (rowStore == null) {
        log.debug("The qos uuid is null");
        return;
    }

    ConcurrentMap<String, Row> ovsTableRows = rowStore.getRowStore();
    Row portRow = ovsTableRows.values().stream()
            .filter(r -> r.getColumn("name").data().equals(portNumber.name()))
            .findFirst().orElse(null);
    if (portRow == null) {
        log.warn("Couldn't find port {} in ovsdb port table.", portNumber.name());
        return;
    }

    OvsdbSet ovsdbSet = ((OvsdbSet) portRow.getColumn(PORT_QOS).data());
    @SuppressWarnings("unchecked")
    Set<Uuid> qosIdSet = ovsdbSet.set();
    if (qosIdSet == null || qosIdSet.isEmpty()) {
        return;
    }
    Uuid qosUuid = (Uuid) qosIdSet.toArray()[0];
    Condition condition = ConditionUtil.isEqual(UUID, portRow.uuid());
    List<Condition> conditions = Lists.newArrayList(condition);
    Mutation mutation = MutationUtil.delete(PORT_QOS, qosUuid);
    List<Mutation> mutations = Lists.newArrayList(mutation);

    ArrayList<Operation> operations = Lists.newArrayList();
    Mutate mutate = new Mutate(dbSchema.getTableSchema(PORT), conditions, mutations);
    operations.add(mutate);
    transactConfig(DATABASENAME, operations);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:36,代码来源:DefaultOvsdbClient.java

示例8: handlePortInsertTable

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
/**
 * Handles port insert.
 *
 * @param portRow   row of port
 * @return insert, empty if null
 */
private Insert handlePortInsertTable(Row portRow) {
    DatabaseSchema dbSchema = schema.get(DATABASENAME);

    TableSchema portTableSchema = dbSchema.getTableSchema(PORT);
    ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");

    String portName = (String) portRow.getColumn(portColumnSchema.name()).data();
    Interface inf = (Interface) TableGenerator.createTable(dbSchema, OvsdbTable.INTERFACE);
    inf.setName(portName);

    TableSchema intfTableSchema = dbSchema.getTableSchema(INTERFACE);
    return new Insert(intfTableSchema, INTERFACE, inf.getRow());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:20,代码来源:DefaultOvsdbClient.java

示例9: createTunnel

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
@Override
public boolean createTunnel(String bridgeName, String portName, String tunnelType, Map<String, String> options) {

    String bridgeUuid  = getBridgeUuid(bridgeName);
    if (bridgeUuid == null) {
        log.warn("Couldn't find bridge {} in {}", bridgeName, nodeId.getIpAddress());
        return false;
    }

    if (getPortUuid(portName, bridgeUuid) != null) {
        log.warn("Port {} already exists", portName);
        // remove existing one and re-create?
        return false;
    }

    ArrayList<Operation> operations = Lists.newArrayList();
    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);

    // insert a new port to the port table
    Port port = (Port) TableGenerator.createTable(dbSchema, OvsdbTable.PORT);
    port.setName(portName);
    Insert portInsert = new Insert(dbSchema.getTableSchema("Port"), "Port", port.getRow());
    portInsert.getRow().put("interfaces", Uuid.uuid("Interface"));
    operations.add(portInsert);

    // update the bridge table
    Condition condition = ConditionUtil.isEqual("_uuid", Uuid.uuid(bridgeUuid));
    Mutation mutation = MutationUtil.insert("ports", Uuid.uuid("Port"));
    List<Condition> conditions = new ArrayList<>(Arrays.asList(condition));
    List<Mutation> mutations = new ArrayList<>(Arrays.asList(mutation));
    operations.add(new Mutate(dbSchema.getTableSchema("Bridge"), conditions, mutations));

    // insert a tunnel interface
    Interface intf = (Interface) TableGenerator.createTable(dbSchema, OvsdbTable.INTERFACE);
    intf.setName(portName);
    intf.setType(tunnelType);
    intf.setOptions(options);
    Insert intfInsert = new Insert(dbSchema.getTableSchema("Interface"), "Interface", intf.getRow());
    operations.add(intfInsert);

    transactConfig(OvsdbConstant.DATABASENAME, operations);
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:DefaultOvsdbClient.java

示例10: createQos

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
@Override
public boolean createQos(OvsdbQos ovsdbQos) {
    DatabaseSchema dbSchema = schema.get(DATABASENAME);
    Qos qos = (Qos) TableGenerator.createTable(dbSchema, OvsdbTable.QOS);
    OvsdbRowStore rowStore = getRowStore(DATABASENAME, QOS);
    if (rowStore == null) {
        log.debug("The qos uuid is null");
        return false;
    }

    ArrayList<Operation> operations = Lists.newArrayList();
    Set<String> types = Sets.newHashSet();
    Map<Long, Uuid> queues = Maps.newHashMap();

    types.add(ovsdbQos.qosType());
    qos.setOtherConfig(ovsdbQos.otherConfigs());
    qos.setExternalIds(ovsdbQos.externalIds());
    qos.setType(types);
    if (ovsdbQos.qosQueues().isPresent()) {
        for (Map.Entry<Long, String> entry : ovsdbQos.qosQueues().get().entrySet()) {
            OvsdbRowStore queueRowStore = getRowStore(DATABASENAME, QUEUE);
            if (queueRowStore != null) {
                ConcurrentMap<String, Row> queueTableRows = queueRowStore.getRowStore();
                Row queueRow = queueTableRows.values().stream().filter(r -> {
                    OvsdbMap ovsdbMap = (OvsdbMap) (r.getColumn(EXTERNAL_ID).data());
                    return entry.getValue().equals(ovsdbMap.map().get(QUEUE_EXTERNAL_ID_KEY));
                }).findFirst().orElse(null);
                if (queueRow != null) {
                    queues.put(entry.getKey(), queueRow.uuid());
                }
            }
        }
        qos.setQueues(queues);
    }

    Insert qosInsert = new Insert(dbSchema.getTableSchema(QOS), QOS, qos.getRow());
    operations.add(qosInsert);
    try {
        transactConfig(DATABASENAME, operations).get();
    } catch (InterruptedException | ExecutionException e) {
        return false;
    }
    return true;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:45,代码来源:DefaultOvsdbClient.java

示例11: unbindQueues

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void unbindQueues(QosId qosId, List<Long> queueKeys) {
    DatabaseSchema dbSchema = schema.get(DATABASENAME);
    OvsdbRowStore qosRowStore = getRowStore(DATABASENAME, QOS);
    if (qosRowStore == null) {
        return;
    }

    ConcurrentMap<String, Row> qosTableRows = qosRowStore.getRowStore();

    Row qosRow = qosTableRows.values().stream().filter(r -> {
        OvsdbMap ovsdbMap = (OvsdbMap) (r.getColumn(EXTERNAL_ID).data());
        return qosId.name().equals(ovsdbMap.map().get(QOS_EXTERNAL_ID_KEY));
    }).findFirst().orElse(null);

    if (qosRow == null) {
        log.warn("Can't find QoS {}", qosId);
        return;
    }

    Map<Long, Uuid> deleteQueuesMap = new HashMap<>();
    Map<Integer, Uuid> queuesMap = ((OvsdbMap) qosRow.getColumn(QUEUES).data()).map();

    queueKeys.forEach(key -> {
        if (queuesMap.containsKey(key.intValue())) {
            deleteQueuesMap.put(key, queuesMap.get(key.intValue()));
        }
    });

    if (deleteQueuesMap.size() != 0) {
        TableSchema parentTableSchema = dbSchema
                .getTableSchema(QOS);
        ColumnSchema parentColumnSchema = parentTableSchema
                .getColumnSchema(QUEUES);

        Mutation mutation = MutationUtil.delete(parentColumnSchema.name(), OvsdbMap.ovsdbMap(deleteQueuesMap));
        List<Mutation> mutations = Collections.singletonList(mutation);

        Condition condition = ConditionUtil.isEqual(UUID, qosRow.uuid());
        List<Condition> conditionList = Collections.singletonList(condition);
        List<Operation> operations = Collections.singletonList(
                new Mutate(parentTableSchema, conditionList, mutations));

        transactConfig(DATABASENAME, operations);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:48,代码来源:DefaultOvsdbClient.java

示例12: createInterface

import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; //导入方法依赖的package包/类
@Override
public boolean createInterface(String bridgeName, OvsdbInterface ovsdbIface) {
    String bridgeUuid  = getBridgeUuid(bridgeName);
    if (bridgeUuid == null) {
        log.warn("Couldn't find bridge {} in {}", bridgeName, nodeId.getIpAddress());
        return false;
    }

    if (getPortUuid(ovsdbIface.name(), bridgeUuid) != null) {
        log.warn("Interface {} already exists", ovsdbIface.name());
        // remove existing one and re-create?
        return false;
    }

    ArrayList<Operation> operations = Lists.newArrayList();
    DatabaseSchema dbSchema = schema.get(DATABASENAME);

    // insert a new port with the interface name
    Port port = (Port) TableGenerator.createTable(dbSchema, OvsdbTable.PORT);
    port.setName(ovsdbIface.name());
    Insert portInsert = new Insert(dbSchema.getTableSchema(PORT), PORT, port.getRow());
    portInsert.getRow().put(INTERFACES, Uuid.uuid(INTERFACE));
    operations.add(portInsert);

    // update the bridge table with the new port
    Condition condition = ConditionUtil.isEqual(UUID, Uuid.uuid(bridgeUuid));
    Mutation mutation = MutationUtil.insert(PORTS, Uuid.uuid(PORT));
    List<Condition> conditions = Lists.newArrayList(condition);
    List<Mutation> mutations = Lists.newArrayList(mutation);
    operations.add(new Mutate(dbSchema.getTableSchema(BRIDGE), conditions, mutations));

    // insert an interface
    Interface intf = (Interface) TableGenerator.createTable(dbSchema, OvsdbTable.INTERFACE);
    intf.setName(ovsdbIface.name());

    intf.setType(ovsdbIface.typeToString());

    if (ovsdbIface.mtu().isPresent()) {
        Set<Long> mtuSet = Sets.newConcurrentHashSet();
        mtuSet.add(ovsdbIface.mtu().get());
        intf.setMtu(mtuSet);
        intf.setMtuRequest(mtuSet);
    }

    intf.setOptions(ovsdbIface.options());
    Insert intfInsert = new Insert(dbSchema.getTableSchema(INTERFACE), INTERFACE, intf.getRow());
    operations.add(intfInsert);

    transactConfig(DATABASENAME, operations);
    log.info("Created interface {}", ovsdbIface);
    return true;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:53,代码来源:DefaultOvsdbClient.java


注:本文中的org.onosproject.ovsdb.rfc.schema.DatabaseSchema.getTableSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。