@Test public void getRemoteIpActivePeer() { Ip ip = Ip.parse("1.1.1.1"); BgpActivePeerConfig activePeerConfig = BgpActivePeerConfig.builder() .setPeerAddress(ip) .setIpv4UnicastAddressFamily(Ipv4UnicastAddressFamily.builder().build()) .build(); assertThat(getRemoteIp(activePeerConfig), equalTo(new SelfDescribingObject(Schema.IP, ip))); }
@VisibleForTesting static SelfDescribingObject getRemoteIp(@Nonnull BgpPeerConfig peer) { if (peer instanceof BgpActivePeerConfig) { return new SelfDescribingObject(Schema.IP, ((BgpActivePeerConfig) peer).getPeerAddress()); } if (peer instanceof BgpPassivePeerConfig) { return new SelfDescribingObject(Schema.PREFIX, ((BgpPassivePeerConfig) peer).getPeerPrefix()); } throw new IllegalArgumentException( String.format("Peer is neither Active nor Passive: %s", peer)); }
BgpPeerConfigurationAnswerer extends Answerer { @VisibleForTesting static SelfDescribingObject getRemoteIp(@Nonnull BgpPeerConfig peer) { if (peer instanceof BgpActivePeerConfig) { return new SelfDescribingObject(Schema.IP, ((BgpActivePeerConfig) peer).getPeerAddress()); } if (peer instanceof BgpPassivePeerConfig) { return new SelfDescribingObject(Schema.PREFIX, ((BgpPassivePeerConfig) peer).getPeerPrefix()); } throw new IllegalArgumentException( String.format("Peer is neither Active nor Passive: %s", peer)); } }
BgpPeerConfigurationAnswerer extends Answerer { @VisibleForTesting static SelfDescribingObject getRemoteIp(@Nonnull BgpPeerConfig peer) { if (peer instanceof BgpActivePeerConfig) { return new SelfDescribingObject(Schema.IP, ((BgpActivePeerConfig) peer).getPeerAddress()); } if (peer instanceof BgpPassivePeerConfig) { return new SelfDescribingObject(Schema.PREFIX, ((BgpPassivePeerConfig) peer).getPeerPrefix()); } throw new IllegalArgumentException( String.format("Peer is neither Active nor Passive: %s", peer)); } BgpPeerConfigurationAnswerer(Question question, IBatfish batfish); }
BgpPeerConfigurationAnswerer extends Answerer { @VisibleForTesting static SelfDescribingObject getRemoteIp(@Nonnull BgpPeerConfig peer) { if (peer instanceof BgpActivePeerConfig) { return new SelfDescribingObject(Schema.IP, ((BgpActivePeerConfig) peer).getPeerAddress()); } if (peer instanceof BgpPassivePeerConfig) { return new SelfDescribingObject(Schema.PREFIX, ((BgpPassivePeerConfig) peer).getPeerPrefix()); } throw new IllegalArgumentException( String.format("Peer is neither Active nor Passive: %s", peer)); } BgpPeerConfigurationAnswerer(Question question, IBatfish batfish); static List<ColumnMetadata> createColumnMetadata(
      BgpPeerPropertySpecifier propertySpecifier); @Override AnswerElement answer(NetworkSnapshot snapshot); @VisibleForTesting static Multiset<Row> getAnswerRows(
      SpecifierContext ctxt,
      NodeSpecifier nodeSpecifier,
      Map<String, ColumnMetadata> columnMetadata,
      BgpPeerPropertySpecifier propertySpecifier); static String getColumnName(String property); }
BgpPeerConfigurationAnswerer extends Answerer { @VisibleForTesting static SelfDescribingObject getRemoteIp(@Nonnull BgpPeerConfig peer) { if (peer instanceof BgpActivePeerConfig) { return new SelfDescribingObject(Schema.IP, ((BgpActivePeerConfig) peer).getPeerAddress()); } if (peer instanceof BgpPassivePeerConfig) { return new SelfDescribingObject(Schema.PREFIX, ((BgpPassivePeerConfig) peer).getPeerPrefix()); } throw new IllegalArgumentException( String.format("Peer is neither Active nor Passive: %s", peer)); } BgpPeerConfigurationAnswerer(Question question, IBatfish batfish); static List<ColumnMetadata> createColumnMetadata(
      BgpPeerPropertySpecifier propertySpecifier); @Override AnswerElement answer(NetworkSnapshot snapshot); @VisibleForTesting static Multiset<Row> getAnswerRows(
      SpecifierContext ctxt,
      NodeSpecifier nodeSpecifier,
      Map<String, ColumnMetadata> columnMetadata,
      BgpPeerPropertySpecifier propertySpecifier); static String getColumnName(String property); static final String COL_NODE; static final String COL_VRF; static final String COL_LOCAL_INTERFACE; static final String COL_REMOTE_IP; }