@JsonProperty(PROP_NODE2) public String getNode2() { return _head.getHostname(); }
@JsonProperty(PROP_NODE1) public String getNode1() { return _tail.getHostname(); }
/** Function that processes an interface blacklist across all configurations */ private static void processInterfaceBlacklist( Set<NodeInterfacePair> interfaceBlacklist, NetworkConfigurations configurations) { interfaceBlacklist.stream() .map(iface -> configurations.getInterface(iface.getHostname(), iface.getInterface())) .filter(Optional::isPresent) .map(Optional::get) .forEach(Interface::blacklist); }
/** * Return the representative of the broadcast domain of {@code nodeInterfacePair}, or {@link * Optional#empty} if not represented in the layer-2 topology. */ public @Nonnull Optional<Layer2Node> getBroadcastDomainRepresentative( NodeInterfacePair nodeInterfacePair) { return getBroadcastDomainRepresentative( nodeInterfacePair.getHostname(), nodeInterfacePair.getInterface()); }
/** Return whether the two interfaces are in the same broadcast domain. */ public boolean inSameBroadcastDomain(NodeInterfacePair i1, NodeInterfacePair i2) { return inSameBroadcastDomain( layer2Node(i1.getHostname(), i1.getInterface()), layer2Node(i2.getHostname(), i2.getInterface())); }
@Override public String toString() { return "<" + getTail().getHostname() + ":" + getTail().getInterface() + ", " + getHead().getHostname() + ":" + getHead().getInterface() + ">"; } }
receivers.forEach( receiver -> { String recvNode = receiver.getHostname(); String recvInterface = receiver.getInterface(); IpSpace recvReplies =
@Override protected boolean matchesSafely(NodeInterfacePair item, Description mismatchDescription) { Set<NodeInterfacePair> neighbors = _topology.getNeighbors(item); if (neighbors == null || neighbors.isEmpty()) { mismatchDescription.appendText( String.format( "%s has no neighbors in provided topology: %s", item, _topology.getEdges())); return false; } if (neighbors.stream().noneMatch(neighbor -> neighbor.getHostname().equals(_node))) { mismatchDescription.appendText( String.format("%s was not among the neighbors of %s: %s", _node, item, neighbors)); return false; } return true; } }
FlowDisposition disposition = computeDisposition( nextHopInterface.getHostname(), nextHopInterface.getInterface(), dstIp); FlowTrace trace = neighborUnreachableOrExitsNetworkTrace(
@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())); }
/** Returns {@code true} iff the given {@link Location} is active (aka, interface is up). */ @VisibleForTesting static boolean isActive(Location l, Map<String, Configuration> configs) { NodeInterfacePair iface; if (l instanceof InterfaceLocation) { iface = new NodeInterfacePair( ((InterfaceLocation) l).getNodeName(), ((InterfaceLocation) l).getInterfaceName()); } else { assert l instanceof InterfaceLinkLocation; iface = new NodeInterfacePair( ((InterfaceLinkLocation) l).getNodeName(), ((InterfaceLinkLocation) l).getInterfaceName()); } return configs .get(iface.getHostname()) .getAllInterfaces() .get(iface.getInterface()) .getActive(); }
String hostname = p.getHostname(); String ifaceName = p.getInterface(); Configuration node = configurations.get(hostname);
transmissionContext.branch( new NodeInterfacePair(currentNodeName, session.getOutgoingInterface()), session.getNextHop().getHostname()), postTransformationFlow, breadcrumbs);
return; Configuration nodeConfig = _configurations.get(nextHopInterface.getHostname()); Interface outgoingInterface = nodeConfig.getAllInterfaces().get(nextHopInterface.getInterface());