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


Java OvsdbBridge类代码示例

本文整理汇总了Java中org.onosproject.ovsdb.controller.OvsdbBridge的典型用法代码示例。如果您正苦于以下问题:Java OvsdbBridge类的具体用法?Java OvsdbBridge怎么用?Java OvsdbBridge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getBridges

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public Collection<BridgeDescription> getBridges() {
    DriverHandler handler = handler();
    DeviceId deviceId = handler.data().deviceId();
    OvsdbClientService clientService = getOvsdbClientService(handler);
    Set<OvsdbBridge> bridges = clientService.getBridges();

    return bridges.stream()
            .map(x -> new DefaultBridgeDescription(
                            BridgeName.bridgeName(x.bridgeName().value()),
                            deviceId,
                            DeviceId.deviceId("of:" + x.datapathId().value())
                    )
            )
            .collect(Collectors.toSet());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:OvsdbBridgeConfig.java

示例2: getBridges

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public Set<OvsdbBridge> getBridges() {
    Set<OvsdbBridge> ovsdbBridges = new HashSet<OvsdbBridge>();
    OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
    if (tableStore == null) {
        return null;
    }
    OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.BRIDGE);
    if (rowStore == null) {
        return null;
    }
    ConcurrentMap<String, Row> rows = rowStore.getRowStore();
    for (String uuid : rows.keySet()) {
        Row row = getRow(OvsdbConstant.DATABASENAME, OvsdbConstant.BRIDGE,
                         uuid);
        OvsdbBridge ovsdbBridge = getOvsdbBridge(row);
        if (ovsdbBridge != null) {
            ovsdbBridges.add(ovsdbBridge);
        }
    }
    return ovsdbBridges;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DefaultOvsdbClient.java

示例3: getOvsdbBridge

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
private OvsdbBridge getOvsdbBridge(Row row) {
    DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
    Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, row,
                                                     OvsdbTable.BRIDGE);
    if (bridge == null) {
        return null;
    }

    OvsdbSet datapathIdSet = (OvsdbSet) bridge.getDatapathIdColumn().data();
    @SuppressWarnings("unchecked")
    Set<String> datapathIds = datapathIdSet.set();
    if (datapathIds == null || datapathIds.size() == 0) {
        return null;
    }
    String datapathId = (String) datapathIds.toArray()[0];
    String bridgeName = bridge.getName();
    if ((datapathId == null) || (bridgeName == null)) {
        return null;
    }

    OvsdbBridge ovsdbBridge = new OvsdbBridge(new OvsdbBridgeName(bridgeName),
                                              new OvsdbDatapathId(datapathId));
    return ovsdbBridge;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DefaultOvsdbClient.java

示例4: getBridges

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public Collection<BridgeDescription> getBridges() {
    OvsdbClientService client = getOvsdbClientService(handler());
    if (client == null) {
        return Collections.emptyList();
    }

    Set<OvsdbBridge> bridges = client.getBridges();

    return bridges.stream()
            .map(bridge -> DefaultBridgeDescription.builder()
                    .name(bridge.name())
                    .datapathId(bridge.datapathId().get())
                    .build())
            .collect(Collectors.toSet());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:OvsdbBridgeConfig.java

示例5: getBridges

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public Set<OvsdbBridge> getBridges() {
    Set<OvsdbBridge> ovsdbBridges = new HashSet<>();
    OvsdbTableStore tableStore = getTableStore(DATABASENAME);
    if (tableStore == null) {
        return ovsdbBridges;
    }
    OvsdbRowStore rowStore = tableStore.getRows(BRIDGE);
    if (rowStore == null) {
        return ovsdbBridges;
    }
    ConcurrentMap<String, Row> rows = rowStore.getRowStore();
    for (String uuid : rows.keySet()) {
        Row bridgeRow = getRow(DATABASENAME, BRIDGE, uuid);
        OvsdbBridge ovsdbBridge = getOvsdbBridge(bridgeRow, Uuid.uuid(uuid));
        if (ovsdbBridge != null) {
            ovsdbBridges.add(ovsdbBridge);
        }
    }
    return ovsdbBridges;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:DefaultOvsdbClient.java

示例6: createTunnelInterface

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
/**
 * Create a GRE tunnel interface pointing to remote MOAS.
 *
 * @param remoteIp remote ip on GRE tunnel
 */
private void createTunnelInterface(IpAddress remoteIp) {
    ovsdbController.getNodeIds().forEach(nodeId -> artemisService.getConfig().flatMap(config ->
            config.moasInfo().getTunnelPoints()
                    .stream()
                    .filter(tunnelPoint -> tunnelPoint.getOvsdbIp().toString().equals(nodeId.getIpAddress()))
                    .findFirst()
    ).ifPresent(tunnelPoint -> {
        OvsdbClientService ovsdbClient = ovsdbController.getOvsdbClient(nodeId);
        ovsdbClient.dropInterface("gre-int");
        Map<String, String> options = Maps.newHashMap();
        options.put("remote_ip", remoteIp.toString());
        OvsdbInterface ovsdbInterface = OvsdbInterface.builder()
                .name("gre-int")
                .options(options)
                .type(OvsdbInterface.Type.GRE)
                .build();
        OvsdbBridge mainBridge = ovsdbClient.getBridges().iterator().next();
        ovsdbClient.createInterface(mainBridge.name(), ovsdbInterface);
        log.info("Tunnel setup at {} - {}", nodeId, tunnelPoint);
    }));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:ArtemisDeaggregatorImpl.java

示例7: addPort

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Deprecated
@Override
public void addPort(PortDescription port) {
    DriverHandler handler = handler();
    OvsdbClientService clientService = getOvsdbClientService(handler);
    Set<OvsdbBridge> ovsdbSet = clientService.getBridges();
    if (ovsdbSet != null && ovsdbSet.size() > 0) {
        OvsdbBridge bridge = ovsdbSet.iterator().next();
        clientService.createPort(bridge.bridgeName().value(), port
                .portNumber().toString());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:OvsdbBridgeConfig.java

示例8: deletePort

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Deprecated
@Override
public void deletePort(PortDescription port) {
    DriverHandler handler = handler();
    OvsdbClientService clientService = getOvsdbClientService(handler);
    Set<OvsdbBridge> ovsdbSet = clientService.getBridges();
    if (ovsdbSet != null && ovsdbSet.size() > 0) {
        OvsdbBridge bridge = ovsdbSet.iterator().next();
        clientService.dropPort(bridge.bridgeName().value(), port
                .portNumber().toString());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:OvsdbBridgeConfig.java

示例9: dpidMatches

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
private static boolean dpidMatches(OvsdbBridge bridge, DeviceId deviceId) {
    checkArgument(bridge.datapathId().isPresent());

    String bridgeDpid = "of:" + bridge.datapathId().get();
    String ofDpid = deviceId.toString();
    return bridgeDpid.equals(ofDpid);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:8,代码来源:OvsdbControllerConfig.java

示例10: addBridge

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public boolean addBridge(BridgeDescription bridgeDesc) {
    OvsdbClientService client = getOvsdbClientService(handler());
    if (client == null) {
        return false;
    }
    OvsdbBridge.Builder bridgeBuilder = OvsdbBridge.builder(bridgeDesc);
    if (bridgeDesc.enableLocalController()) {
        bridgeBuilder.controller(client.localController());
    }
    return client.createBridge(bridgeBuilder.build());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:OvsdbBridgeConfig.java

示例11: getOvsdbBridge

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
private OvsdbBridge getOvsdbBridge(Row row, Uuid bridgeUuid) {
    DatabaseSchema dbSchema = getDatabaseSchema(DATABASENAME);
    Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, row, OvsdbTable.BRIDGE);
    if (bridge == null) {
        return null;
    }

    OvsdbSet datapathIdSet = (OvsdbSet) bridge.getDatapathIdColumn().data();
    @SuppressWarnings("unchecked")
    Set<String> datapathIds = datapathIdSet.set();
    if (datapathIds == null || datapathIds.isEmpty()) {
        return null;
    }
    String datapathId = (String) datapathIds.toArray()[0];
    String bridgeName = bridge.getName();
    if ((datapathId == null) || (bridgeName == null)) {
        return null;
    }

    List<Controller> controllers = getControllers(bridgeUuid);

    if (controllers != null) {
        List<ControllerInfo> controllerInfos = controllers.stream().map(
                controller -> new ControllerInfo(
                (String) controller.getTargetColumn()
                        .data())).collect(Collectors.toList());

        return OvsdbBridge.builder()
                .name(bridgeName)
                .datapathId(datapathId)
                .controllers(controllerInfos)
                .build();
    } else {
        return OvsdbBridge.builder()
                .name(bridgeName)
                .datapathId(datapathId)
                .build();
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:40,代码来源:DefaultOvsdbClient.java

示例12: dpidMatches

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
private static boolean dpidMatches(OvsdbBridge bridge, DeviceId deviceId) {
    String bridgeDpid = "of:" + bridge.datapathId().value();
    String ofDpid = deviceId.toString();
    return bridgeDpid.equals(ofDpid);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:OvsdbControllerConfig.java

示例13: getBridges

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public Set<OvsdbBridge> getBridges() {
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:OvsdbClientServiceAdapter.java

示例14: createBridge

import org.onosproject.ovsdb.controller.OvsdbBridge; //导入依赖的package包/类
@Override
public boolean createBridge(OvsdbBridge ovsdbBridge) {
    return true;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:5,代码来源:OvsdbClientServiceAdapter.java


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