protected JSONArray getDatacenters(boolean createNew, boolean updateDisks, boolean removeDataNode)
        throws JSONException {
      this.names = new ArrayList<>(datacenterCount);
      if (createNew) {
        datanodeJSONArrays = new ArrayList<>(datacenterCount);
      }

      int curBasePort = basePort;
      int sslPort = curBasePort + 10000;
      int http2Port = sslPort + 10000;
      for (int i = 0; i < datacenterCount; i++) {
        names.add(i, "DC" + i);
        JSONArray disksArray = getDisks();
        if (createNew) {
          datanodeJSONArrays.add(i, getDataNodes(curBasePort, sslPort, http2Port, disksArray));
        } else if (removeDataNode) {
          removeDataNodeInJsonArray(datanodeJSONArrays.get(i));
        } else {
          updateDataNodeJsonArray(datanodeJSONArrays.get(i), curBasePort, sslPort, http2Port, disksArray);
        }
        if (updateDisks) {
          updateDataNodeJsonArrayWithNewDiskCapacity(datanodeJSONArrays.get(i), disksArray);
        }
        curBasePort += dataNodeCount;
        basePort += dataNodeCount;
      }

      return TestUtils.getJsonArrayDatacenters(names, datanodeJSONArrays);
    }
@param rangeStart start of the range of partitions.
@param count the number of partitions in the range.
@param expectedClass the expected class of all of the partitions
@param expectedState the expected state of all of the partitions
ambry-clustermap/src/test/java/com/github/ambry/clustermap/TestUtils.java