@Test public void testGetProperties() { int vlan = 1; int vni = 10000; IntegerSpace vlans = IntegerSpace.of(vlan); Map<String, ColumnMetadata> columns = createTableMetadata(new SwitchedVlanPropertiesQuestion()).toColumnMap(); Interface iface = _ib.build(); iface.setSwitchport(true); iface.setSwitchportMode(SwitchportMode.ACCESS); iface.setAccessVlan(vlan); _configurations.get(NODE).getDefaultVrf().addLayer2Vni(_vnb.setVni(vni).setVlan(vlan).build()); assertThat( getProperties( _specifierContext, _configurations, ImmutableSet.of(NODE), AllInterfacesInterfaceSpecifier.INSTANCE, false, vlans, columns), contains( Row.of( COL_NODE, new Node(NODE), COL_VLAN_ID, vlan, COL_INTERFACES, ImmutableSet.of(NodeInterfacePair.of(NODE, INTERFACE)), COL_VXLAN_VNI, vni))); }
public static Multiset<Row> getProperties( SpecifierContext ctxt, Map<String, Configuration> configurations, Set<String> nodes, InterfaceSpecifier interfaceSpecifier, boolean excludeShutInterfaces, IntegerSpace vlans, Map<String, ColumnMetadata> columns) { Multiset<Row> rows = HashMultiset.create(); for (String node : nodes) { Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = new HashMap<>(); ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder = ImmutableMap.builder(); computeNodeVlanProperties( ctxt, configurations.get(node), interfaceSpecifier, excludeShutInterfaces, vlans, switchedVlanInterfaces, vlanVnisBuilder); populateNodeRows(node, switchedVlanInterfaces, vlanVnisBuilder, columns, rows); } return rows; }
SwitchedVlanPropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( SpecifierContext ctxt, Map<String, Configuration> configurations, Set<String> nodes, InterfaceSpecifier interfaceSpecifier, boolean excludeShutInterfaces, IntegerSpace vlans, Map<String, ColumnMetadata> columns) { Multiset<Row> rows = HashMultiset.create(); for (String node : nodes) { Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = new HashMap<>(); ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder = ImmutableMap.builder(); computeNodeVlanProperties( ctxt, configurations.get(node), interfaceSpecifier, excludeShutInterfaces, vlans, switchedVlanInterfaces, vlanVnisBuilder); populateNodeRows(node, switchedVlanInterfaces, vlanVnisBuilder, columns, rows); } return rows; } }
SwitchedVlanPropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( SpecifierContext ctxt, Map<String, Configuration> configurations, Set<String> nodes, InterfaceSpecifier interfaceSpecifier, boolean excludeShutInterfaces, IntegerSpace vlans, Map<String, ColumnMetadata> columns) { Multiset<Row> rows = HashMultiset.create(); for (String node : nodes) { Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = new HashMap<>(); ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder = ImmutableMap.builder(); computeNodeVlanProperties( ctxt, configurations.get(node), interfaceSpecifier, excludeShutInterfaces, vlans, switchedVlanInterfaces, vlanVnisBuilder); populateNodeRows(node, switchedVlanInterfaces, vlanVnisBuilder, columns, rows); } return rows; } SwitchedVlanPropertiesAnswerer(Question question, IBatfish batfish); }
SwitchedVlanPropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( SpecifierContext ctxt, Map<String, Configuration> configurations, Set<String> nodes, InterfaceSpecifier interfaceSpecifier, boolean excludeShutInterfaces, IntegerSpace vlans, Map<String, ColumnMetadata> columns) { Multiset<Row> rows = HashMultiset.create(); for (String node : nodes) { Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = new HashMap<>(); ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder = ImmutableMap.builder(); computeNodeVlanProperties( ctxt, configurations.get(node), interfaceSpecifier, excludeShutInterfaces, vlans, switchedVlanInterfaces, vlanVnisBuilder); populateNodeRows(node, switchedVlanInterfaces, vlanVnisBuilder, columns, rows); } return rows; } 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 { public static Multiset<Row> getProperties( SpecifierContext ctxt, Map<String, Configuration> configurations, Set<String> nodes, InterfaceSpecifier interfaceSpecifier, boolean excludeShutInterfaces, IntegerSpace vlans, Map<String, ColumnMetadata> columns) { Multiset<Row> rows = HashMultiset.create(); for (String node : nodes) { Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = new HashMap<>(); ImmutableMap.Builder<Integer, Integer> vlanVnisBuilder = ImmutableMap.builder(); computeNodeVlanProperties( ctxt, configurations.get(node), interfaceSpecifier, excludeShutInterfaces, vlans, switchedVlanInterfaces, vlanVnisBuilder); populateNodeRows(node, switchedVlanInterfaces, vlanVnisBuilder, columns, rows); } return rows; } 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);  }