@Test public void testGetIfaceAddressesForIARoutes() { ConcreteInterfaceAddress primary = ConcreteInterfaceAddress.parse("1.1.1.0/24"); ConcreteInterfaceAddress secondary = ConcreteInterfaceAddress.parse("2.2.2.0/24"); Interface.Builder ifaceBuilder = Interface.builder().setName("iface").setAddresses(primary, secondary); assertThat( getIfaceAddressesForIntraAreaRoutes(ifaceBuilder.build()) .collect(ImmutableList.toImmutableList()), containsInAnyOrder(primary, secondary)); ConcreteInterfaceAddress primarySlash32 = ConcreteInterfaceAddress.create(primary.getIp(), 32); ConcreteInterfaceAddress secondarySlash32 = ConcreteInterfaceAddress.create(secondary.getIp(), 32); OspfInterfaceSettings.Builder ospfSettings = OspfInterfaceSettings.builder().setPassive(false); OspfInterfaceSettings p2mpOspf = ospfSettings.setNetworkType(OspfNetworkType.POINT_TO_MULTIPOINT).build(); Interface p2mpIface = ifaceBuilder.setOspfSettings(p2mpOspf).build(); assertThat( getIfaceAddressesForIntraAreaRoutes(p2mpIface).collect(ImmutableList.toImmutableList()), containsInAnyOrder(primarySlash32, secondarySlash32)); OspfInterfaceSettings broadcastOspf = ospfSettings.setNetworkType(OspfNetworkType.BROADCAST).build(); Interface loopback = ifaceBuilder.setType(InterfaceType.LOOPBACK).setOspfSettings(broadcastOspf).build(); assertThat( getIfaceAddressesForIntraAreaRoutes(loopback).collect(ImmutableList.toImmutableList()), containsInAnyOrder(primarySlash32, secondarySlash32)); OspfInterfaceSettings p2pOspf = ospfSettings.setNetworkType(OspfNetworkType.POINT_TO_POINT).build(); Interface p2pLoopback = ifaceBuilder.setOspfSettings(p2pOspf).build(); assertThat( getIfaceAddressesForIntraAreaRoutes(p2pLoopback).collect(ImmutableList.toImmutableList()), containsInAnyOrder(primary, secondary)); }
@VisibleForTesting static Stream<ConcreteInterfaceAddress> getIfaceAddressesForIntraAreaRoutes(Interface iface) { return (isLoopbackNotInP2PModeOrP2MP(iface) ? iface.getAllConcreteAddresses().stream() .map( ifaceAddr -> ConcreteInterfaceAddress.create(ifaceAddr.getIp(), Prefix.MAX_PREFIX_LENGTH)) : iface.getAllConcreteAddresses().stream()); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting static Stream<ConcreteInterfaceAddress> getIfaceAddressesForIntraAreaRoutes(Interface iface) { return (isLoopbackNotInP2PModeOrP2MP(iface) ? iface.getAllConcreteAddresses().stream() .map( ifaceAddr -> ConcreteInterfaceAddress.create(ifaceAddr.getIp(), Prefix.MAX_PREFIX_LENGTH)) : iface.getAllConcreteAddresses().stream()); } }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting static Stream<ConcreteInterfaceAddress> getIfaceAddressesForIntraAreaRoutes(Interface iface) { return (isLoopbackNotInP2PModeOrP2MP(iface) ? iface.getAllConcreteAddresses().stream() .map( ifaceAddr -> ConcreteInterfaceAddress.create(ifaceAddr.getIp(), Prefix.MAX_PREFIX_LENGTH)) : iface.getAllConcreteAddresses().stream()); } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting static Stream<ConcreteInterfaceAddress> getIfaceAddressesForIntraAreaRoutes(Interface iface) { return (isLoopbackNotInP2PModeOrP2MP(iface) ? iface.getAllConcreteAddresses().stream() .map( ifaceAddr -> ConcreteInterfaceAddress.create(ifaceAddr.getIp(), Prefix.MAX_PREFIX_LENGTH)) : iface.getAllConcreteAddresses().stream()); } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); @Override void initialize(Node n); @Override void executeIteration(Map<String, Node> allNodes); @Override void updateTopology(OspfTopology topology); @Nonnull @Override RibDelta<OspfRoute> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); @Override boolean isDirty(); }
OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute> { @VisibleForTesting static Stream<ConcreteInterfaceAddress> getIfaceAddressesForIntraAreaRoutes(Interface iface) { return (isLoopbackNotInP2PModeOrP2MP(iface) ? iface.getAllConcreteAddresses().stream() .map( ifaceAddr -> ConcreteInterfaceAddress.create(ifaceAddr.getIp(), Prefix.MAX_PREFIX_LENGTH)) : iface.getAllConcreteAddresses().stream()); } OspfRoutingProcess(
      OspfProcess process, String vrfName, Configuration configuration, OspfTopology topology); @Override void initialize(Node n); @Override void executeIteration(Map<String, Node> allNodes); @Override void updateTopology(OspfTopology topology); @Nonnull @Override RibDelta<OspfRoute> getUpdatesForMainRib(); @Override void redistribute(RibDelta<? extends AnnotatedRoute<AbstractRoute>> mainRibDelta); @Override boolean isDirty();  }