@Test public void testComputeInterfaceArpReplies() { Configuration config = _cb.build(); _ib.setOwner(config); ConcreteInterfaceAddress primary = ConcreteInterfaceAddress.create(P1.getStartIp(), P1.getPrefixLength()); ConcreteInterfaceAddress secondary = ConcreteInterfaceAddress.create(P2.getStartIp(), P2.getPrefixLength()); Interface iNoProxyArp = _ib.setAddresses(primary, secondary).build(); Interface iProxyArp = _ib.setProxyArp(true).build(); IpSpace routableIpsForThisVrf = UniverseIpSpace.INSTANCE; IpSpace ipsRoutedThroughInterface = IpWildcardSetIpSpace.builder() .including(IpWildcard.create(P1), IpWildcard.create(P2)) .build(); Map<String, Map<String, Set<Ip>>> interfaceOwnedIps = IpOwners.computeInterfaceOwnedIps(ImmutableMap.of(config.getHostname(), config), false); IpSpace noProxyArpResult = computeInterfaceArpReplies( iNoProxyArp, routableIpsForThisVrf, ipsRoutedThroughInterface, interfaceOwnedIps); IpSpace proxyArpResult = computeInterfaceArpReplies( iProxyArp, routableIpsForThisVrf, ipsRoutedThroughInterface, interfaceOwnedIps); assertThat(noProxyArpResult, containsIp(P1.getStartIp())); assertThat(noProxyArpResult, containsIp(P2.getStartIp())); assertThat(noProxyArpResult, not(containsIp(P1.getEndIp()))); assertThat(noProxyArpResult, not(containsIp(P2.getEndIp()))); assertThat(noProxyArpResult, not(containsIp(P3.getStartIp()))); assertThat(proxyArpResult, containsIp(P1.getStartIp())); assertThat(proxyArpResult, containsIp(P2.getStartIp())); assertThat(proxyArpResult, not(containsIp(P1.getEndIp()))); assertThat(proxyArpResult, not(containsIp(P2.getEndIp()))); assertThat(proxyArpResult, containsIp(P3.getStartIp())); }
@VisibleForTesting static IpSpace computeInterfaceArpReplies( @Nonnull Interface iface, @Nonnull IpSpace routableIpsForThisVrf, @Nonnull IpSpace ipsRoutedThroughInterface, @Nonnull Map<String, Map<String, Set<Ip>>> interfaceOwnedIps) { IpSpace ipsAssignedToThisInterface = computeIpsAssignedToThisInterfaceForArpReplies(iface, interfaceOwnedIps); if (ipsAssignedToThisInterface == EmptyIpSpace.INSTANCE) { return EmptyIpSpace.INSTANCE; } AclIpSpace.Builder interfaceArpReplies = AclIpSpace.permitting(ipsAssignedToThisInterface); interfaceArpReplies.thenPermitting(iface.getAdditionalArpIps()); if (iface.getProxyArp()) { interfaceArpReplies.thenRejecting(ipsRoutedThroughInterface); interfaceArpReplies.thenPermitting(routableIpsForThisVrf); } return interfaceArpReplies.build(); }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static IpSpace computeInterfaceArpReplies( @Nonnull Interface iface, @Nonnull IpSpace routableIpsForThisVrf, @Nonnull IpSpace ipsRoutedThroughInterface, @Nonnull Map<String, Map<String, Set<Ip>>> interfaceOwnedIps) { IpSpace ipsAssignedToThisInterface = computeIpsAssignedToThisInterfaceForArpReplies(iface, interfaceOwnedIps); if (ipsAssignedToThisInterface == EmptyIpSpace.INSTANCE) { return EmptyIpSpace.INSTANCE; } AclIpSpace.Builder interfaceArpReplies = AclIpSpace.permitting(ipsAssignedToThisInterface); interfaceArpReplies.thenPermitting(iface.getAdditionalArpIps()); if (iface.getProxyArp()) { interfaceArpReplies.thenRejecting(ipsRoutedThroughInterface); interfaceArpReplies.thenPermitting(routableIpsForThisVrf); } return interfaceArpReplies.build(); } }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static IpSpace computeInterfaceArpReplies( @Nonnull Interface iface, @Nonnull IpSpace routableIpsForThisVrf, @Nonnull IpSpace ipsRoutedThroughInterface, @Nonnull Map<String, Map<String, Set<Ip>>> interfaceOwnedIps) { IpSpace ipsAssignedToThisInterface = computeIpsAssignedToThisInterfaceForArpReplies(iface, interfaceOwnedIps); if (ipsAssignedToThisInterface == EmptyIpSpace.INSTANCE) { return EmptyIpSpace.INSTANCE; } AclIpSpace.Builder interfaceArpReplies = AclIpSpace.permitting(ipsAssignedToThisInterface); interfaceArpReplies.thenPermitting(iface.getAdditionalArpIps()); if (iface.getProxyArp()) { interfaceArpReplies.thenRejecting(ipsRoutedThroughInterface); interfaceArpReplies.thenPermitting(routableIpsForThisVrf); } return interfaceArpReplies.build(); } ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo); }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static IpSpace computeInterfaceArpReplies( @Nonnull Interface iface, @Nonnull IpSpace routableIpsForThisVrf, @Nonnull IpSpace ipsRoutedThroughInterface, @Nonnull Map<String, Map<String, Set<Ip>>> interfaceOwnedIps) { IpSpace ipsAssignedToThisInterface = computeIpsAssignedToThisInterfaceForArpReplies(iface, interfaceOwnedIps); if (ipsAssignedToThisInterface == EmptyIpSpace.INSTANCE) { return EmptyIpSpace.INSTANCE; } AclIpSpace.Builder interfaceArpReplies = AclIpSpace.permitting(ipsAssignedToThisInterface); interfaceArpReplies.thenPermitting(iface.getAdditionalArpIps()); if (iface.getProxyArp()) { interfaceArpReplies.thenRejecting(ipsRoutedThroughInterface); interfaceArpReplies.thenPermitting(routableIpsForThisVrf); } return interfaceArpReplies.build(); } ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo); @Nonnull @Override Map<String, Map<String, Map<String, IpSpace>>> getAcceptsIps(); @Override Map<String, Map<String, IpSpace>> getArpReplies(); @Override Map<String, Map<String, Map<Edge, IpSpace>>> getArpTrueEdge(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNextVrfIps(); @Override Map<String, Map<String, IpSpace>> getNullRoutedIps(); @Override Map<String, Map<String, IpSpace>> getRoutableIps(); @Override Map<String, Map<String, Map<String, IpSpace>>> getDeliveredToSubnet(); @Override Map<String, Map<String, Map<String, IpSpace>>> getExitsNetwork(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNeighborUnreachable(); @Override Map<String, Map<String, Map<String, IpSpace>>> getInsufficientInfo(); }
ForwardingAnalysisImpl implements ForwardingAnalysis, Serializable { @VisibleForTesting static IpSpace computeInterfaceArpReplies( @Nonnull Interface iface, @Nonnull IpSpace routableIpsForThisVrf, @Nonnull IpSpace ipsRoutedThroughInterface, @Nonnull Map<String, Map<String, Set<Ip>>> interfaceOwnedIps) { IpSpace ipsAssignedToThisInterface = computeIpsAssignedToThisInterfaceForArpReplies(iface, interfaceOwnedIps); if (ipsAssignedToThisInterface == EmptyIpSpace.INSTANCE) { return EmptyIpSpace.INSTANCE; } AclIpSpace.Builder interfaceArpReplies = AclIpSpace.permitting(ipsAssignedToThisInterface); interfaceArpReplies.thenPermitting(iface.getAdditionalArpIps()); if (iface.getProxyArp()) { interfaceArpReplies.thenRejecting(ipsRoutedThroughInterface); interfaceArpReplies.thenPermitting(routableIpsForThisVrf); } return interfaceArpReplies.build(); } ForwardingAnalysisImpl(
      Map<String, Configuration> configurations,
      Map<String, Map<String, Fib>> fibs,
      Topology topology,
      Map<Location, LocationInfo> locationInfo); @Nonnull @Override Map<String, Map<String, Map<String, IpSpace>>> getAcceptsIps(); @Override Map<String, Map<String, IpSpace>> getArpReplies(); @Override Map<String, Map<String, Map<Edge, IpSpace>>> getArpTrueEdge(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNextVrfIps(); @Override Map<String, Map<String, IpSpace>> getNullRoutedIps(); @Override Map<String, Map<String, IpSpace>> getRoutableIps(); @Override Map<String, Map<String, Map<String, IpSpace>>> getDeliveredToSubnet(); @Override Map<String, Map<String, Map<String, IpSpace>>> getExitsNetwork(); @Override Map<String, Map<String, Map<String, IpSpace>>> getNeighborUnreachable(); @Override Map<String, Map<String, Map<String, IpSpace>>> getInsufficientInfo();  }