Esempio n. 1
0
  @Override
  public String getControllerUuid(String controllerName, String controllerTarget) {
    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
    OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME, OvsdbConstant.CONTROLLER);
    if (rowStore == null) {
      log.debug("The controller uuid is null");
      return null;
    }

    ConcurrentMap<String, Row> controllerTableRows = rowStore.getRowStore();
    if (controllerTableRows != null) {
      for (String uuid : controllerTableRows.keySet()) {

        Controller controller =
            (Controller)
                TableGenerator.getTable(
                    dbSchema, controllerTableRows.get(uuid), OvsdbTable.CONTROLLER);
        String target = (String) controller.getTargetColumn().data();
        if (target.equalsIgnoreCase(controllerTarget)) {
          return uuid;
        }
      }
    }
    return null;
  }