@Test public void testComputeOspfProcess_NoArea() { CumulusNcluConfiguration ncluConfiguration = new CumulusNcluConfiguration(); Interface vsIface = new Interface("iface", CumulusInterfaceType.PHYSICAL, null, null); ncluConfiguration.getInterfaces().put("iface", vsIface); vsIface.getOrCreateOspf(); SortedMap<Long, OspfArea> areas = computeOspfAreas(ncluConfiguration, ImmutableList.of("iface")); assertThat(areas, equalTo(ImmutableSortedMap.of())); }
@VisibleForTesting static SortedMap<Long, OspfArea> computeOspfAreas( CumulusNodeConfiguration vsConfig, Collection<String> vrfIfaceNames) { Map<Long, List<String>> areaInterfaces = vrfIfaceNames.stream() .filter( iface -> { Optional<OspfInterface> ospfOpt = vsConfig.getOspfInterface(iface); return ospfOpt.isPresent() && ospfOpt.get().getOspfArea() != null; }) .collect( groupingBy( iface -> vsConfig.getOspfInterface(iface).get().getOspfArea(), mapping(Function.identity(), Collectors.toList()))); return toImmutableSortedMap( areaInterfaces, Entry::getKey, e -> OspfArea.builder().setNumber(e.getKey()).addInterfaces(e.getValue()).build()); }
CumulusConversions { @VisibleForTesting static SortedMap<Long, OspfArea> computeOspfAreas( CumulusNodeConfiguration vsConfig, Collection<String> vrfIfaceNames) { Map<Long, List<String>> areaInterfaces = vrfIfaceNames.stream() .filter( iface -> { Optional<OspfInterface> ospfOpt = vsConfig.getOspfInterface(iface); return ospfOpt.isPresent() && ospfOpt.get().getOspfArea() != null; }) .collect( groupingBy( iface -> vsConfig.getOspfInterface(iface).get().getOspfArea(), mapping(Function.identity(), Collectors.toList()))); return toImmutableSortedMap( areaInterfaces, Entry::getKey, e -> OspfArea.builder().setNumber(e.getKey()).addInterfaces(e.getValue()).build()); } }
CumulusConversions { @VisibleForTesting static SortedMap<Long, OspfArea> computeOspfAreas( CumulusNodeConfiguration vsConfig, Collection<String> vrfIfaceNames) { Map<Long, List<String>> areaInterfaces = vrfIfaceNames.stream() .filter( iface -> { Optional<OspfInterface> ospfOpt = vsConfig.getOspfInterface(iface); return ospfOpt.isPresent() && ospfOpt.get().getOspfArea() != null; }) .collect( groupingBy( iface -> vsConfig.getOspfInterface(iface).get().getOspfArea(), mapping(Function.identity(), Collectors.toList()))); return toImmutableSortedMap( areaInterfaces, Entry::getKey, e -> OspfArea.builder().setNumber(e.getKey()).addInterfaces(e.getValue()).build()); }  }
CumulusConversions { @VisibleForTesting static SortedMap<Long, OspfArea> computeOspfAreas( CumulusNodeConfiguration vsConfig, Collection<String> vrfIfaceNames) { Map<Long, List<String>> areaInterfaces = vrfIfaceNames.stream() .filter( iface -> { Optional<OspfInterface> ospfOpt = vsConfig.getOspfInterface(iface); return ospfOpt.isPresent() && ospfOpt.get().getOspfArea() != null; }) .collect( groupingBy( iface -> vsConfig.getOspfInterface(iface).get().getOspfArea(), mapping(Function.identity(), Collectors.toList()))); return toImmutableSortedMap( areaInterfaces, Entry::getKey, e -> OspfArea.builder().setNumber(e.getKey()).addInterfaces(e.getValue()).build()); }  static @Nonnull String computeBgpCommonExportPolicyName(String vrfName); @VisibleForTesting static @Nonnull String computeBgpPeerExportPolicyName(
      String vrfName, String peerInterface); static @Nonnull String computeBgpPeerImportPolicyName(String vrf, String peer); static String computeBgpGenerationPolicyName(boolean ipv4, String vrfName, String prefix); static String computeMatchSuppressedSummaryOnlyPolicyName(String vrfName); static String computeOspfExportPolicyName(String vrfName); }
CumulusConversions { @VisibleForTesting static SortedMap<Long, OspfArea> computeOspfAreas( CumulusNodeConfiguration vsConfig, Collection<String> vrfIfaceNames) { Map<Long, List<String>> areaInterfaces = vrfIfaceNames.stream() .filter( iface -> { Optional<OspfInterface> ospfOpt = vsConfig.getOspfInterface(iface); return ospfOpt.isPresent() && ospfOpt.get().getOspfArea() != null; }) .collect( groupingBy( iface -> vsConfig.getOspfInterface(iface).get().getOspfArea(), mapping(Function.identity(), Collectors.toList()))); return toImmutableSortedMap( areaInterfaces, Entry::getKey, e -> OspfArea.builder().setNumber(e.getKey()).addInterfaces(e.getValue()).build()); }  static @Nonnull String computeBgpCommonExportPolicyName(String vrfName); @VisibleForTesting static @Nonnull String computeBgpPeerExportPolicyName(
      String vrfName, String peerInterface); static @Nonnull String computeBgpPeerImportPolicyName(String vrf, String peer); static String computeBgpGenerationPolicyName(boolean ipv4, String vrfName, String prefix); static String computeMatchSuppressedSummaryOnlyPolicyName(String vrfName); static String computeOspfExportPolicyName(String vrfName); static final int DEFAULT_STATIC_ROUTE_ADMINISTRATIVE_DISTANCE; static final int DEFAULT_STATIC_ROUTE_METRIC; static final Ip CLAG_LINK_LOCAL_IP; static final long DEFAULT_MAX_MED; static final double SPEED_CONVERSION_FACTOR; static final double DEFAULT_LOOPBACK_BANDWIDTH; static final double DEFAULT_PORT_BANDWIDTH; }