-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for EVPN type 5 routes in BDP (#4656)
- Loading branch information
1 parent
d757840
commit 060ff74
Showing
13 changed files
with
1,370 additions
and
106 deletions.
There are no files selected for viewing
609 changes: 514 additions & 95 deletions
609
projects/batfish/src/main/java/org/batfish/dataplane/ibdp/BgpRoutingProcess.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
88 changes: 88 additions & 0 deletions
88
projects/batfish/src/test/java/org/batfish/dataplane/EvpnType5CumulusTest.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,88 @@ | ||
package org.batfish.dataplane; | ||
|
||
import static org.batfish.datamodel.Prefix.MAX_PREFIX_LENGTH; | ||
import static org.batfish.datamodel.matchers.AbstractRouteDecoratorMatchers.hasNextHopInterface; | ||
import static org.batfish.datamodel.matchers.AbstractRouteDecoratorMatchers.hasPrefix; | ||
import static org.batfish.datamodel.matchers.BgpRouteMatchers.isEvpnType5RouteThat; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.allOf; | ||
import static org.hamcrest.Matchers.hasItem; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.ImmutableMap; | ||
import com.google.common.collect.ImmutableSet; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.SortedMap; | ||
import org.batfish.datamodel.AbstractRoute; | ||
import org.batfish.datamodel.AnnotatedRoute; | ||
import org.batfish.datamodel.DataPlane; | ||
import org.batfish.datamodel.GenericRib; | ||
import org.batfish.datamodel.Ip; | ||
import org.batfish.datamodel.Prefix; | ||
import org.batfish.main.Batfish; | ||
import org.batfish.main.BatfishTestUtils; | ||
import org.batfish.main.TestrigText; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
public class EvpnType5CumulusTest { | ||
private static final String SNAPSHOT_PREFIX = "org/batfish/grammar/cumulus_nclu/testrigs/"; | ||
|
||
@Rule public TemporaryFolder _folder = new TemporaryFolder(); | ||
|
||
@Test | ||
public void testType5RoutePresence() throws IOException { | ||
String snapshotName = "evpn-type5-routes"; | ||
List<String> configurationNames = | ||
ImmutableList.of( | ||
"Leaf1", "Leaf2", "Leaf3", "Leaf4", "Spine1", "Spine2", "exitgateway", "Internet"); | ||
Batfish batfish = | ||
BatfishTestUtils.getBatfishFromTestrigText( | ||
TestrigText.builder() | ||
.setConfigurationText(SNAPSHOT_PREFIX + snapshotName, configurationNames) | ||
.setLayer1TopologyText(SNAPSHOT_PREFIX + snapshotName) | ||
.build(), | ||
_folder); | ||
|
||
batfish.computeDataPlane(); // compute and cache the dataPlane | ||
DataPlane dp = batfish.loadDataPlane(); | ||
|
||
SortedMap<String, SortedMap<String, GenericRib<AnnotatedRoute<AbstractRoute>>>> ribs = | ||
dp.getRibs(); | ||
String vrf1 = "vrf1"; | ||
final ImmutableList<String> leafs = ImmutableList.of("Leaf1", "Leaf2", "Leaf3", "Leaf4"); | ||
|
||
ImmutableSet<Prefix> prefixes = | ||
ImmutableSet.of( | ||
Prefix.create(Ip.parse("100.100.100.100"), MAX_PREFIX_LENGTH), | ||
Prefix.create(Ip.parse("100.100.100.101"), MAX_PREFIX_LENGTH)); | ||
|
||
Map<String, Set<String>> nextHopInterfaces = | ||
ImmutableMap.of( | ||
"Leaf1", | ||
ImmutableSet.of("swp1", "swp11"), | ||
"Leaf2", | ||
ImmutableSet.of("swp2", "swp12"), | ||
"Leaf3", | ||
ImmutableSet.of("swp3", "swp13"), | ||
"Leaf4", | ||
ImmutableSet.of("swp4", "swp14")); | ||
|
||
for (String leaf : leafs) { | ||
Set<AbstractRoute> routes = ribs.get(leaf).get(vrf1).getRoutes(); | ||
for (Prefix prefix : prefixes) { | ||
for (String nextHopIface : nextHopInterfaces.get(leaf)) { | ||
assertThat( | ||
routes, | ||
hasItem( | ||
isEvpnType5RouteThat( | ||
allOf(hasPrefix(prefix), hasNextHopInterface(nextHopIface))))); | ||
} | ||
} | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...st/resources/org/batfish/grammar/cumulus_nclu/testrigs/evpn-type5-routes/configs/Internet
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,35 @@ | ||
net del all | ||
net add time zone Etc/UTC | ||
net add time ntp server 0.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 1.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 2.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 3.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp source eth0 | ||
net add snmp-server listening-address localhost | ||
net add bgp autonomous-system 65001 | ||
net add routing defaults datacenter | ||
net add routing service integrated-vtysh-config | ||
net add routing log syslog informational | ||
net add bgp neighbor swp1 interface remote-as 65000 | ||
net add bgp ipv4 unicast redistribute connected | ||
net add dns nameserver ipv4 10.0.2.3 | ||
net add ptp global slave-only no | ||
net add ptp global priority1 255 | ||
net add ptp global priority2 255 | ||
net add ptp global domain-number 0 | ||
net add ptp global logging-level 5 | ||
net add ptp global path-trace-enabled no | ||
net add ptp global use-syslog yes | ||
net add ptp global verbose no | ||
net add ptp global summary-interval 0 | ||
net add ptp global time-stamping | ||
net add interface swp1 ip address 10.10.102.1/24 | ||
net add interface swp2 | ||
net add loopback lo ip address 100.100.100.100/32 | ||
net add loopback lo ip address 100.100.100.101/32 | ||
net add hostname Internet | ||
net add dot1x radius accounting-port 1813 | ||
net add dot1x radius authentication-port 1812 | ||
net add dot1x mab-activation-delay 30 | ||
net add dot1x eap-reauth-period 0 | ||
net commit |
70 changes: 70 additions & 0 deletions
70
.../test/resources/org/batfish/grammar/cumulus_nclu/testrigs/evpn-type5-routes/configs/Leaf1
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,70 @@ | ||
net del all | ||
net add time zone Etc/UTC | ||
net add time ntp server 0.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 1.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 2.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 3.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp source eth0 | ||
net add snmp-server listening-address localhost | ||
net add bgp autonomous-system 65000 | ||
net add routing defaults datacenter | ||
net add routing service integrated-vtysh-config | ||
net add routing log syslog informational | ||
net add vrf vrf1 vni 1004001 | ||
net add bgp router-id 1.1.1.3 | ||
net add bgp neighbor swp1 interface remote-as 65000 | ||
net add bgp neighbor swp11 interface remote-as 65000 | ||
net add bgp ipv4 unicast network 1.1.1.3/32 | ||
net add bgp ipv4 unicast network 1.1.1.100/32 | ||
net add bgp l2vpn evpn neighbor swp1 activate | ||
net add bgp l2vpn evpn neighbor swp11 activate | ||
net add bgp l2vpn evpn advertise-all-vni | ||
net add dns nameserver ipv4 10.0.2.3 | ||
net add ptp global slave-only no | ||
net add ptp global priority1 255 | ||
net add ptp global priority2 255 | ||
net add ptp global domain-number 0 | ||
net add ptp global logging-level 5 | ||
net add ptp global path-trace-enabled no | ||
net add ptp global use-syslog yes | ||
net add ptp global verbose no | ||
net add ptp global summary-interval 0 | ||
net add ptp global time-stamping | ||
net add bond peerlink bond slaves swp30,swp31 | ||
net add vxlan vni10 vxlan id 10010 | ||
net add vxlan vni4001 vxlan id 1004001 | ||
net add bridge bridge ports peerlink,swp21,vni10,vni4001 | ||
net add bridge bridge vids 10,4001 | ||
net add bridge bridge vlan-aware | ||
net add interface peerlink.4094 clag backup-ip 192.168.100.101 | ||
net add interface peerlink.4094 clag peer-ip 169.254.1.2 | ||
net add interface peerlink.4094 clag priority 1000 | ||
net add interface peerlink.4094 clag sys-mac 44:38:39:FF:00:01 | ||
net add interface peerlink.4094 ip address 169.254.1.1/30 | ||
net add interface swp2-10,12-20,22-31 | ||
net add interface swp21 bridge access 10 | ||
net add loopback lo clag vxlan-anycast-ip 1.1.1.100 | ||
net add loopback lo ip address 1.1.1.3/32 | ||
net add vlan 10 ip address 192.168.10.101/24 | ||
net add vlan 10 ip address-virtual 00:00:00:00:00:10 192.168.10.1/24 | ||
net add vlan 10 vlan-id 10 | ||
net add vlan 10 vlan-raw-device bridge | ||
net add vlan 10 vrf vrf1 | ||
net add vlan 4001 hwaddress 44:39:39:FF:40:94 | ||
net add vlan 4001 vlan-id 4001 | ||
net add vlan 4001 vlan-raw-device bridge | ||
net add vlan 4001 vrf vrf1 | ||
net add vrf vrf1 vrf-table auto | ||
net add vxlan vni10 bridge access 10 | ||
net add vxlan vni10,4001 bridge arp-nd-suppress on | ||
net add vxlan vni10,4001 bridge learning off | ||
net add vxlan vni10,4001 stp bpduguard | ||
net add vxlan vni10,4001 stp portbpdufilter | ||
net add vxlan vni10,4001 vxlan local-tunnelip 1.1.1.3 | ||
net add vxlan vni4001 bridge access 4001 | ||
net add hostname Leaf1 | ||
net add dot1x radius accounting-port 1813 | ||
net add dot1x radius authentication-port 1812 | ||
net add dot1x mab-activation-delay 30 | ||
net add dot1x eap-reauth-period 0 | ||
net commit |
70 changes: 70 additions & 0 deletions
70
.../test/resources/org/batfish/grammar/cumulus_nclu/testrigs/evpn-type5-routes/configs/Leaf2
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,70 @@ | ||
net del all | ||
net add time zone Etc/UTC | ||
net add time ntp server 0.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 1.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 2.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp server 3.cumulusnetworks.pool.ntp.org iburst | ||
net add time ntp source eth0 | ||
net add snmp-server listening-address localhost | ||
net add bgp autonomous-system 65000 | ||
net add routing defaults datacenter | ||
net add routing service integrated-vtysh-config | ||
net add routing log syslog informational | ||
net add vrf vrf1 vni 1004001 | ||
net add bgp router-id 1.1.1.4 | ||
net add bgp neighbor swp2 interface remote-as 65000 | ||
net add bgp neighbor swp12 interface remote-as 65000 | ||
net add bgp ipv4 unicast network 1.1.1.4/32 | ||
net add bgp ipv4 unicast network 1.1.1.100/32 | ||
net add bgp l2vpn evpn neighbor swp2 activate | ||
net add bgp l2vpn evpn neighbor swp12 activate | ||
net add bgp l2vpn evpn advertise-all-vni | ||
net add dns nameserver ipv4 10.0.2.3 | ||
net add ptp global slave-only no | ||
net add ptp global priority1 255 | ||
net add ptp global priority2 255 | ||
net add ptp global domain-number 0 | ||
net add ptp global logging-level 5 | ||
net add ptp global path-trace-enabled no | ||
net add ptp global use-syslog yes | ||
net add ptp global verbose no | ||
net add ptp global summary-interval 0 | ||
net add ptp global time-stamping | ||
net add bond peerlink bond slaves swp30,swp31 | ||
net add vxlan vni10 vxlan id 10010 | ||
net add vxlan vni4001 vxlan id 1004001 | ||
net add bridge bridge ports peerlink,swp21,vni10,vni4001 | ||
net add bridge bridge vids 10,4001 | ||
net add bridge bridge vlan-aware | ||
net add interface peerlink.4094 clag backup-ip 192.168.100.102 | ||
net add interface peerlink.4094 clag peer-ip 169.254.1.1 | ||
net add interface peerlink.4094 clag priority 2000 | ||
net add interface peerlink.4094 clag sys-mac 44:38:39:FF:00:01 | ||
net add interface peerlink.4094 ip address 169.254.1.2/30 | ||
net add interface swp1,3-11,13-20,22-31 | ||
net add interface swp21 bridge access 10 | ||
net add loopback lo clag vxlan-anycast-ip 1.1.1.100 | ||
net add loopback lo ip address 1.1.1.4/32 | ||
net add vlan 10 ip address 192.168.10.102/24 | ||
net add vlan 10 ip address-virtual 00:00:00:00:00:10 192.168.10.1/24 | ||
net add vlan 10 vlan-id 10 | ||
net add vlan 10 vlan-raw-device bridge | ||
net add vlan 10 vrf vrf1 | ||
net add vlan 4001 hwaddress 44:39:39:FF:40:94 | ||
net add vlan 4001 vlan-id 4001 | ||
net add vlan 4001 vlan-raw-device bridge | ||
net add vlan 4001 vrf vrf1 | ||
net add vrf vrf1 vrf-table auto | ||
net add vxlan vni10 bridge access 10 | ||
net add vxlan vni10,4001 bridge arp-nd-suppress on | ||
net add vxlan vni10,4001 bridge learning off | ||
net add vxlan vni10,4001 stp bpduguard | ||
net add vxlan vni10,4001 stp portbpdufilter | ||
net add vxlan vni10,4001 vxlan local-tunnelip 1.1.1.4 | ||
net add vxlan vni4001 bridge access 4001 | ||
net add hostname Leaf2 | ||
net add dot1x radius accounting-port 1813 | ||
net add dot1x radius authentication-port 1812 | ||
net add dot1x mab-activation-delay 30 | ||
net add dot1x eap-reauth-period 0 | ||
net commit |
Oops, something went wrong.