@Test public void testGetAsnSpaceSingularAs() { AristaBgpV4DynamicNeighbor neighbor = new AristaBgpV4DynamicNeighbor(Prefix.parse("1.1.1.0/24")); neighbor.setRemoteAs(1L); assertThat(getAsnSpace(neighbor, ImmutableMap.of()), equalTo(LongSpace.of(1))); }
@Nonnull @VisibleForTesting static LongSpace getAsnSpace( AristaBgpV4DynamicNeighbor neighbor, Map<String, AristaBgpPeerFilter> peerFilters) { if (neighbor.getRemoteAs() != null) { return LongSpace.of(neighbor.getRemoteAs()); } else if (neighbor.getPeerFilter() != null) { AristaBgpPeerFilter peerFilter = peerFilters.get(neighbor.getPeerFilter()); if (peerFilter == null) { return BgpPeerConfig.ALL_AS_NUMBERS; } return peerFilter.toLongSpace(); } else { return LongSpace.EMPTY; } }
AristaConversions { @Nonnull @VisibleForTesting static LongSpace getAsnSpace( AristaBgpV4DynamicNeighbor neighbor, Map<String, AristaBgpPeerFilter> peerFilters) { if (neighbor.getRemoteAs() != null) { return LongSpace.of(neighbor.getRemoteAs()); } else if (neighbor.getPeerFilter() != null) { AristaBgpPeerFilter peerFilter = peerFilters.get(neighbor.getPeerFilter()); if (peerFilter == null) { return BgpPeerConfig.ALL_AS_NUMBERS; } return peerFilter.toLongSpace(); } else { return LongSpace.EMPTY; } } }
AristaConversions { @Nonnull @VisibleForTesting static LongSpace getAsnSpace( AristaBgpV4DynamicNeighbor neighbor, Map<String, AristaBgpPeerFilter> peerFilters) { if (neighbor.getRemoteAs() != null) { return LongSpace.of(neighbor.getRemoteAs()); } else if (neighbor.getPeerFilter() != null) { AristaBgpPeerFilter peerFilter = peerFilters.get(neighbor.getPeerFilter()); if (peerFilter == null) { return BgpPeerConfig.ALL_AS_NUMBERS; } return peerFilter.toLongSpace(); } else { return LongSpace.EMPTY; } } private  AristaConversions(); }
AristaConversions { @Nonnull @VisibleForTesting static LongSpace getAsnSpace( AristaBgpV4DynamicNeighbor neighbor, Map<String, AristaBgpPeerFilter> peerFilters) { if (neighbor.getRemoteAs() != null) { return LongSpace.of(neighbor.getRemoteAs()); } else if (neighbor.getPeerFilter() != null) { AristaBgpPeerFilter peerFilter = peerFilters.get(neighbor.getPeerFilter()); if (peerFilter == null) { return BgpPeerConfig.ALL_AS_NUMBERS; } return peerFilter.toLongSpace(); } else { return LongSpace.EMPTY; } } private  AristaConversions();  }
AristaConversions { @Nonnull @VisibleForTesting static LongSpace getAsnSpace( AristaBgpV4DynamicNeighbor neighbor, Map<String, AristaBgpPeerFilter> peerFilters) { if (neighbor.getRemoteAs() != null) { return LongSpace.of(neighbor.getRemoteAs()); } else if (neighbor.getPeerFilter() != null) { AristaBgpPeerFilter peerFilter = peerFilters.get(neighbor.getPeerFilter()); if (peerFilter == null) { return BgpPeerConfig.ALL_AS_NUMBERS; } return peerFilter.toLongSpace(); } else { return LongSpace.EMPTY; } } private  AristaConversions();   }