@Test public void testLayer2ToRow() { Row row = layer2EdgeToRow(new Layer2Edge("host1", "int1", 1, "host2", "int2", 2, 12)); assertThat( row, allOf( hasColumn( COL_INTERFACE, equalTo(NodeInterfacePair.of("host1", "int1")), Schema.INTERFACE), hasColumn(COL_VLAN, equalTo("1"), Schema.STRING), hasColumn( COL_REMOTE_INTERFACE, equalTo(NodeInterfacePair.of("host2", "int2")), Schema.INTERFACE), hasColumn(COL_REMOTE_VLAN, equalTo("2"), Schema.STRING))); }
@VisibleForTesting static Row layer2EdgeToRow(Layer2Edge layer2Edge) { RowBuilder row = Row.builder(); row.put( COL_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode1().getHostname(), layer2Edge.getNode1().getInterfaceName())) .put(COL_VLAN, layer2Edge.getNode1().getSwitchportVlanId()) .put( COL_REMOTE_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode2().getHostname(), layer2Edge.getNode2().getInterfaceName())) .put(COL_REMOTE_VLAN, layer2Edge.getNode2().getSwitchportVlanId()); return row.build(); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row layer2EdgeToRow(Layer2Edge layer2Edge) { RowBuilder row = Row.builder(); row.put( COL_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode1().getHostname(), layer2Edge.getNode1().getInterfaceName())) .put(COL_VLAN, layer2Edge.getNode1().getSwitchportVlanId()) .put( COL_REMOTE_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode2().getHostname(), layer2Edge.getNode2().getInterfaceName())) .put(COL_REMOTE_VLAN, layer2Edge.getNode2().getSwitchportVlanId()); return row.build(); } }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row layer2EdgeToRow(Layer2Edge layer2Edge) { RowBuilder row = Row.builder(); row.put( COL_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode1().getHostname(), layer2Edge.getNode1().getInterfaceName())) .put(COL_VLAN, layer2Edge.getNode1().getSwitchportVlanId()) .put( COL_REMOTE_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode2().getHostname(), layer2Edge.getNode2().getInterfaceName())) .put(COL_REMOTE_VLAN, layer2Edge.getNode2().getSwitchportVlanId()); return row.build(); } EdgesAnswerer(Question question, IBatfish batfish); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row layer2EdgeToRow(Layer2Edge layer2Edge) { RowBuilder row = Row.builder(); row.put( COL_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode1().getHostname(), layer2Edge.getNode1().getInterfaceName())) .put(COL_VLAN, layer2Edge.getNode1().getSwitchportVlanId()) .put( COL_REMOTE_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode2().getHostname(), layer2Edge.getNode2().getInterfaceName())) .put(COL_REMOTE_VLAN, layer2Edge.getNode2().getSwitchportVlanId()); return row.build(); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row layer2EdgeToRow(Layer2Edge layer2Edge) { RowBuilder row = Row.builder(); row.put( COL_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode1().getHostname(), layer2Edge.getNode1().getInterfaceName())) .put(COL_VLAN, layer2Edge.getNode1().getSwitchportVlanId()) .put( COL_REMOTE_INTERFACE, NodeInterfacePair.of( layer2Edge.getNode2().getHostname(), layer2Edge.getNode2().getInterfaceName())) .put(COL_REMOTE_VLAN, layer2Edge.getNode2().getSwitchportVlanId()); return row.build(); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }