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


Java Interface.setName方法代码示例

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


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

示例1: handlePortInsertTable

import org.onosproject.ovsdb.rfc.table.Interface; //导入方法依赖的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

示例2: handlePortInsertTable

import org.onosproject.ovsdb.rfc.table.Interface; //导入方法依赖的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

示例3: createTunnel

import org.onosproject.ovsdb.rfc.table.Interface; //导入方法依赖的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

示例4: createInterface

import org.onosproject.ovsdb.rfc.table.Interface; //导入方法依赖的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.table.Interface.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。