當前位置: 首頁>>代碼示例>>Java>>正文


Java Bridge.setProtocols方法代碼示例

本文整理匯總了Java中org.onosproject.ovsdb.rfc.table.Bridge.setProtocols方法的典型用法代碼示例。如果您正苦於以下問題:Java Bridge.setProtocols方法的具體用法?Java Bridge.setProtocols怎麽用?Java Bridge.setProtocols使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.onosproject.ovsdb.rfc.table.Bridge的用法示例。


在下文中一共展示了Bridge.setProtocols方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createBridge

import org.onosproject.ovsdb.rfc.table.Bridge; //導入方法依賴的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


注:本文中的org.onosproject.ovsdb.rfc.table.Bridge.setProtocols方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。