@Override protected IsisInterfaceMode featureValueOf(IsisInterfaceLevelSettings actual) { return actual.getMode(); } }
@Override protected Long featureValueOf(IsisInterfaceLevelSettings actual) { return actual.getCost(); } }
public IsisInterfaceLevelSettings build() { return new IsisInterfaceLevelSettings( _cost, _helloAuthenticationKey, _helloAuthenticationType, _helloInterval, _holdTime, requireNonNull(_mode)); }
/** * Generate IS-IS from a given interface for a given level (with a given metric/admin cost) and * merge them into the appropriate RIB. */ private static Set<IsisRoute> generateIsisInterfaceRoutesPerLevel( int adminCost, IsisRoute.Builder routeBuilder, Interface iface, IsisLevel level) { IsisInterfaceLevelSettings ifaceLevelSettings = level == IsisLevel.LEVEL_1 ? iface.getIsis().getLevel1() : iface.getIsis().getLevel2(); RoutingProtocol isisProtocol = level == IsisLevel.LEVEL_1 ? RoutingProtocol.ISIS_L1 : RoutingProtocol.ISIS_L2; long metric = ifaceLevelSettings.getMode() == IsisInterfaceMode.PASSIVE ? 0L : firstNonNull(ifaceLevelSettings.getCost(), IsisRoute.DEFAULT_METRIC); routeBuilder.setAdmin(adminCost).setLevel(level).setMetric(metric).setProtocol(isisProtocol); return iface.getAllAddresses().stream() .map( address -> routeBuilder.setNetwork(address.getPrefix()).setNextHopIp(address.getIp()).build()) .collect(ImmutableSet.toImmutableSet()); }
private org.batfish.datamodel.isis.IsisInterfaceLevelSettings toIsisInterfaceLevelSettings( IsisLevelSettings levelSettings, IsisInterfaceSettings interfaceSettings, IsisInterfaceLevelSettings interfaceLevelSettings, long defaultCost) { long cost = firstNonNull(interfaceLevelSettings.getMetric(), defaultCost); if (!levelSettings.getWideMetricsOnly()) { cost = Math.min(cost, MAX_ISIS_COST_WITHOUT_WIDE_METRICS); } return org.batfish.datamodel.isis.IsisInterfaceLevelSettings.builder() .setCost(cost) .setHelloAuthenticationKey(interfaceLevelSettings.getHelloAuthenticationKey()) .setHelloAuthenticationType(interfaceLevelSettings.getHelloAuthenticationType()) .setHelloInterval(interfaceLevelSettings.getHelloInterval()) .setHoldTime(interfaceLevelSettings.getHoldTime()) .setMode( interfaceSettings.getPassive() || interfaceLevelSettings.getPassive() ? IsisInterfaceMode.PASSIVE : IsisInterfaceMode.ACTIVE) .build(); }
@Override protected Integer featureValueOf(IsisInterfaceLevelSettings actual) { return actual.getHelloInterval(); } }
@Override protected IsisHelloAuthenticationType featureValueOf(IsisInterfaceLevelSettings actual) { return actual.getHelloAuthenticationType(); } }
@Override protected Integer featureValueOf(IsisInterfaceLevelSettings actual) { return actual.getHoldTime(); } }
IsisInterfaceLevelSettings.builder() .setCost(iface.getIsisCost()) .setMode(iface.getIsisInterfaceMode())
IsisInterfaceLevelSettings level2Settings = iface.getIsis().getLevel2(); IsisLevel activeLevels = null; if (level1Settings != null && level1Settings.getMode() == IsisInterfaceMode.ACTIVE) { activeLevels = IsisLevel.LEVEL_1; if (level2Settings != null && level2Settings.getMode() == IsisInterfaceMode.ACTIVE) { activeLevels = IsisLevel.union(activeLevels, IsisLevel.LEVEL_2);
@JsonCreator private static @Nonnull IsisInterfaceLevelSettings create( @JsonProperty(PROP_COST) Long cost, @JsonProperty(PROP_HELLO_AUTHENTICATION_KEY) String helloAuthenticationKey, @JsonProperty(PROP_HELLO_AUTHENTICATION_TYPE) IsisHelloAuthenticationType helloAuthenticationType, @JsonProperty(PROP_HELLO_INTERVAL) Integer helloInterval, @JsonProperty(PROP_HOLD_TIME) Integer holdTime, @JsonProperty(PROP_MODE) IsisInterfaceMode mode) { return new IsisInterfaceLevelSettings( cost, helloAuthenticationKey, helloAuthenticationType, helloInterval, holdTime, firstNonNull(mode, UNSET)); }