@Test public void testVxlanEdgeToRow() { NetworkConfigurations nc = buildVxlanNetworkConfigurations(); assertThat( vxlanEdgeToRow( nc, VxlanNode.builder().setHostname(VXLAN_NODE1).setVni(VXLAN_VNI).build(), VxlanNode.builder().setHostname(VXLAN_NODE2).setVni(VXLAN_VNI).build()), equalTo( Row.builder() .put(EdgesAnswerer.COL_VNI, VXLAN_VNI) .put(EdgesAnswerer.COL_NODE, new Node(VXLAN_NODE1)) .put(EdgesAnswerer.COL_REMOTE_NODE, new Node(VXLAN_NODE2)) .put(EdgesAnswerer.COL_VTEP_ADDRESS, VXLAN_SRC_IP1) .put(EdgesAnswerer.COL_REMOTE_VTEP_ADDRESS, VXLAN_SRC_IP2) .put(EdgesAnswerer.COL_VLAN, VXLAN_VLAN1) .put(EdgesAnswerer.COL_REMOTE_VLAN, VXLAN_VLAN2) .put(EdgesAnswerer.COL_UDP_PORT, VXLAN_UDP_PORT) .put(EdgesAnswerer.COL_MULTICAST_GROUP, VXLAN_MULTICAST_GROUP) .build())); }
@VisibleForTesting static Row vxlanEdgeToRow(NetworkConfigurations nc, VxlanNode node, VxlanNode remoteNode) { Layer2Vni node1Settings = nc.getVniSettings(node.getHostname(), node.getVni()).get(); Layer2Vni node2Settings = nc.getVniSettings(remoteNode.getHostname(), remoteNode.getVni()).get(); RowBuilder row = Row.builder(); row.put(COL_VNI, node.getVni()) .put(COL_NODE, new Node(node.getHostname())) .put(COL_REMOTE_NODE, new Node(remoteNode.getHostname())) .put(COL_VTEP_ADDRESS, node1Settings.getSourceAddress()) .put(COL_REMOTE_VTEP_ADDRESS, node2Settings.getSourceAddress()) .put(COL_VLAN, node1Settings.getVlan()) .put(COL_REMOTE_VLAN, node2Settings.getVlan()) .put(COL_UDP_PORT, node1Settings.getUdpPort()) .put(COL_MULTICAST_GROUP, node1Settings.getMulticastGroup()); return row.build(); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row vxlanEdgeToRow(NetworkConfigurations nc, VxlanNode node, VxlanNode remoteNode) { Layer2Vni node1Settings = nc.getVniSettings(node.getHostname(), node.getVni()).get(); Layer2Vni node2Settings = nc.getVniSettings(remoteNode.getHostname(), remoteNode.getVni()).get(); RowBuilder row = Row.builder(); row.put(COL_VNI, node.getVni()) .put(COL_NODE, new Node(node.getHostname())) .put(COL_REMOTE_NODE, new Node(remoteNode.getHostname())) .put(COL_VTEP_ADDRESS, node1Settings.getSourceAddress()) .put(COL_REMOTE_VTEP_ADDRESS, node2Settings.getSourceAddress()) .put(COL_VLAN, node1Settings.getVlan()) .put(COL_REMOTE_VLAN, node2Settings.getVlan()) .put(COL_UDP_PORT, node1Settings.getUdpPort()) .put(COL_MULTICAST_GROUP, node1Settings.getMulticastGroup()); return row.build(); } }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row vxlanEdgeToRow(NetworkConfigurations nc, VxlanNode node, VxlanNode remoteNode) { Layer2Vni node1Settings = nc.getVniSettings(node.getHostname(), node.getVni()).get(); Layer2Vni node2Settings = nc.getVniSettings(remoteNode.getHostname(), remoteNode.getVni()).get(); RowBuilder row = Row.builder(); row.put(COL_VNI, node.getVni()) .put(COL_NODE, new Node(node.getHostname())) .put(COL_REMOTE_NODE, new Node(remoteNode.getHostname())) .put(COL_VTEP_ADDRESS, node1Settings.getSourceAddress()) .put(COL_REMOTE_VTEP_ADDRESS, node2Settings.getSourceAddress()) .put(COL_VLAN, node1Settings.getVlan()) .put(COL_REMOTE_VLAN, node2Settings.getVlan()) .put(COL_UDP_PORT, node1Settings.getUdpPort()) .put(COL_MULTICAST_GROUP, node1Settings.getMulticastGroup()); return row.build(); } EdgesAnswerer(Question question, IBatfish batfish); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row vxlanEdgeToRow(NetworkConfigurations nc, VxlanNode node, VxlanNode remoteNode) { Layer2Vni node1Settings = nc.getVniSettings(node.getHostname(), node.getVni()).get(); Layer2Vni node2Settings = nc.getVniSettings(remoteNode.getHostname(), remoteNode.getVni()).get(); RowBuilder row = Row.builder(); row.put(COL_VNI, node.getVni()) .put(COL_NODE, new Node(node.getHostname())) .put(COL_REMOTE_NODE, new Node(remoteNode.getHostname())) .put(COL_VTEP_ADDRESS, node1Settings.getSourceAddress()) .put(COL_REMOTE_VTEP_ADDRESS, node2Settings.getSourceAddress()) .put(COL_VLAN, node1Settings.getVlan()) .put(COL_REMOTE_VLAN, node2Settings.getVlan()) .put(COL_UDP_PORT, node1Settings.getUdpPort()) .put(COL_MULTICAST_GROUP, node1Settings.getMulticastGroup()); return row.build(); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
EdgesAnswerer extends Answerer { @VisibleForTesting static Row vxlanEdgeToRow(NetworkConfigurations nc, VxlanNode node, VxlanNode remoteNode) { Layer2Vni node1Settings = nc.getVniSettings(node.getHostname(), node.getVni()).get(); Layer2Vni node2Settings = nc.getVniSettings(remoteNode.getHostname(), remoteNode.getVni()).get(); RowBuilder row = Row.builder(); row.put(COL_VNI, node.getVni()) .put(COL_NODE, new Node(node.getHostname())) .put(COL_REMOTE_NODE, new Node(remoteNode.getHostname())) .put(COL_VTEP_ADDRESS, node1Settings.getSourceAddress()) .put(COL_REMOTE_VTEP_ADDRESS, node2Settings.getSourceAddress()) .put(COL_VLAN, node1Settings.getVlan()) .put(COL_REMOTE_VLAN, node2Settings.getVlan()) .put(COL_UDP_PORT, node1Settings.getUdpPort()) .put(COL_MULTICAST_GROUP, node1Settings.getMulticastGroup()); return row.build(); } EdgesAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }