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


Java Port.setName方法代码示例

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


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

示例1: createPort

import org.onosproject.ovsdb.rfc.table.Port; //导入方法依赖的package包/类
@Override
public void createPort(String bridgeName, String portName) {
    String bridgeUuid = getBridgeUuid(bridgeName);
    if (bridgeUuid == null) {
        log.error("Can't find bridge {} in {}", bridgeName,
                  nodeId.getIpAddress());
        return;
    }

    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
    String portUuid = getPortUuid(portName, bridgeUuid);

    Port port = (Port) TableGenerator
            .createTable(dbSchema, OvsdbTable.PORT);

    port.setName(portName);
    if (portUuid == null) {
        insertConfig(OvsdbConstant.PORT, "_uuid", OvsdbConstant.BRIDGE,
                     "ports", bridgeUuid, port.getRow());
    } else {
        updateConfig(OvsdbConstant.PORT, "_uuid", portUuid, port.getRow());
    }

    return;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:DefaultOvsdbClient.java

示例2: createPort

import org.onosproject.ovsdb.rfc.table.Port; //导入方法依赖的package包/类
@Override
public void createPort(String bridgeName, String portName) {
    String bridgeUuid = getBridgeUuid(bridgeName);
    if (bridgeUuid == null) {
        log.error("Can't find bridge {} in {}", bridgeName, nodeId.getIpAddress());
        return;
    }

    DatabaseSchema dbSchema = schema.get(DATABASENAME);
    String portUuid = getPortUuid(portName, bridgeUuid);
    Port port = (Port) TableGenerator.createTable(dbSchema, OvsdbTable.PORT);
    port.setName(portName);
    if (portUuid == null) {
        insertConfig(PORT, UUID, BRIDGE, PORTS, bridgeUuid, port.getRow());
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:DefaultOvsdbClient.java

示例3: createBridge

import org.onosproject.ovsdb.rfc.table.Port; //导入方法依赖的package包/类
@Override
public void createBridge(String bridgeName) {
    log.debug("create bridge {}", bridgeName);

    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
    if (dbSchema == null) {
        log.warn("The schema is null");
        return;
    }

    Bridge bridge = (Bridge) TableGenerator.createTable(dbSchema,
                                                        OvsdbTable.BRIDGE);
    if (bridge == null) {
        log.debug("Can not create bridge");
        return;
    }

    Set<String> failModes = new HashSet<>();
    failModes.add("secure");
    bridge.setFailMode(failModes);

    Set<String> protocols = new HashSet<>();
    protocols.add(OvsdbConstant.OPENFLOW13);
    bridge.setProtocols(protocols);

    String ovsUuid = getOvsUuid(OvsdbConstant.DATABASENAME);
    if (ovsUuid == null) {
        log.warn("The Open_vSwitch is null");
        return;
    }

    Map<String, String> options = new HashMap<>();
    options.put("disable-in-band", "true");
    bridge.setOtherConfig(options);

    String bridgeUuid = getBridgeUuid(bridgeName);
    if (bridgeUuid == null) {
        log.debug("Create a new bridge");

        bridge.setName(bridgeName);
        bridgeUuid = insertConfig(OvsdbConstant.BRIDGE, "_uuid",
                                  OvsdbConstant.DATABASENAME, "bridges",
                                  ovsUuid, bridge.getRow());

        if (bridgeUuid != null) {
            Port port = (Port) TableGenerator.createTable(dbSchema,
                                                          OvsdbTable.PORT);
            if (port != null) {
                log.debug("the port is not null");
                port.setName(bridgeName);

                insertConfig(OvsdbConstant.PORT, "_uuid", "Bridge", "ports", bridgeUuid,
                             port.getRow());
            }
        } else {
            String message = BridgeCreateException.createMessage(ovsUuid);
            throw new BridgeCreateException(message);
        }

    } else {
        log.info("Update a bridge");
        updateConfig(OvsdbConstant.BRIDGE, "_uuid", bridgeUuid, bridge.getRow());
    }

    setControllerAuto(bridgeUuid);
    log.info("Create bridge success");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:68,代码来源:DefaultOvsdbClient.java

示例4: createTunnel

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

示例5: createInterface

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