@Test public void testComputeArpReplies_VRRP() { Configuration c = _cb.build(); Map<String, Configuration> configs = ImmutableMap.of(c.getHostname(), c); _ib.setOwner(c); Vrf vrf1 = _vb.build(); Vrf vrf2 = _vb.build(); Interface i1 = _ib.setVrf(vrf1) .setAddress(ConcreteInterfaceAddress.create(P1.getStartIp(), P1.getPrefixLength())) .setVrrpGroups( ImmutableSortedMap.of( 1, VrrpGroup.builder() .setName(1) .setPriority(100) .setVirtualAddress(ConcreteInterfaceAddress.parse("1.1.1.1/32")) .build())) .build(); Interface i2 = _ib.setVrf(vrf2) .setAddress(ConcreteInterfaceAddress.create(P1.getEndIp(), P1.getPrefixLength())) .setVrrpGroups( ImmutableSortedMap.of( 1, VrrpGroup.builder() .setName(1) .setPriority(110) .setVirtualAddress(ConcreteInterfaceAddress.parse("1.1.1.1/32")) .build())) .build(); Map<String, Map<String, Set<Ip>>> interfaceOwnedIps = IpOwners.computeInterfaceOwnedIps(configs, false); IpSpace p1IpSpace = IpWildcard.create(P1).toIpSpace(); IpSpace i1ArpReplies = computeInterfaceArpReplies(i1, UniverseIpSpace.INSTANCE, p1IpSpace, interfaceOwnedIps); IpSpace i2ArpReplies = computeInterfaceArpReplies(i2, UniverseIpSpace.INSTANCE, p1IpSpace, interfaceOwnedIps); assertThat(i1ArpReplies, not(containsIp(Ip.parse("1.1.1.1")))); assertThat(i2ArpReplies, containsIp(Ip.parse("1.1.1.1"))); }
@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();  }