@Test public void resolveNodeTest() { SpecifiersQuestion question = new SpecifiersQuestion(QueryType.NODE); question.setNodeSpecifierInput(_c1.getHostname()); assertThat( resolveNode(question, _context).getRows().getData(), equalTo(ImmutableMultiset.of(Row.of(COL_NODE, new Node(_c1.getHostname()))))); }
@VisibleForTesting static TableAnswerElement resolveNode(SpecifiersQuestion question, SpecifierContext context) { List<ColumnMetadata> columns = ImmutableList.of(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", false, false)); TableAnswerElement table = new TableAnswerElement(new TableMetadata(columns)); Map<String, ColumnMetadata> columnMap = table.getMetadata().toColumnMap(); Set<String> nodes = question.getNodeSpecifier().resolve(context); for (String node : nodes) { table.addRow(Row.of(columnMap, COL_NODE, new Node(node))); } return table; }
SpecifiersAnswerer extends Answerer { @VisibleForTesting static TableAnswerElement resolveNode(SpecifiersQuestion question, SpecifierContext context) { List<ColumnMetadata> columns = ImmutableList.of(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", false, false)); TableAnswerElement table = new TableAnswerElement(new TableMetadata(columns)); Map<String, ColumnMetadata> columnMap = table.getMetadata().toColumnMap(); Set<String> nodes = question.getNodeSpecifier().resolve(context); for (String node : nodes) { table.addRow(Row.of(columnMap, COL_NODE, new Node(node))); } return table; } }
SpecifiersAnswerer extends Answerer { @VisibleForTesting static TableAnswerElement resolveNode(SpecifiersQuestion question, SpecifierContext context) { List<ColumnMetadata> columns = ImmutableList.of(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", false, false)); TableAnswerElement table = new TableAnswerElement(new TableMetadata(columns)); Map<String, ColumnMetadata> columnMap = table.getMetadata().toColumnMap(); Set<String> nodes = question.getNodeSpecifier().resolve(context); for (String node : nodes) { table.addRow(Row.of(columnMap, COL_NODE, new Node(node))); } return table; } SpecifiersAnswerer(Question question, IBatfish batfish); }
SpecifiersAnswerer extends Answerer { @VisibleForTesting static TableAnswerElement resolveNode(SpecifiersQuestion question, SpecifierContext context) { List<ColumnMetadata> columns = ImmutableList.of(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", false, false)); TableAnswerElement table = new TableAnswerElement(new TableMetadata(columns)); Map<String, ColumnMetadata> columnMap = table.getMetadata().toColumnMap(); Set<String> nodes = question.getNodeSpecifier().resolve(context); for (String node : nodes) { table.addRow(Row.of(columnMap, COL_NODE, new Node(node))); } return table; } SpecifiersAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
SpecifiersAnswerer extends Answerer { @VisibleForTesting static TableAnswerElement resolveNode(SpecifiersQuestion question, SpecifierContext context) { List<ColumnMetadata> columns = ImmutableList.of(new ColumnMetadata(COL_NODE, Schema.NODE, "Node", false, false)); TableAnswerElement table = new TableAnswerElement(new TableMetadata(columns)); Map<String, ColumnMetadata> columnMap = table.getMetadata().toColumnMap(); Set<String> nodes = question.getNodeSpecifier().resolve(context); for (String node : nodes) { table.addRow(Row.of(columnMap, COL_NODE, new Node(node))); } return table; } SpecifiersAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); static final String COL_FILTER_NAME; static final String COL_INTERFACE; static final String COL_IP_SPACE; static final String COL_LOCATION; static final String COL_LOCATIONS; static final String COL_NODE; }