/** @deprecated Use {@link #getTail()} */ @Deprecated @JsonIgnore @Nonnull public NodeInterfacePair getInterface1() { return getTail(); }
private void rebuildFromEdges() { _nodeEdges.clear(); _interfaceEdges.clear(); for (Edge edge : _edges) { String node1 = edge.getNode1(); String node2 = edge.getNode2(); NodeInterfacePair iface1 = edge.getTail(); NodeInterfacePair iface2 = edge.getHead(); _nodeEdges.computeIfAbsent(node1, k -> new TreeSet<>()).add(edge); _nodeEdges.computeIfAbsent(node2, k -> new TreeSet<>()).add(edge); _interfaceEdges.computeIfAbsent(iface1, k -> new TreeSet<>()).add(edge); _interfaceEdges.computeIfAbsent(iface2, k -> new TreeSet<>()).add(edge); } }
public Set<NodeInterfacePair> getNeighbors(NodeInterfacePair iface) { return getInterfaceEdges().getOrDefault(iface, ImmutableSortedSet.of()).stream() .filter(e -> e.getTail().equals(iface)) .map(Edge::getHead) .collect(ImmutableSet.toImmutableSet()); }
/** * Compute the layer 3 topology from the layer-2 topology and layer-3 information contained in the * configurations. */ public static @Nonnull Topology computeLayer3Topology( @Nonnull Layer2Topology layer2Topology, @Nonnull Map<String, Configuration> configurations) { return new Topology( synthesizeL3Topology(configurations).getEdges().stream() .filter(edge -> layer2Topology.inSameBroadcastDomain(edge.getHead(), edge.getTail())) .collect(ImmutableSortedSet.toImmutableSortedSet(Comparator.naturalOrder()))); }
@Test public void testGetterEquivalence() { assertThat(EDGE.getNode1(), equalTo(EDGE.getTail().getHostname())); assertThat(EDGE.getNode2(), equalTo(EDGE.getHead().getHostname())); assertThat(EDGE.getInt1(), equalTo(EDGE.getTail().getInterface())); assertThat(EDGE.getInt2(), equalTo(EDGE.getHead().getInterface())); }
NodeInterfacePair tail = edge.getTail(); NodeInterfacePair head = edge.getHead(); if ((tunnelIpsecEndpoints.contains(tail) || tunnelIpsecEndpoints.contains(head))