@Test public void testPopulateNodeRows() { Map<String, ColumnMetadata> columns = createTableMetadata(new SwitchedVlanPropertiesQuestion()).toColumnMap(); int vlan = 1; int vni = 10000; NodeInterfacePair i = NodeInterfacePair.of(NODE, INTERFACE); Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = ImmutableMap.of(vlan, ImmutableSet.<NodeInterfacePair>builder().add(i)); ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder = ImmutableMap.<Integer, Integer>builder().put(vlan, vni); Collection<Row> rows = HashMultiset.create(); populateNodeRows(NODE, switchedVlanInterfaces, vlanVnisBuilder, columns, rows); assertThat( rows, contains( Row.of( COL_NODE, new Node(NODE), COL_VLAN_ID, vlan, COL_INTERFACES, ImmutableSet.of(i), COL_VXLAN_VNI, vni))); }
@VisibleForTesting static void populateNodeRows( String node, Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder, Map<String, ColumnMetadata> columns, Collection<Row> rows) { Map<Integer, Integer> vlanVnis = vlanVnisBuilder.build(); switchedVlanInterfaces.forEach( (vlan, interfaces) -> rows.add(createRow(columns, node, vlan, interfaces.build(), vlanVnis))); }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void populateNodeRows( String node, Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder, Map<String, ColumnMetadata> columns, Collection<Row> rows) { Map<Integer, Integer> vlanVnis = vlanVnisBuilder.build(); switchedVlanInterfaces.forEach( (vlan, interfaces) -> rows.add(createRow(columns, node, vlan, interfaces.build(), vlanVnis))); } }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void populateNodeRows( String node, Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder, Map<String, ColumnMetadata> columns, Collection<Row> rows) { Map<Integer, Integer> vlanVnis = vlanVnisBuilder.build(); switchedVlanInterfaces.forEach( (vlan, interfaces) -> rows.add(createRow(columns, node, vlan, interfaces.build(), vlanVnis))); } SwitchedVlanPropertiesAnswerer(Question question, IBatfish batfish); }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void populateNodeRows( String node, Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder, Map<String, ColumnMetadata> columns, Collection<Row> rows) { Map<Integer, Integer> vlanVnis = vlanVnisBuilder.build(); switchedVlanInterfaces.forEach( (vlan, interfaces) -> rows.add(createRow(columns, node, vlan, interfaces.build(), vlanVnis))); } SwitchedVlanPropertiesAnswerer(Question question, IBatfish batfish); static List<ColumnMetadata> createColumnMetadata(); static String getColumnName(String property); static Multiset<Row> getProperties(
      SpecifierContext ctxt,
      Map<String, Configuration> configurations,
      Set<String> nodes,
      InterfaceSpecifier interfaceSpecifier,
      boolean excludeShutInterfaces,
      IntegerSpace vlans,
      Map<String, ColumnMetadata> columns); @Override TableAnswerElement answer(NetworkSnapshot snapshot); }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void populateNodeRows( String node, Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder, Map<String, ColumnMetadata> columns, Collection<Row> rows) { Map<Integer, Integer> vlanVnis = vlanVnisBuilder.build(); switchedVlanInterfaces.forEach( (vlan, interfaces) -> rows.add(createRow(columns, node, vlan, interfaces.build(), vlanVnis))); } SwitchedVlanPropertiesAnswerer(Question question, IBatfish batfish); static List<ColumnMetadata> createColumnMetadata(); static String getColumnName(String property); static Multiset<Row> getProperties(
      SpecifierContext ctxt,
      Map<String, Configuration> configurations,
      Set<String> nodes,
      InterfaceSpecifier interfaceSpecifier,
      boolean excludeShutInterfaces,
      IntegerSpace vlans,
      Map<String, ColumnMetadata> columns); @Override TableAnswerElement answer(NetworkSnapshot snapshot);  }