@Override public Set<N> adjacentNodes(N node) { return delegate().adjacentNodes(node); }
@Override public Set<N> adjacentNodes(N node) { return delegate().adjacentNodes(node); }
@Override public Set<N> adjacentNodes(N node) { return delegate().adjacentNodes(node); }
private static <N, V> GraphConnections<N, V> connectionsOf( final ValueGraph<N, V> graph, final N node) { Function<N, V> successorNodeToValueFn = new Function<N, V>() { @Override public V apply(N successorNode) { return graph.edgeValueOrDefault(node, successorNode, null); } }; return graph.isDirected() ? DirectedGraphConnections.ofImmutable( graph.predecessors(node), Maps.asMap(graph.successors(node), successorNodeToValueFn)) : UndirectedGraphConnections.ofImmutable( Maps.asMap(graph.adjacentNodes(node), successorNodeToValueFn)); } }
private static <N, V> GraphConnections<N, V> connectionsOf( final ValueGraph<N, V> graph, final N node) { Function<N, V> successorNodeToValueFn = new Function<N, V>() { @Override public V apply(N successorNode) { return graph.edgeValueOrDefault(node, successorNode, null); } }; return graph.isDirected() ? DirectedGraphConnections.ofImmutable( graph.predecessors(node), Maps.asMap(graph.successors(node), successorNodeToValueFn)) : UndirectedGraphConnections.ofImmutable( Maps.asMap(graph.adjacentNodes(node), successorNodeToValueFn)); } }
private static <N, V> GraphConnections<N, V> connectionsOf( final ValueGraph<N, V> graph, final N node) { Function<N, V> successorNodeToValueFn = new Function<N, V>() { @Override public V apply(N successorNode) { return graph.edgeValueOrDefault(node, successorNode, null); } }; return graph.isDirected() ? DirectedGraphConnections.ofImmutable( graph.predecessors(node), Maps.asMap(graph.successors(node), successorNodeToValueFn)) : UndirectedGraphConnections.ofImmutable( Maps.asMap(graph.adjacentNodes(node), successorNodeToValueFn)); } }
@Override public Set<N> adjacentNodes(N node) { return delegate().adjacentNodes(node); }
@Override public Set<N> adjacentNodes(N node) { return delegate().adjacentNodes(node); }
static @Nonnull ConfiguredSessionStatus getConfiguredStatus( BgpPeerConfigId bgpPeerConfigId, BgpActivePeerConfig activePeerConfig, SessionType sessionType, Set<Ip> allInterfaceIps, ValueGraph<BgpPeerConfigId, BgpSessionProperties> configuredBgpTopology) { ConfiguredSessionStatus brokenStatus = getLocallyBrokenStatus(activePeerConfig, sessionType); if (brokenStatus != null) { return brokenStatus; } // Nothing blatantly broken so far on the local side, keep checking. Ip localIp = activePeerConfig.getLocalIp(); Ip remoteIp = activePeerConfig.getPeerAddress(); if (!allInterfaceIps.contains(localIp)) { return ConfiguredSessionStatus.INVALID_LOCAL_IP; } else if (!allInterfaceIps.contains(remoteIp)) { return ConfiguredSessionStatus.UNKNOWN_REMOTE; } else if (configuredBgpTopology.adjacentNodes(bgpPeerConfigId).isEmpty()) { return ConfiguredSessionStatus.HALF_OPEN; } else if (configuredBgpTopology.outDegree(bgpPeerConfigId) > 1) { return ConfiguredSessionStatus.MULTIPLE_REMOTES; } return ConfiguredSessionStatus.UNIQUE_MATCH; }
/** * Initialize incoming BGP message queues. * * @param bgpTopology source of truth for which sessions get established. */ void initBgpQueues(ValueGraph<BgpPeerConfigId, BgpSessionProperties> bgpTopology) { if (_vrf.getBgpProcess() == null) { _bgpIncomingRoutes = ImmutableSortedMap.of(); } else { _bgpIncomingRoutes = Stream.concat( _vrf.getBgpProcess().getActiveNeighbors().entrySet().stream() .map( e -> new BgpPeerConfigId( getHostname(), _vrf.getName(), e.getKey(), false)), _vrf.getBgpProcess().getPassiveNeighbors().entrySet().stream() .map( e -> new BgpPeerConfigId(getHostname(), _vrf.getName(), e.getKey(), true))) .filter(bgpTopology.nodes()::contains) .flatMap( dst -> bgpTopology.adjacentNodes(dst).stream().map(src -> new BgpEdgeId(src, dst))) .collect( toImmutableSortedMap(Function.identity(), e -> new ConcurrentLinkedQueue<>())); } }
"unexpected exception caused by bug in graph data structures"))); for (N adjacentNode : graph.adjacentNodes(node)) { if (!remainingNodes.contains(adjacentNode)) { continue;
tunnelIpsecEndpoints.add(tunnelEndPointU); for (IpsecPeerConfigId endPointV : ipsecTopology.adjacentNodes(endPointU)) { IpsecPeerConfig ipsecPeerV = networkConfigurations.getIpsecPeerConfig(endPointV);
configuredBgpTopology.adjacentNodes(neighbor), compatibleActivePeers);
configuredBgpTopology.adjacentNodes(neighbor); ? establishedBgpTopology.adjacentNodes(neighbor) : ImmutableSet.of();
private static <N, V> GraphConnections<N, V> connectionsOf( final ValueGraph<N, V> graph, final N node) { Function<N, V> successorNodeToValueFn = new Function<N, V>() { @Override public V apply(N successorNode) { return graph.edgeValueOrDefault(node, successorNode, null); } }; return graph.isDirected() ? DirectedGraphConnections.ofImmutable( graph.predecessors(node), Maps.asMap(graph.successors(node), successorNodeToValueFn)) : UndirectedGraphConnections.ofImmutable( Maps.asMap(graph.adjacentNodes(node), successorNodeToValueFn)); } }
private static <N, V> GraphConnections<N, V> connectionsOf( final ValueGraph<N, V> graph, final N node) { Function<N, V> successorNodeToValueFn = new Function<N, V>() { @Override public V apply(N successorNode) { return graph.edgeValueOrDefault(node, successorNode, null); } }; return graph.isDirected() ? DirectedGraphConnections.ofImmutable( graph.predecessors(node), Maps.asMap(graph.successors(node), successorNodeToValueFn)) : UndirectedGraphConnections.ofImmutable( Maps.asMap(graph.adjacentNodes(node), successorNodeToValueFn)); } }
ipsecSessionInfoBuilder.setInitiatorTunnelInterface(ipsecPeerConfig.getTunnelInterface()); Set<IpsecPeerConfigId> neighbors = ipsecTopology.adjacentNodes(node);
continue; if (bgpTopology.adjacentNodes(bgpPeerConfigId).isEmpty()) { bgpSessionInfo._status = SessionStatus.HALF_OPEN; } else { BgpPeerConfigId remoteNeighborId = bgpTopology.adjacentNodes(bgpPeerConfigId).iterator().next(); bgpSessionInfo._remoteNode = remoteNeighborId.getHostname(); bgpSessionInfo._status = SessionStatus.UNIQUE_MATCH;
private static @Nonnull Row buildActivePeerRow( BgpPeerConfigId activeId, BgpActivePeerConfig activePeer, SessionType type, ConfiguredSessionStatus status, Map<String, ColumnMetadata> metadataMap, ValueGraph<BgpPeerConfigId, BgpSessionProperties> bgpTopology, Map<String, Configuration> configurations) { Node remoteNode = null; if (status == UNIQUE_MATCH) { String remoteNodeName = bgpTopology.adjacentNodes(activeId).iterator().next().getHostname(); remoteNode = new Node(remoteNodeName); } Ip localIp = activePeer.getLocalIp(); NodeInterfacePair localInterface = getInterface(configurations.get(activeId.getHostname()), localIp); return Row.builder(metadataMap) .put(COL_CONFIGURED_STATUS, status) .put(COL_LOCAL_INTERFACE, localInterface) .put(COL_LOCAL_AS, activePeer.getLocalAs()) .put(COL_LOCAL_IP, activePeer.getLocalIp()) .put(COL_NODE, new Node(activeId.getHostname())) .put(COL_REMOTE_AS, new SelfDescribingObject(Schema.LONG, activePeer.getRemoteAs())) .put(COL_REMOTE_NODE, remoteNode) .put(COL_REMOTE_IP, new SelfDescribingObject(Schema.IP, activePeer.getPeerAddress())) .put(COL_SESSION_TYPE, type) .put(COL_VRF, activeId.getVrfName()) .build(); }
private static @Nonnull Row buildActivePeerRow( BgpPeerConfigId activeId, BgpActivePeerConfig activePeer, SessionType type, SessionStatus status, Map<String, ColumnMetadata> metadataMap, ValueGraph<BgpPeerConfigId, BgpSessionProperties> configuredBgpTopology, Map<String, Configuration> configurations) { Node remoteNode = null; if (status != NOT_COMPATIBLE) { String remoteNodeName = configuredBgpTopology.adjacentNodes(activeId).iterator().next().getHostname(); remoteNode = new Node(remoteNodeName); } Ip localIp = activePeer.getLocalIp(); NodeInterfacePair localInterface = getInterface(configurations.get(activeId.getHostname()), localIp); return Row.builder(metadataMap) .put(COL_ESTABLISHED_STATUS, status) .put(COL_LOCAL_INTERFACE, localInterface) .put(COL_LOCAL_AS, activePeer.getLocalAs()) .put(COL_LOCAL_IP, activePeer.getLocalIp()) .put(COL_NODE, new Node(activeId.getHostname())) .put(COL_REMOTE_AS, new SelfDescribingObject(Schema.LONG, activePeer.getRemoteAs())) .put(COL_REMOTE_NODE, remoteNode) .put(COL_REMOTE_IP, new SelfDescribingObject(Schema.IP, activePeer.getPeerAddress())) .put(COL_SESSION_TYPE, type) .put(COL_VRF, activeId.getVrfName()) .build(); }