Skip to content

Commit

Permalink
google-java-format: upgrade to latest (batfish#8793)
Browse files Browse the repository at this point in the history
Otherwise, folks will be getting format errors as they work.

commit-id:376c1022
  • Loading branch information
dhalperi authored Sep 8, 2023
1 parent 37dc6cf commit c485303
Show file tree
Hide file tree
Showing 45 changed files with 132 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static BlockReservedAddressesAtInternet create() {
.put("224.0.0.0/4", "Multicast")
.put("240.0.0.0/4", "Future use")
.build();

/*
* Having ISPs block documentation IPs hurts our examples. TBD how we resolve this.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,25 @@ public abstract class BgpPeerConfig implements Serializable {

@Nullable private final RibGroup _appliedRibGroup;
@Nullable private final BgpAuthenticationSettings _authenticationSettings;

/** The cluster id associated with this peer to be used in route reflection */
@Nullable private final Long _clusterId;

@Nullable private final Long _confederationAsn;

/** The default metric associated with routes sent to this peer */
private final int _defaultMetric;

protected final String _description;
private final boolean _ebgpMultihop;
private final boolean _enforceFirstAs;

/**
* The set of generated and/or aggregate routes to be potentially sent to this peer before
* outbound policies are taken into account
*/
@Nonnull private final Set<GeneratedRoute> _generatedRoutes;

/**
* The group name associated with this peer in the vendor-specific configuration from which the
* containing configuration is derived. This field is OPTIONAL and should not impact the
Expand All @@ -71,6 +75,7 @@ public abstract class BgpPeerConfig implements Serializable {

/** The autonomous system number of the containing BGP process as reported to this peer */
@Nullable private final Long _localAs;

/** The ip address of the containing router as reported to this peer */
@Nullable private final Ip _localIp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,13 @@ public int hashCode() {
/////
/** Non-null */
protected final byte _originMechanism;

/** Non-null */
protected final byte _originType;

/** Non-null */
protected final byte _protocol;

/** -1 for null */
protected final byte _srcProtocol;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,10 @@ private static InterfaceType computeVyosInterfaceType(String name) {
private @Nonnull IntegerSpace _allowedVlans;
@Nonnull private SortedSet<InterfaceAddress> _allAddresses;
@Nonnull private SortedMap<ConcreteInterfaceAddress, ConnectedRouteMetadata> _addressMetadata;

/** Cache of all concrete addresses */
@Nullable private transient Set<ConcreteInterfaceAddress> _allConcreteAddresses;

/** Cache of all link-local addresses */
@Nullable private transient Set<LinkLocalAddress> _allLinkLocalAddresses;

Expand All @@ -941,6 +943,7 @@ private static InterfaceType computeVyosInterfaceType(String name) {
private SortedSet<String> _channelGroupMembers;
private String _cryptoMap;
private SortedSet<String> _declaredNames;

/** Set of interface dependencies required for this interface to active */
@Nonnull private Set<Dependency> _dependencies;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public class IpsecSession {
public static final Set<ConfigurationFormat> CLOUD_CONFIGURATION_FORMATS =
ImmutableSet.of(ConfigurationFormat.AWS);

/** Port on which IKE (Phase 1) and IPsec(Phase 2) parameters are exchanged through UDP */
public static final int IPSEC_UDP_PORT = 500;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,19 @@ public Builder setUseUrg(boolean useUrg) {
*/
public static final TcpFlagsMatchConditions ACK_TCP_FLAG =
builder().setTcpFlags(TcpFlags.builder().setAck(true).build()).setUseAck(true).build();

/** Shorthand for match conditions for a RST (reset) packet. Other bits are unconstrained. */
public static final TcpFlagsMatchConditions RST_TCP_FLAG =
builder().setTcpFlags(TcpFlags.builder().setRst(true).build()).setUseRst(true).build();

/** Shorthand for match conditions for a SYN-ACK packet. Other bits are unconstrained. */
public static final TcpFlagsMatchConditions SYN_ACK_TCP_FLAG =
builder()
.setTcpFlags(TcpFlags.builder().setAck(true).setSyn(true).build())
.setUseAck(true)
.setUseSyn(true)
.build();

/** Shorthand for match conditions for a SYN-only packet, with all other bits cleared */
public static final TcpFlagsMatchConditions SYN_ONLY_TCP_FLAG =
builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ public static final class RoutingStepDetail {

/** The name of the VRF in which routing was done. */
@Nonnull private final String _vrf;

/**
* Information about {@link Route}s which led to the selection of the out {@link Interface}, can
* be multiple in case of ECMP
*/
@Nonnull private final List<RouteInfo> _routes;

/** ARP IP which was resolved using the {@code _routes} */
@Nullable private final Ip _arpIp;

/** Output interface which was resolved using the {@code _routes} */
@Nullable private final String _outputInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public Builder setSummaryDiscardMetric(long summaryDiscardMetric) {
@Nullable private Long _maxMetricSummaryNetworks;
@Nullable private Long _maxMetricTransitLinks;
private transient Map<IpLink, OspfNeighbor> _ospfNeighbors;

/** Mapping from interface name to an OSPF config */
@Nonnull private Map<OspfNeighborConfigId, OspfNeighborConfig> _ospfNeighborConfigs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public final class PacketPolicyEvaluator {
// Start state
@Nonnull private final String _srcInterface;
@Nonnull private final String _srcInterfaceVrf;

/** Vrf name to FIB mapping */
@Nonnull private final Map<String, Fib> _fibs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public enum Direction {
private final Map<String, AsPathAccessList> _asPathAccessLists;
private final @Nonnull Map<String, AsPathExpr> _asPathExprs;
private final @Nonnull Map<String, AsPathMatchExpr> _asPathMatchExprs;

/**
* If present, BGP properties are for this node. Aka, local properties are TAIL and remote
* properties are HEAD.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

public final class FlattenerLineMap {
public static final int UNMAPPED_LINE_NUMBER = -1;

/**
* Map of new line number to word map, where word map is map of a word's starting-position in
* new/flattened line to original line number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Rule getInputRule() {
Rule getInputRule(Grammar grammar) {
return input(TestSpec());
}

/**
* Test grammar
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class BDDOutgoingOriginalFlowFilterManager implements Serializable

private final BDDFiniteDomain<String> _finiteDomain;
private final Map<String, BDD> _filterBdds;

/**
* BDD assignments for interfaces with {@link Interface#getOutgoingOriginalFlowFilter()
* outgoingOriginalFlowFilters}. (Does not include entry for {@link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?, ?>> {
/** Configuration for this process */
@Nonnull private final BgpProcess _process;

/** Parent node configuration */
@Deprecated @Nonnull private final Configuration _c;

Expand All @@ -149,6 +150,7 @@ final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?,
* indicate the last path ID generated for a route with the keyed prefix.
*/
@Nonnull private final ConcurrentMap<Prefix, Integer> _pathIdGenerators;

/**
* Map indicating what path ID this process uses when exporting a given route. Keys can be:
*
Expand All @@ -165,27 +167,34 @@ final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?,

@Nonnull private final RoutingPolicies _policies;
@Nonnull private final String _hostname;

/** Name of our VRF */
@Nonnull private final String _vrfName;

/** Reference to the parent {@link VirtualRouter} main RIB (read-only). */
@Nonnull private final GenericRibReadOnly<AnnotatedRoute<AbstractRoute>> _mainRib;

/** Current BGP topology */
@Nonnull private BgpTopology _topology;

/** Metadata about propagated prefixes to/from neighbors */
@Nonnull private PrefixTracer _prefixTracer;

/** Route dependency tracker for BGP IPv4 aggregate routes */
@Nonnull
BgpRouteDependencyTracker<Bgpv4Route, AbstractRoute> _bgpAggDeps =
new BgpRouteDependencyTracker<>();

/** All BGP neighbor that speaks IPv4 unicast address family that we know of */
@Nonnull ImmutableSortedSet<EdgeId> _bgpv4Edges;

/**
* Incoming EVPN type 3 advertisements into this router from each BGP neighbor that speaks EVPN
* address family
*/
@Nonnull @VisibleForTesting
SortedMap<EdgeId, Queue<RouteAdvertisement<EvpnType3Route>>> _evpnType3IncomingRoutes;

/**
* Incoming EVPN type 5 advertisements into this router from each BGP neighbor that speaks EVPN
* address family
Expand All @@ -202,6 +211,7 @@ final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?,
// RIBs and RIB delta builders
/** Helper RIB containing all paths obtained with external BGP, for IPv4 unicast */
@Nonnull final Bgpv4Rib _ebgpv4Rib;

/** RIB containing paths obtained with iBGP, for IPv4 unicast */
@Nonnull final Bgpv4Rib _ibgpv4Rib;

Expand All @@ -225,20 +235,25 @@ final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?,

/** Combined BGP (both iBGP and eBGP) RIB, for IPv4 unicast */
@Nonnull Bgpv4Rib _bgpv4Rib;

/** {@link RibDelta} representing changes to {@link #_bgpv4Rib} in the current iteration */
@Nonnull private Builder<Bgpv4Route> _bgpv4DeltaBuilder = RibDelta.builder();

/** {@link RibDelta} representing changes to {@link #_ebgpv4Rib} in the current iteration */
@Nonnull private Builder<Bgpv4Route> _ebgpv4DeltaBuilder = RibDelta.builder();

/**
* {@link RibDelta} representing changes to {@link #_bgpv4Rib} best path routes in the current
* iteration
*/
@Nonnull private Builder<Bgpv4Route> _bgpv4DeltaBestPathBuilder = RibDelta.builder();

/**
* {@link RibDelta} representing changes to {@link #_ebgpv4Rib} best path routes in the current
* iteration
*/
@Nonnull private Builder<Bgpv4Route> _ebgpv4DeltaBestPathBuilder = RibDelta.builder();

/**
* Keep track of routes we had imported from other VRF during leaking, to avoid exporting them
* again (chain leaking).
Expand All @@ -247,23 +262,31 @@ final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?,

/** eBGP RIB for EVPN type 3 routes */
@Nonnull private EvpnMasterRib<EvpnType3Route> _ebgpType3EvpnRib;

/** iBGP RIB for EVPN type 3 routes */
@Nonnull private EvpnMasterRib<EvpnType3Route> _ibgpType3EvpnRib;

/** Combined RIB for EVPN type 3 routes */
@Nonnull private EvpnMasterRib<EvpnType3Route> _evpnType3Rib;

/** eBGP RIB for EVPN type 5 routes */
@Nonnull private EvpnMasterRib<EvpnType5Route> _ebgpType5EvpnRib;

/** iBGP RIB for EVPN type 5 routes */
@Nonnull private EvpnMasterRib<EvpnType5Route> _ibgpType5EvpnRib;

/** Combined RIB for EVPN type 5 routes */
@Nonnull private EvpnMasterRib<EvpnType5Route> _evpnType5Rib;

/** Builder for constructing {@link RibDelta} for routes in {@link #_evpnType3Rib} */
@Nonnull private Builder<EvpnType3Route> _evpnType3DeltaBuilder = RibDelta.builder();

/** Builder for constructing {@link RibDelta} for routes in {@link #_evpnType5Rib} */
@Nonnull private Builder<EvpnType5Route> _evpnType5DeltaBuilder = RibDelta.builder();

/** {@link RibDelta} representing last round's changes to {@link #_evpnType3Rib} */
@Nonnull private RibDelta<EvpnType3Route> _evpnType3DeltaPrev = RibDelta.empty();

/** {@link RibDelta} representing last round's changes to {@link #_evpnType5Rib} */
@Nonnull private RibDelta<EvpnType5Route> _evpnType5DeltaPrev = RibDelta.empty();

Expand Down Expand Up @@ -297,6 +320,7 @@ final class BgpRoutingProcess implements RoutingProcess<BgpTopology, BgpRoute<?,
* come up, we can easily send out the updates
*/
@Nonnull private RibDelta<EvpnType3Route> _localType3Routes = RibDelta.empty();

/** Type 5 route advertisements that have been sent to neighbors. */
@Nonnull
private final RibDelta.Builder<EvpnType5Route> _evpnType5Advertisements = RibDelta.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,27 @@ final class EigrpRoutingProcess implements RoutingProcess<EigrpTopology, EigrpRo

/** Parent process containing configuration */
@Nonnull private final EigrpProcess _process;

/** All routing policies present at our parent node */
@Nonnull private final RoutingPolicies _routingPolicies;

/** Name of the VRF in which this process resides */
@Nonnull private final String _vrfName;

/** Our AS number */
private final long _asn;

// RIBs and RIB deltas

/** Helper RIB containing EIGRP external paths */
@Nonnull private final EigrpExternalRib _externalRib;

/** Helper RIB containing all EIGRP paths internal to this router's ASN. */
@Nonnull private final EigrpInternalRib _internalRib;

/** Helper RIBs containing EIGRP internal and external paths. */
@Nonnull private final EigrpRib _rib;

/** A {@link RibDelta} indicating which internal routes we initialized */
@Nonnull private RibDelta<EigrpInternalRoute> _initializationDelta;

Expand All @@ -98,12 +104,14 @@ final class EigrpRoutingProcess implements RoutingProcess<EigrpTopology, EigrpRo
@Nonnull
private SortedMap<EigrpEdge, Queue<RouteAdvertisement<EigrpInternalRoute>>>
_incomingInternalRoutes;

/** Incoming external route messages into this router from each EIGRP adjacency */
@Nonnull @VisibleForTesting
SortedMap<EigrpEdge, Queue<RouteAdvertisement<EigrpExternalRoute>>> _incomingExternalRoutes;

/** Current known EIGRP topology */
@Nonnull private EigrpTopology _topology;

/** Set of edges in the topology that are new in the current iteration */
private Collection<EigrpEdge> _edgesWentUp = ImmutableSet.of();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
final class IncrementalBdpEngine {

private static final Logger LOGGER = LogManager.getLogger(IncrementalBdpEngine.class);

/**
* Maximum amount of topology iterations to do before deciding that the dataplane computation
* cannot converge (there is some sort of flap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,22 @@ final class OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute
/* Provided configuration */
/** The configuration/datamodel process */
@Nonnull private final OspfProcess _process;

/** The parent {@link Configuration} */
@Nonnull private final Configuration _c;

/** The name of the VRF we are in */
@Nonnull private final String _vrfName;

/** The current known topology */
@Nonnull private OspfTopology _topology;

/** The area summary filter for each area, if present. */
@Nonnull private final Map<Long, RouteFilterList> _areaFilters;

/* Computed configuration & cached variables */
private final boolean _useMinMetricForSummaries;

/** Export policy for external routes */
@Nonnull private final RoutingPolicy _exportPolicy;

Expand Down Expand Up @@ -124,10 +129,13 @@ final class OspfRoutingProcess implements RoutingProcess<OspfTopology, OspfRoute

/** Delta that captures process initialization (creating intra-area routes based on interfaces) */
@Nonnull private InternalDelta _initializationDelta;

/** Delta to pass to the main RIB */
@Nonnull private RibDelta.Builder<OspfRoute> _changeset;

/** Delta of routes we have locally queued for re-distribution */
@Nonnull private ExternalDelta _queuedForRedistribution;

/**
* Delta of external routes we have activated in current iteration (but haven't advertised yet)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public final class VirtualRouter {

/** The VRF name for this virtual router */
@Nonnull private final String _name;

/** Parent {@link Node} on which this virtual router resides */
@Nonnull private final Node _node;

Expand Down Expand Up @@ -209,6 +210,7 @@ public final class VirtualRouter {
* based on EVPN route advertisements).
*/
private Set<Layer2Vni> _layer2Vnis;

/**
* Map of VNI to Layer 3 VNI settings that are updated dynamically as the dataplane is being
* computed (e.g., based on EVPN route advertisements).
Expand Down
Loading

0 comments on commit c485303

Please sign in to comment.