Skip to content

Commit

Permalink
Merge branch 'batfish:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkala committed Mar 8, 2022
2 parents 4aa5d6d + 633806b commit 74bd9b4
Show file tree
Hide file tree
Showing 186 changed files with 11,131 additions and 7,574 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.google.common.collect.ImmutableRangeSet;
import com.google.common.collect.RangeSet;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
Expand All @@ -18,7 +18,10 @@
public final class IpCompletionMetadata implements Serializable {
@Nullable private final RangeSet<Ip> _ipSubset;

@Nonnull private final List<IpCompletionRelevance> _relevances;
// TODO: Why does insertion order matter?
@SuppressWarnings("PMD.LooseCoupling") // insertion order matters
@Nonnull
private final LinkedHashSet<IpCompletionRelevance> _relevances;

public IpCompletionMetadata() {
this(null, ImmutableList.of());
Expand All @@ -35,14 +38,12 @@ public IpCompletionMetadata(List<IpCompletionRelevance> relevances) {
public IpCompletionMetadata(
@Nullable RangeSet<Ip> ipSubset, List<IpCompletionRelevance> relevances) {
_ipSubset = ipSubset == null ? null : ImmutableRangeSet.copyOf(ipSubset);
_relevances = new LinkedList<>(relevances);
_relevances = new LinkedHashSet<>(relevances);
}

/** Add another relevance with the specified display and match tags. */
public void addRelevance(IpCompletionRelevance relevance) {
if (!_relevances.contains(relevance)) {
_relevances.add(relevance);
}
_relevances.add(relevance);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.Map;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.batfish.common.topology.IpOwnersBaseImpl.ElectionDetails;
import org.batfish.datamodel.Ip;
import org.batfish.datamodel.IpSpace;
import org.batfish.datamodel.Prefix;
Expand Down Expand Up @@ -66,4 +68,12 @@ public interface IpOwners {
*/
@Nonnull
Map<String, Map<String, Map<String, IpSpace>>> getVrfIfaceOwnedIpSpaces();

/** Returns election data for HSRP, if recorded. */
@Nullable
ElectionDetails getHsrpElectionDetails();

/** Returns election data for VRRP, if recorded. */
@Nullable
ElectionDetails getVrrpElectionDetails();
}

0 comments on commit 74bd9b4

Please sign in to comment.