本文整理汇总了Java中org.onosproject.ovsdb.rfc.table.Bridge类的典型用法代码示例。如果您正苦于以下问题:Java Bridge类的具体用法?Java Bridge怎么用?Java Bridge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Bridge类属于org.onosproject.ovsdb.rfc.table包,在下文中一共展示了Bridge类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOvsdbBridge
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的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;
}
示例2: getDataPathid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
/**
* Gets datapathid from table bridge.
*
* @param clientService OvsdbClientService instance
* @param dbSchema ovsdb database schema
* @return datapathid the bridge datapathid
*/
private long getDataPathid(OvsdbClientService clientService,
DatabaseSchema dbSchema) {
String bridgeUuid = clientService
.getBridgeUuid(OvsdbConstant.INTEGRATION_BRIDGE);
if (bridgeUuid == null) {
log.debug("Unable to spot bridge uuid for {} in {}",
OvsdbConstant.INTEGRATION_BRIDGE, clientService);
return 0;
}
Row bridgeRow = clientService.getRow(OvsdbConstant.DATABASENAME,
"Bridge", bridgeUuid);
Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow,
OvsdbTable.BRIDGE);
OvsdbSet dpidSet = (OvsdbSet) bridge.getDatapathIdColumn().data();
@SuppressWarnings("unchecked")
Set<String> dpids = dpidSet.set();
if (dpids == null || dpids.size() == 0) {
return 0;
}
return stringToLong((String) dpids.toArray()[0]);
}
示例3: getBridgeUuid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
@Override
public String getBridgeUuid(String bridgeName) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
OvsdbRowStore rowStore = getRowStore(DATABASENAME, BRIDGE);
if (rowStore == null) {
log.debug("The bridge uuid is null");
return null;
}
ConcurrentMap<String, Row> bridgeTableRows = rowStore.getRowStore();
if (bridgeTableRows == null) {
log.debug("The bridge uuid is null");
return null;
}
for (String uuid : bridgeTableRows.keySet()) {
Bridge bridge = (Bridge) TableGenerator
.getTable(dbSchema, bridgeTableRows.get(uuid), OvsdbTable.BRIDGE);
if (bridge.getName().equals(bridgeName)) {
return uuid;
}
}
return null;
}
示例4: getDataPathid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
/**
* Gets datapathid from table bridge.
*
* @param clientService OvsdbClientService instance
* @param dbSchema ovsdb database schema
* @return datapathid the bridge datapathid
*/
private long getDataPathid(OvsdbClientService clientService,
DatabaseSchema dbSchema) {
String bridgeUuid = clientService
.getBridgeUuid(OvsdbConstant.INTEGRATION_BRIDGE);
if (bridgeUuid == null) {
log.debug("Unable to spot bridge uuid for {} in {}",
OvsdbConstant.INTEGRATION_BRIDGE, clientService);
return 0;
}
Row bridgeRow = clientService.getRow(OvsdbConstant.DATABASENAME,
"Bridge", bridgeUuid);
Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow,
OvsdbTable.BRIDGE);
OvsdbSet dpidSet = (OvsdbSet) bridge.getDatapathIdColumn().data();
@SuppressWarnings("unchecked")
Set<String> dpids = dpidSet.set();
if (dpids == null || dpids.isEmpty()) {
return 0;
}
return stringToLong((String) dpids.toArray()[0]);
}
示例5: getPortUuid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
@Override
public String getPortUuid(String portName, String bridgeUuid) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
Row bridgeRow = getRow(OvsdbConstant.DATABASENAME,
OvsdbConstant.BRIDGE, bridgeUuid);
Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow,
OvsdbTable.BRIDGE);
if (bridge != null) {
OvsdbSet setPorts = (OvsdbSet) bridge.getPortsColumn().data();
@SuppressWarnings("unchecked")
Set<Uuid> ports = setPorts.set();
if (ports == null || ports.size() == 0) {
log.warn("The port uuid is null");
return null;
}
for (Uuid uuid : ports) {
Row portRow = getRow(OvsdbConstant.DATABASENAME,
OvsdbConstant.PORT, uuid.value());
Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
OvsdbTable.PORT);
if (port != null && portName.equalsIgnoreCase(port.getName())) {
return uuid.value();
}
}
}
return null;
}
示例6: getBridgeUuid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
@Override
public String getBridgeUuid(String bridgeName) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
OvsdbConstant.BRIDGE);
if (rowStore == null) {
log.debug("The bridge uuid is null");
return null;
}
ConcurrentMap<String, Row> bridgeTableRows = rowStore.getRowStore();
if (bridgeTableRows == null) {
log.debug("The bridge uuid is null");
return null;
}
for (String uuid : bridgeTableRows.keySet()) {
Bridge bridge = (Bridge) TableGenerator
.getTable(dbSchema, bridgeTableRows.get(uuid),
OvsdbTable.BRIDGE);
if (bridge.getName().equals(bridgeName)) {
return uuid;
}
}
return null;
}
示例7: getMirrorings
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
/**
* Helper method which retrieves mirrorings statistics using bridge uuid.
*
* @param bridgeUuid the uuid of the bridge
* @return the list of the mirrorings statistics.
*/
private List<MirroringStatistics> getMirrorings(Uuid bridgeUuid) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
if (dbSchema == null) {
log.warn("Unable to retrieve dbSchema {}", DATABASENAME);
return null;
}
OvsdbRowStore rowStore = getRowStore(DATABASENAME, BRIDGE);
if (rowStore == null) {
log.warn("Unable to retrieve rowStore {} of {}", BRIDGE, DATABASENAME);
return null;
}
Row bridgeRow = rowStore.getRow(bridgeUuid.value());
Bridge bridge = (Bridge) TableGenerator.
getTable(dbSchema, bridgeRow, OvsdbTable.BRIDGE);
Set<Uuid> mirroringsUuids = (Set<Uuid>) ((OvsdbSet) bridge
.getMirrorsColumn().data()).set();
OvsdbRowStore mirrorRowStore = getRowStore(DATABASENAME, MIRROR);
if (mirrorRowStore == null) {
log.warn("Unable to retrieve rowStore {} of {}", MIRROR, DATABASENAME);
return null;
}
List<MirroringStatistics> mirroringStatistics = new ArrayList<>();
ConcurrentMap<String, Row> mirrorTableRows = mirrorRowStore.getRowStore();
mirrorTableRows.forEach((key, row) -> {
if (!mirroringsUuids.contains(Uuid.uuid(key))) {
return;
}
Mirror mirror = (Mirror) TableGenerator
.getTable(dbSchema, row, OvsdbTable.MIRROR);
mirroringStatistics.add(MirroringStatistics.mirroringStatistics(mirror.getName(),
(Map<String, Integer>) ((OvsdbMap) mirror
.getStatisticsColumn().data()).map()));
});
return ImmutableList.copyOf(mirroringStatistics);
}
示例8: getPortUuid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
@Override
public String getPortUuid(String portName, String bridgeUuid) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
Row bridgeRow = getRow(DATABASENAME, BRIDGE, bridgeUuid);
Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow,
OvsdbTable.BRIDGE);
if (bridge != null) {
OvsdbSet setPorts = (OvsdbSet) bridge.getPortsColumn().data();
@SuppressWarnings("unchecked")
Set<Uuid> ports = setPorts.set();
if (ports == null || ports.isEmpty()) {
log.warn("The port uuid is null");
return null;
}
for (Uuid uuid : ports) {
Row portRow = getRow(DATABASENAME, PORT, uuid.value());
Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
OvsdbTable.PORT);
if (port != null && portName.equalsIgnoreCase(port.getName())) {
return uuid.value();
}
}
}
return null;
}
示例9: getControllers
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
private List<Controller> getControllers(Uuid bridgeUuid) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
if (dbSchema == null) {
return null;
}
OvsdbRowStore rowStore = getRowStore(DATABASENAME, BRIDGE);
if (rowStore == null) {
log.debug("There is no bridge table");
return null;
}
Row bridgeRow = rowStore.getRow(bridgeUuid.value());
Bridge bridge = (Bridge) TableGenerator.
getTable(dbSchema, bridgeRow, OvsdbTable.BRIDGE);
//FIXME remove log
log.warn("type of controller column", bridge.getControllerColumn()
.data().getClass());
Set<Uuid> controllerUuids = (Set<Uuid>) ((OvsdbSet) bridge
.getControllerColumn().data()).set();
OvsdbRowStore controllerRowStore = getRowStore(DATABASENAME, CONTROLLER);
if (controllerRowStore == null) {
log.debug("There is no controller table");
return null;
}
List<Controller> ovsdbControllers = new ArrayList<>();
ConcurrentMap<String, Row> controllerTableRows = controllerRowStore.getRowStore();
controllerTableRows.forEach((key, row) -> {
if (!controllerUuids.contains(Uuid.uuid(key))) {
return;
}
Controller controller = (Controller) TableGenerator
.getTable(dbSchema, row, OvsdbTable.CONTROLLER);
ovsdbControllers.add(controller);
});
return ovsdbControllers;
}
示例10: getOvsdbBridge
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的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();
}
}
示例11: getPorts
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
@Override
public List<OvsdbPortName> getPorts(List<String> portNames, DeviceId deviceId) {
Uuid bridgeUuid = getBridgeUuid(deviceId);
if (bridgeUuid == null) {
log.error("Can't find the bridge for the deviceId {}", deviceId);
return Collections.emptyList();
}
DatabaseSchema dbSchema = schema.get(DATABASENAME);
Row bridgeRow = getRow(DATABASENAME, BRIDGE, bridgeUuid.value());
Bridge bridge = (Bridge) TableGenerator.getTable(dbSchema, bridgeRow, OvsdbTable.BRIDGE);
if (bridge == null) {
return Collections.emptyList();
}
OvsdbSet setPorts = (OvsdbSet) bridge.getPortsColumn().data();
Set<Uuid> portSet = setPorts.set();
if (portSet.isEmpty()) {
return Collections.emptyList();
}
Map<Uuid, Port> portMap = portSet.stream().collect(Collectors.toMap(
java.util.function.Function.identity(), port -> (Port) TableGenerator
.getTable(dbSchema, getRow(DATABASENAME,
PORT, port.value()), OvsdbTable.PORT)));
List<OvsdbPortName> portList = portMap.entrySet().stream().filter(port -> Objects.nonNull(port.getValue())
&& portNames.contains(port.getValue().getName())
&& Objects.nonNull(getInterfacebyPort(port.getKey().value(), port.getValue().getName())))
.map(port -> new OvsdbPortName(port.getValue().getName())).collect(Collectors.toList());
return Collections.unmodifiableList(portList);
}
示例12: 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");
}
示例13: getControllers
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
private List<Controller> getControllers(Uuid bridgeUuid) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
if (dbSchema == null) {
return null;
}
OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
OvsdbConstant.BRIDGE);
if (rowStore == null) {
log.debug("There is no bridge table");
return null;
}
Row bridgeRow = rowStore.getRow(bridgeUuid.value());
Bridge bridge = (Bridge) TableGenerator.
getTable(dbSchema, bridgeRow, OvsdbTable.BRIDGE);
//FIXME remove log
log.warn("type of controller column", bridge.getControllerColumn()
.data().getClass());
Set<Uuid> controllerUuids = (Set<Uuid>) ((OvsdbSet) bridge
.getControllerColumn().data()).set();
// Set<String> controllerUuidStrings = (Set<String>) bridge.getControllerColumn().data();
OvsdbRowStore controllerRowStore = getRowStore(OvsdbConstant.DATABASENAME,
OvsdbConstant.CONTROLLER);
if (controllerRowStore == null) {
log.debug("There is no controller table");
return null;
}
List<Controller> ovsdbControllers = new ArrayList<>();
ConcurrentMap<String, Row> controllerTableRows = controllerRowStore.getRowStore();
controllerTableRows.forEach((key, row) -> {
if (!controllerUuids.contains(Uuid.uuid(key))) {
return;
}
Controller controller = (Controller) TableGenerator
.getTable(dbSchema, row, OvsdbTable.CONTROLLER);
ovsdbControllers.add(controller);
});
return ovsdbControllers;
}
示例14: matchesDpid
import org.onosproject.ovsdb.rfc.table.Bridge; //导入依赖的package包/类
private static boolean matchesDpid(Bridge b, DeviceId deviceId) {
String ofDpid = deviceId.toString().replace("of:", "");
Set ofDeviceIds = ((OvsdbSet) b.getDatapathIdColumn().data()).set();
//TODO Set<String>
return ofDeviceIds.contains(ofDpid);
}