@Test public void getProperties() { Configuration conf1 = new Configuration("node1", ConfigurationFormat.CISCO_IOS); Interface iface1 = Interface.builder().setName("iface1").setOwner(conf1).build(); iface1.setDescription("desc desc desc"); iface1.setActive(false); Interface iface2 = Interface.builder().setName("iface2").setOwner(conf1).build(); iface2.setDescription("blah blah blah"); conf1.getAllInterfaces().putAll(ImmutableMap.of("iface1", iface1, "iface2", iface2)); String property1 = InterfacePropertySpecifier.DESCRIPTION; String property2 = InterfacePropertySpecifier.ACTIVE; InterfacePropertySpecifier propertySpecifier = new InterfacePropertySpecifier(ImmutableSet.of(property1, property2)); MockSpecifierContext ctxt = MockSpecifierContext.builder().setConfigs(ImmutableMap.of("node1", conf1)).build(); Multiset<Row> propertyRows = InterfacePropertiesAnswerer.getProperties( propertySpecifier, ctxt, new NameNodeSpecifier("node1"), new NameInterfaceSpecifier("iface1"), new TableMetadata( InterfacePropertiesAnswerer.createColumnMetadata(propertySpecifier), (String) null) .toColumnMap()); Row expectedRow = Row.builder() .put(InterfacePropertiesAnswerer.COL_INTERFACE, NodeInterfacePair.of("node1", "iface1")) .put(property2, false) .put(property1, "desc desc desc") .build(); assertThat(propertyRows, equalTo(ImmutableMultiset.of(expectedRow))); }
public static Multiset<Row> getProperties( InterfacePropertySpecifier propertySpecifier, SpecifierContext ctxt, NodeSpecifier nodeSpecifier, InterfaceSpecifier interfaceSpecifier, Map<String, ColumnMetadata> columns) { return getProperties( propertySpecifier, ctxt, nodeSpecifier, interfaceSpecifier, InterfacePropertiesQuestion.DEFAULT_EXCLUDE_SHUT_INTERFACES, columns); }
InterfacePropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( InterfacePropertySpecifier propertySpecifier, SpecifierContext ctxt, NodeSpecifier nodeSpecifier, InterfaceSpecifier interfaceSpecifier, Map<String, ColumnMetadata> columns) { return getProperties( propertySpecifier, ctxt, nodeSpecifier, interfaceSpecifier, InterfacePropertiesQuestion.DEFAULT_EXCLUDE_SHUT_INTERFACES, columns); } }
InterfacePropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( InterfacePropertySpecifier propertySpecifier, SpecifierContext ctxt, NodeSpecifier nodeSpecifier, InterfaceSpecifier interfaceSpecifier, Map<String, ColumnMetadata> columns) { return getProperties( propertySpecifier, ctxt, nodeSpecifier, interfaceSpecifier, InterfacePropertiesQuestion.DEFAULT_EXCLUDE_SHUT_INTERFACES, columns); } InterfacePropertiesAnswerer(Question question, IBatfish batfish); }
InterfacePropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( InterfacePropertySpecifier propertySpecifier, SpecifierContext ctxt, NodeSpecifier nodeSpecifier, InterfaceSpecifier interfaceSpecifier, Map<String, ColumnMetadata> columns) { return getProperties( propertySpecifier, ctxt, nodeSpecifier, interfaceSpecifier, InterfacePropertiesQuestion.DEFAULT_EXCLUDE_SHUT_INTERFACES, columns); } InterfacePropertiesAnswerer(Question question, IBatfish batfish); static List<ColumnMetadata> createColumnMetadata(
      InterfacePropertySpecifier propertySpecifier); @Override TableAnswerElement answer(NetworkSnapshot snapshot); static String getColumnName(String property); static Multiset<Row> getProperties(
      InterfacePropertySpecifier propertySpecifier,
      SpecifierContext ctxt,
      NodeSpecifier nodeSpecifier,
      InterfaceSpecifier interfaceSpecifier,
      Map<String, ColumnMetadata> columns); static Multiset<Row> getProperties(
      InterfacePropertySpecifier propertySpecifier,
      SpecifierContext ctxt,
      NodeSpecifier nodeSpecifier,
      InterfaceSpecifier interfaceSpecifier,
      boolean excludeShutInterfaces,
      Map<String, ColumnMetadata> columns); }
InterfacePropertiesAnswerer extends Answerer { public static Multiset<Row> getProperties( InterfacePropertySpecifier propertySpecifier, SpecifierContext ctxt, NodeSpecifier nodeSpecifier, InterfaceSpecifier interfaceSpecifier, Map<String, ColumnMetadata> columns) { return getProperties( propertySpecifier, ctxt, nodeSpecifier, interfaceSpecifier, InterfacePropertiesQuestion.DEFAULT_EXCLUDE_SHUT_INTERFACES, columns); } InterfacePropertiesAnswerer(Question question, IBatfish batfish); static List<ColumnMetadata> createColumnMetadata(
      InterfacePropertySpecifier propertySpecifier); @Override TableAnswerElement answer(NetworkSnapshot snapshot); static String getColumnName(String property); static Multiset<Row> getProperties(
      InterfacePropertySpecifier propertySpecifier,
      SpecifierContext ctxt,
      NodeSpecifier nodeSpecifier,
      InterfaceSpecifier interfaceSpecifier,
      Map<String, ColumnMetadata> columns); static Multiset<Row> getProperties(
      InterfacePropertySpecifier propertySpecifier,
      SpecifierContext ctxt,
      NodeSpecifier nodeSpecifier,
      InterfaceSpecifier interfaceSpecifier,
      boolean excludeShutInterfaces,
      Map<String, ColumnMetadata> columns); static final String COL_INTERFACE; }