@Test public void testComputeInterfaceCost() { Interface.Builder ib = Interface.builder() .setName("eth0") .setBandwidth(1e3) .setOwner(new Configuration("r1", ConfigurationFormat.CISCO_IOS)); Interface i = ib.build(); int cost = OspfProcess.computeInterfaceCost(1.0, i); assertThat(cost, equalTo(1)); cost = OspfProcess.computeInterfaceCost(1e6, i); assertThat(cost, equalTo(1000)); _thrown.expectMessage("Interface eth0 on r1 is missing bandwidth"); _thrown.expect(IllegalStateException.class); OspfProcess.computeInterfaceCost(1e6, ib.setBandwidth(null).build()); }
public int computeInterfaceCost(Interface i) { return computeInterfaceCost(_referenceBandwidth, i); }
OspfProcess implements Serializable { public int computeInterfaceCost(Interface i) { return computeInterfaceCost(_referenceBandwidth, i); } }
OspfProcess implements Serializable { public int computeInterfaceCost(Interface i) { return computeInterfaceCost(_referenceBandwidth, i); } private  OspfProcess(
      Map<RoutingProtocol, Integer> adminCosts,
      Map<Long, OspfArea> areas,
      @Nullable String exportPolicy,
      Set<String> exportPolicySources,
      Set<GeneratedRoute> generatedRoutes,
      @Nullable Long maxMetricExternalNetworks,
      @Nullable Long maxMetricStubNetworks,
      @Nullable Long maxMetricSummaryNetworks,
      @Nullable Long maxMetricTransitLinks,
      Map<OspfNeighborConfigId, OspfNeighborConfig> ospfNeighborConfigs,
      String processId,
      Double referenceBandwidth,
      @Nullable Boolean rfc1583Compatible,
      Ip routerId,
      Integer summaryAdminCost); }
OspfProcess implements Serializable { public int computeInterfaceCost(Interface i) { return computeInterfaceCost(_referenceBandwidth, i); } private  OspfProcess(
      Map<RoutingProtocol, Integer> adminCosts,
      Map<Long, OspfArea> areas,
      @Nullable String exportPolicy,
      Set<String> exportPolicySources,
      Set<GeneratedRoute> generatedRoutes,
      @Nullable Long maxMetricExternalNetworks,
      @Nullable Long maxMetricStubNetworks,
      @Nullable Long maxMetricSummaryNetworks,
      @Nullable Long maxMetricTransitLinks,
      Map<OspfNeighborConfigId, OspfNeighborConfig> ospfNeighborConfigs,
      String processId,
      Double referenceBandwidth,
      @Nullable Boolean rfc1583Compatible,
      Ip routerId,
      Integer summaryAdminCost); static @Nonnull Builder builder(@Nullable Supplier<String> processIdGenerator); static @Nonnull Builder builder(); static Map<RoutingProtocol, Integer> computeDefaultAdminCosts(ConfigurationFormat format); int computeInterfaceCost(Interface i); @Nonnull @JsonIgnore Map<RoutingProtocol, Integer> getAdminCosts(); @Nonnull @JsonIgnore Map<Long, OspfArea> getAreas(); @JsonProperty(PROP_EXPORT_POLICY) @Nullable String getExportPolicy(); @Nonnull @JsonIgnore Set<String> getExportPolicySources(); @Nonnull @JsonIgnore Set<GeneratedRoute> getGeneratedRoutes(); @Nullable @JsonProperty(PROP_MAX_METRIC_EXTERNAL_NETWORKS) Long getMaxMetricExternalNetworks(); @Nullable @JsonProperty(PROP_MAX_METRIC_STUB_NETWORKS) Long getMaxMetricStubNetworks(); @Nullable @JsonProperty(PROP_MAX_METRIC_SUMMARY_NETWORKS) Long getMaxMetricSummaryNetworks(); @Nullable @JsonProperty(PROP_MAX_METRIC_TRANSIT_LINKS) Long getMaxMetricTransitLinks(); @JsonIgnore Map<IpLink, OspfNeighbor> getOspfNeighbors(); @JsonIgnore Map<OspfNeighborConfigId, OspfNeighborConfig> getOspfNeighborConfigs(); @Nonnull @JsonProperty(PROP_PROCESS_ID) String getProcessId(); @Nonnull @JsonProperty(PROP_REFERENCE_BANDWIDTH) Double getReferenceBandwidth(); @Nullable @JsonProperty(PROP_RFC1583) Boolean getRfc1583Compatible(); @Nonnull @JsonProperty(PROP_ROUTER_ID) Ip getRouterId(); int getSummaryAdminCost(); void initInterfaceCosts(Configuration c); @JsonIgnore boolean isAreaBorderRouter(); @JsonIgnore void setAreas(Map<Long, OspfArea> areas); void addArea(OspfArea area); @JsonIgnore void setExportPolicy(@Nullable String exportPolicy); @JsonIgnore void setExportPolicySources(SortedSet<String> exportPolicySources); @JsonIgnore void setGeneratedRoutes(SortedSet<GeneratedRoute> generatedRoutes); void addGeneratedRoute(GeneratedRoute route); @JsonIgnore void setMaxMetricExternalNetworks(@Nullable Long maxMetricExternalNetworks); @JsonIgnore void setMaxMetricStubNetworks(@Nullable Long maxMetricStubNetworks); @JsonIgnore void setMaxMetricSummaryNetworks(@Nullable Long maxMetricSummaryNetworks); @JsonIgnore void setMaxMetricTransitLinks(@Nullable Long maxMetricTransitLinks); @JsonIgnore void setOspfNeighbors(Map<IpLink, OspfNeighbor> ospfNeighbors); @JsonIgnore void setReferenceBandwidth(Double referenceBandwidth); @JsonIgnore void setRfc1583Compatible(@Nullable Boolean rfc1583Compatible); @JsonIgnore void setRouterId(@Nonnull Ip id); }
