@Override
  public JSONObject getSnapshot() {
    JSONObject snapshot = new JSONObject();
    snapshot.put(DATA_NODE_HOSTNAME, getHostname());
    snapshot.put(DATA_NODE_DATACENTER, getDatacenterName());
    snapshot.put(DATA_NODE_SSL_ENABLED_DATACENTERS, new JSONArray(sslEnabledDataCenters));
    JSONObject portsJson = new JSONObject();
    ports.forEach((portType, port) -> portsJson.put(port.getPortType().name(), port.getPort()));
    portsJson.put(DATA_NODE_PORT_CONNECT_TO, getPortToConnectTo().getPort());
    snapshot.put(DATA_NODE_PORTS, portsJson);
    snapshot.put(DATA_NODE_XID, getXid());
    snapshot.put(LIVENESS, getState() == HardwareState.UNAVAILABLE ? DOWN : UP);
    JSONArray disksJson = new JSONArray();
    mountPaths.forEach(mountPath -> disksJson.put(new MockDiskId(this, mountPath).getSnapshot()));
    snapshot.put(DATA_NODE_DISKS, disksJson);
    return snapshot;
  }
This datanode will always return an HTTP/2 port in {@link #getPortToConnectTo()} if enableHttp2Replication
is set to true.
@param enable http2 replication if it's true.
ambry-test-utils/src/main/java/com/github/ambry/clustermap/MockDataNodeId.java