public Set<VxlanEdge> getEdges() { return ImmutableSet.copyOf(_graph.edges()); } }
@JsonProperty(PROP_EDGES) private SortedSet<Layer3Edge> getJsonEdges() { return ImmutableSortedSet.copyOf(_graph.edges()); }
@JsonProperty(PROP_EDGES) private SortedSet<Layer1Edge> getJsonEdges() { return ImmutableSortedSet.copyOf(_graph.edges()); }
@VisibleForTesting static Multiset<Row> getLayer1Edges( Set<String> includeNodes, Set<String> includeRemoteNodes, @Nullable Layer1Topology layer1Topology) { if (layer1Topology == null) { return HashMultiset.create(); } return layer1Topology.getGraph().edges().stream() .filter( layer1Edge -> includeNodes.contains(layer1Edge.getNode1().getHostname()) && includeRemoteNodes.contains(layer1Edge.getNode2().getHostname())) .map(EdgesAnswerer::layer1EdgeToRow) .collect(Collectors.toCollection(HashMultiset::create)); }
public static Layer1Topology computeLayer1LogicalTopology( Layer1Topology layer1PhysicalTopology, Map<String, Configuration> configurations) { return new Layer1Topology( layer1PhysicalTopology.getGraph().edges().stream() .map(pEdge -> pEdge.toLogicalEdge(NetworkConfigurations.of(configurations))) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet())); } }
/** * Compute the layer-2 topology via the {@code layer1LogicalTopology} and switching information * contained in the {@code configurations}. */ public static @Nonnull Layer2Topology computeLayer2Topology( @Nonnull Layer1Topology layer1LogicalTopology, @Nonnull Map<String, Configuration> configurations) { ImmutableSet.Builder<Layer2Edge> edges = ImmutableSet.builder(); // Compute mapping from parent interface -> child interfaces Map<Layer1Node, Set<Layer1Node>> parentChildrenMap = computeParentChildrenMap(configurations); // First add layer2 edges for physical links. layer1LogicalTopology .getGraph() .edges() .forEach( layer1Edge -> computeLayer2EdgesForLayer1Edge( layer1Edge, configurations, edges, parentChildrenMap)); // Then add edges within each node to connect switchports on the same VLAN(s). configurations .values() .forEach( c -> c.getVrfs() .values() .forEach(vrf -> computeLayer2SelfEdges(c.getHostname(), vrf, edges))); return Layer2Topology.fromEdges(edges.build()); }
public static @Nonnull Layer1Topology computeLayer1PhysicalTopology( @Nonnull Layer1Topology rawLayer1Topology, @Nonnull Map<String, Configuration> configurations) { /* Filter out inactive interfaces */ return new Layer1Topology( rawLayer1Topology.getGraph().edges().stream() .filter( edge -> { Interface i1 = getInterface(edge.getNode1(), configurations); Interface i2 = getInterface(edge.getNode2(), configurations); return i1 != null && i2 != null && i1.getActive() && i2.getActive(); }) .collect(ImmutableSet.toImmutableSet())); }
@Override public void visitGraph(BindingGraph bindingGraph, DiagnosticReporter diagnosticReporter) { if (bindingGraph.isModuleBindingGraph() || bindingGraph.isPartialBindingGraph()) { // We don't know all the modules that might be owned by the child until we know the root. return; } bindingGraph.network().edges().stream() .flatMap(instancesOf(ChildFactoryMethodEdge.class)) .forEach( edge -> { ImmutableSet<TypeElement> missingModules = findMissingModules(edge, bindingGraph); if (!missingModules.isEmpty()) { reportMissingModuleParameters( edge, missingModules, bindingGraph, diagnosticReporter); } }); }
TopologyUtil.computeLayer1PhysicalTopology(rawLayer1Topology, configurations) .getGraph() .edges(), containsInAnyOrder( new Layer1Edge(new Layer1Node(c1Name, c1i1Name), new Layer1Node(c2Name, c2i1Name)),
TopologyUtil.computeLayer1LogicalTopology(layer1PhysicalTopology, configurations) .getGraph() .edges(), containsInAnyOrder( new Layer1Edge(new Layer1Node(c1Name, c1a1Name), new Layer1Node(c2Name, c2a1Name)),