示例#1
0
 @Override
 public Collection<BridgeDescription> getBridges() {
   DriverHandler handler = handler();
   DeviceId deviceId = handler.data().deviceId();
   OvsdbClientService ovsdbNode = getOvsdbNode(handler);
   Set<OvsdbBridge> ovsdbSet = ovsdbNode.getBridges();
   Collection<BridgeDescription> bridges = Sets.newHashSet();
   ovsdbSet.forEach(
       o -> {
         BridgeName bridgeName = BridgeName.bridgeName(o.bridgeName().toString());
         DeviceId ownDeviceId = DeviceId.deviceId(o.datapathId().toString());
         BridgeDescription description =
             new DefaultBridgeDescription(bridgeName, deviceId, ownDeviceId);
         bridges.add(description);
       });
   return bridges;
 }
示例#2
0
 private OvsdbClientService getOvsdbNode(DriverHandler handler) {
   OvsdbController ovsController = handler.get(OvsdbController.class);
   DeviceId deviceId = handler.data().deviceId();
   OvsdbNodeId nodeId = changeDeviceIdToNodeId(deviceId);
   return ovsController.getOvsdbClient(nodeId);
 }