-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FRR: introduce ospf area intermediate representation (#6655)
Better than sticking per-area configs in the Vrf itself.
- Loading branch information
Showing
5 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
projects/batfish/src/main/java/org/batfish/representation/cumulus/OspfArea.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.batfish.representation.cumulus; | ||
|
||
import java.io.Serializable; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import org.batfish.datamodel.Prefix; | ||
|
||
/** OSPF configuration for an area in a vrf. */ | ||
public class OspfArea implements Serializable { | ||
|
||
private final long _area; | ||
private final @Nonnull Map<Prefix, OspfAreaRange> _ranges; | ||
|
||
public OspfArea(long area) { | ||
_area = area; | ||
_ranges = new HashMap<>(); | ||
} | ||
|
||
public long getArea() { | ||
return _area; | ||
} | ||
|
||
public @Nonnull OspfAreaRange getOrCreateRange(@Nonnull Prefix range) { | ||
return _ranges.computeIfAbsent(range, OspfAreaRange::new); | ||
} | ||
|
||
public @Nullable OspfAreaRange getRange(@Nonnull Prefix range) { | ||
return _ranges.get(range); | ||
} | ||
|
||
public @Nonnull Map<Prefix, OspfAreaRange> getRanges() { | ||
return Collections.unmodifiableMap(_ranges); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 8 additions & 14 deletions
22
projects/batfish/src/main/java/org/batfish/representation/cumulus/OspfVrf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters