Skip to content

Commit

Permalink
Arista EOS do not treat vxlan multicast-groups as VTEPs
Browse files Browse the repository at this point in the history
- Fixes #8061
- Multicast-groups are not supported for BUM traffic on EOS up to at least 4.23
  - They are only for BM traffic, and should not displace unicast VTEPs
  • Loading branch information
arifogel committed Feb 26, 2022
1 parent 60c419a commit 435a6cb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.hamcrest.Matchers.equalTo;

import java.util.Collection;
import java.util.Set;
import javax.annotation.Nonnull;
import org.batfish.datamodel.BumTransportMethod;
import org.batfish.datamodel.Ip;
Expand All @@ -27,7 +28,7 @@ private VniMatchers() {}
* subMatcher}.
*/
public static @Nonnull Matcher<Layer2Vni> hasBumTransportIps(
@Nonnull Matcher<? super Iterable<Ip>> subMatcher) {
@Nonnull Matcher<? super Set<Ip>> subMatcher) {
return new HasBumTransportIps(subMatcher);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.batfish.datamodel.matchers;

import java.util.Collection;
import java.util.Set;
import javax.annotation.Nonnull;
import org.batfish.datamodel.BumTransportMethod;
import org.batfish.datamodel.Ip;
Expand All @@ -14,13 +15,13 @@ public class VniMatchersImpl {

private VniMatchersImpl() {}

static final class HasBumTransportIps extends FeatureMatcher<Layer2Vni, Iterable<Ip>> {
HasBumTransportIps(@Nonnull Matcher<? super Iterable<Ip>> subMatcher) {
static final class HasBumTransportIps extends FeatureMatcher<Layer2Vni, Set<Ip>> {
HasBumTransportIps(@Nonnull Matcher<? super Set<Ip>> subMatcher) {
super(subMatcher, "Layer2Vni with BUM transport IPs:", "bumTransportIps");
}

@Override
protected Iterable<Ip> featureValueOf(Layer2Vni actual) {
protected Set<Ip> featureValueOf(Layer2Vni actual) {
return actual.getBumTransportIps();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2741,16 +2741,10 @@ private static Layer2Vni toL2Vni(
SortedSet<Ip> bumTransportIps =
firstNonNull(vxlan.getVlanFloodAddresses().get(vlan), vxlan.getFloodAddresses());

// default to unicast flooding unless specified otherwise
// Up to at least 4.23, MULTICAST_GROUP is not supported for BUM traffic (only BM traffic),
// and it should never displace unicast VTEPs.
BumTransportMethod bumTransportMethod = BumTransportMethod.UNICAST_FLOOD_GROUP;

// Check if multicast is enabled
Ip multicastAddress = vxlan.getMulticastGroup();
if (bumTransportIps.isEmpty() && multicastAddress != null) {
bumTransportMethod = BumTransportMethod.MULTICAST_GROUP;
bumTransportIps = ImmutableSortedSet.of(multicastAddress);
}

return Layer2Vni.builder()
.setBumTransportIps(bumTransportIps)
.setBumTransportMethod(bumTransportMethod)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
import org.batfish.representation.arista.eos.AristaEosVxlan;
import org.batfish.representation.arista.eos.AristaRedistributeType;
import org.batfish.vendor.VendorStructureId;
import org.hamcrest.Matchers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand Down Expand Up @@ -1798,9 +1799,10 @@ public void testEosVxlan() throws IOException {
// Confirm VLAN<->VNI mapping is applied
assertThat(vnisBase, hasVlan(equalTo(2)));

// Confirm multicast address is present
assertThat(vnisNoAddr, hasBumTransportMethod(equalTo(BumTransportMethod.MULTICAST_GROUP)));
assertThat(vnisNoAddr, hasBumTransportIps(contains(Ip.parse("227.10.1.1"))));
// https://github.com/batfish/batfish/issues/8061
// Confirm multicast address does not change BumTransport method nor VTEPs
assertThat(vnisNoAddr, hasBumTransportMethod(equalTo(BumTransportMethod.UNICAST_FLOOD_GROUP)));
assertThat(vnisNoAddr, hasBumTransportIps(Matchers.empty()));
// Confirm no source address is present (no address specified for loopback interface)
assertThat(vnisNoAddr, hasSourceAddress(nullValue()));
// Confirm default UDP port is used even though none is supplied
Expand Down

0 comments on commit 435a6cb

Please sign in to comment.