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;
  }
Esempio n. 2
0
  @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;
  }
Esempio n. 3
0
 @Override
 public String getOvsUuid(String dbName) {
   OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME, OvsdbConstant.DATABASENAME);
   if (rowStore == null) {
     log.debug("The bridge uuid is null");
     return null;
   }
   ConcurrentMap<String, Row> ovsTableRows = rowStore.getRowStore();
   if (ovsTableRows != null) {
     for (String uuid : ovsTableRows.keySet()) {
       Row row = ovsTableRows.get(uuid);
       String tableName = row.tableName();
       if (tableName.equals(dbName)) {
         return uuid;
       }
     }
   }
   return null;
 }
Esempio n. 4
0
 @Override
 public Set<OvsdbPort> getPorts() {
   Set<OvsdbPort> ovsdbPorts = new HashSet<OvsdbPort>();
   OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
   if (tableStore == null) {
     return null;
   }
   OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.INTERFACE);
   if (rowStore == null) {
     return null;
   }
   ConcurrentMap<String, Row> rows = rowStore.getRowStore();
   for (String uuid : rows.keySet()) {
     Row row = getRow(OvsdbConstant.DATABASENAME, OvsdbConstant.INTERFACE, uuid);
     OvsdbPort ovsdbPort = getOvsdbPort(row);
     if (ovsdbPort != null) {
       ovsdbPorts.add(ovsdbPort);
     }
   }
   return ovsdbPorts;
 }
Esempio n. 5
0
 @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;
 }