public static void generateNodeTableMapping(Set<NodeDetails> nodeDetails,
      String filePath) throws IOException {
    List<String> entries = new ArrayList<>();
    for (NodeDetails nodeDetail : nodeDetails) {
      if (nodeDetail.getHostname().contains("/")) {
        String hostname = nodeDetail.getHostname();
        int lIndex = hostname.lastIndexOf("/");
        String node = hostname.substring(lIndex + 1);
        String rack = hostname.substring(0, lIndex);
        entries.add(node + " " + rack);
      }
    }
    Files.write(Paths.get(filePath),
        entries,
        StandardCharsets.UTF_8,
        StandardOpenOption.CREATE);
  }
@Test
  public void testGenerateNodeTableMapping() throws Exception {
    Set<NodeDetails> nodes = SLSUtils.generateNodes(3, 3);
    File tempFile = File.createTempFile("testslsutils", ".tmp");
    tempFile.deleteOnExit();
    String fileName = tempFile.getAbsolutePath();
    SLSUtils.generateNodeTableMapping(nodes, fileName);

    List<String> lines = Files.readAllLines(Paths.get(fileName));
    Assert.assertEquals(3, lines.size());
    for (String line : lines) {
      Assert.assertTrue(line.contains("node"));
      Assert.assertTrue(line.contains("/rack"));
    }
  }