@Test public void testTryAddInterfaceToVlanIncludedVlan() { Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces = new HashMap<>(); Interface iface = _ib.build(); int vlan = 1; IntegerSpace vlans = IntegerSpace.of(vlan); tryAddInterfaceToVlan(switchedVlanInterfaces, NodeInterfacePair.of(iface), vlan, vlans); assertThat(switchedVlanInterfaces, hasKey(vlan)); assertThat( switchedVlanInterfaces.get(vlan).build(), contains(NodeInterfacePair.of(NODE, INTERFACE))); }
@VisibleForTesting static void tryAddInterfaceToVlan( Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, NodeInterfacePair iface, @Nullable Integer vlan, IntegerSpace vlans) { if (vlan != null && vlans.contains(vlan)) { switchedVlanInterfaces.computeIfAbsent(vlan, v -> ImmutableSet.builder()).add(iface); } }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void tryAddInterfaceToVlan( Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, NodeInterfacePair iface, @Nullable Integer vlan, IntegerSpace vlans) { if (vlan != null && vlans.contains(vlan)) { switchedVlanInterfaces.computeIfAbsent(vlan, v -> ImmutableSet.builder()).add(iface); } } }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void tryAddInterfaceToVlan( Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, NodeInterfacePair iface, @Nullable Integer vlan, IntegerSpace vlans) { if (vlan != null && vlans.contains(vlan)) { switchedVlanInterfaces.computeIfAbsent(vlan, v -> ImmutableSet.builder()).add(iface); } } SwitchedVlanPropertiesAnswerer(Question question, IBatfish batfish); }
SwitchedVlanPropertiesAnswerer extends Answerer { @VisibleForTesting static void tryAddInterfaceToVlan( Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, NodeInterfacePair iface, @Nullable Integer vlan, IntegerSpace vlans) { if (vlan != null && vlans.contains(vlan)) { switchedVlanInterfaces.computeIfAbsent(vlan, v -> ImmutableSet.builder()).add(iface); } } 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 tryAddInterfaceToVlan( Map<Integer, ImmutableSet.Builder<NodeInterfacePair>> switchedVlanInterfaces, NodeInterfacePair iface, @Nullable Integer vlan, IntegerSpace vlans) { if (vlan != null && vlans.contains(vlan)) { switchedVlanInterfaces.computeIfAbsent(vlan, v -> ImmutableSet.builder()).add(iface); } } 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);  }