OspfProcess implements Serializable { public int computeInterfaceCost(Interface i) { return computeInterfaceCost(_referenceBandwidth, i); } private  OspfProcess(
      Map<RoutingProtocol, Integer> adminCosts,
      Map<Long, OspfArea> areas,
      @Nullable String exportPolicy,
      Set<String> exportPolicySources,
      Set<GeneratedRoute> generatedRoutes,
      @Nullable Long maxMetricExternalNetworks,
      @Nullable Long maxMetricStubNetworks,
      @Nullable Long maxMetricSummaryNetworks,
      @Nullable Long maxMetricTransitLinks,
      Map<OspfNeighborConfigId, OspfNeighborConfig> ospfNeighborConfigs,
      String processId,
      Double referenceBandwidth,
      @Nullable Boolean rfc1583Compatible,
      Ip routerId,
      Integer summaryAdminCost); static @Nonnull Builder builder(@Nullable Supplier<String> processIdGenerator); static @Nonnull Builder builder(); static Map<RoutingProtocol, Integer> computeDefaultAdminCosts(ConfigurationFormat format); int computeInterfaceCost(Interface i); @Nonnull @JsonIgnore Map<RoutingProtocol, Integer> getAdminCosts(); @Nonnull @JsonIgnore Map<Long, OspfArea> getAreas(); @JsonProperty(PROP_EXPORT_POLICY) @Nullable String getExportPolicy(); @Nonnull @JsonIgnore Set<String> getExportPolicySources(); @Nonnull @JsonIgnore Set<GeneratedRoute> getGeneratedRoutes(); @Nullable @JsonProperty(PROP_MAX_METRIC_EXTERNAL_NETWORKS) Long getMaxMetricExternalNetworks(); @Nullable @JsonProperty(PROP_MAX_METRIC_STUB_NETWORKS) Long getMaxMetricStubNetworks(); @Nullable @JsonProperty(PROP_MAX_METRIC_SUMMARY_NETWORKS) Long getMaxMetricSummaryNetworks(); @Nullable @JsonProperty(PROP_MAX_METRIC_TRANSIT_LINKS) Long getMaxMetricTransitLinks(); @JsonIgnore Map<IpLink, OspfNeighbor> getOspfNeighbors(); @JsonIgnore Map<OspfNeighborConfigId, OspfNeighborConfig> getOspfNeighborConfigs(); @Nonnull @JsonProperty(PROP_PROCESS_ID) String getProcessId(); @Nonnull @JsonProperty(PROP_REFERENCE_BANDWIDTH) Double getReferenceBandwidth(); @Nullable @JsonProperty(PROP_RFC1583) Boolean getRfc1583Compatible(); @Nonnull @JsonProperty(PROP_ROUTER_ID) Ip getRouterId(); int getSummaryAdminCost(); void initInterfaceCosts(Configuration c); @JsonIgnore boolean isAreaBorderRouter(); @JsonIgnore void setAreas(Map<Long, OspfArea> areas); void addArea(OspfArea area); @JsonIgnore void setExportPolicy(@Nullable String exportPolicy); @JsonIgnore void setExportPolicySources(SortedSet<String> exportPolicySources); @JsonIgnore void setGeneratedRoutes(SortedSet<GeneratedRoute> generatedRoutes); void addGeneratedRoute(GeneratedRoute route); @JsonIgnore void setMaxMetricExternalNetworks(@Nullable Long maxMetricExternalNetworks); @JsonIgnore void setMaxMetricStubNetworks(@Nullable Long maxMetricStubNetworks); @JsonIgnore void setMaxMetricSummaryNetworks(@Nullable Long maxMetricSummaryNetworks); @JsonIgnore void setMaxMetricTransitLinks(@Nullable Long maxMetricTransitLinks); @JsonIgnore void setOspfNeighbors(Map<IpLink, OspfNeighbor> ospfNeighbors); @JsonIgnore void setReferenceBandwidth(Double referenceBandwidth); @JsonIgnore void setRfc1583Compatible(@Nullable Boolean rfc1583Compatible); @JsonIgnore void setRouterId(@Nonnull Ip id); static final EnumSet<RoutingProtocol> REQUIRES_ADMIN; }