-
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.
parsing for EIGRP distribute list out (#6269)
- Loading branch information
Showing
8 changed files
with
137 additions
and
6 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
52 changes: 52 additions & 0 deletions
52
...st/java/org/batfish/datamodel/matchers/ParseVendorConfigurationAnswerElementMatchers.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,52 @@ | ||
package org.batfish.datamodel.matchers; | ||
|
||
import javax.annotation.Nonnull; | ||
import org.batfish.common.Warnings; | ||
import org.batfish.common.Warnings.ParseWarning; | ||
import org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement; | ||
import org.hamcrest.Description; | ||
import org.hamcrest.Matcher; | ||
import org.hamcrest.TypeSafeDiagnosingMatcher; | ||
|
||
final class ParseVendorConfigurationAnswerElementMatchers { | ||
|
||
static final class HasParseWarning | ||
extends TypeSafeDiagnosingMatcher<ParseVendorConfigurationAnswerElement> { | ||
|
||
private final @Nonnull Matcher<? super String> _subMatcher; | ||
|
||
private final @Nonnull String _filename; | ||
|
||
HasParseWarning(@Nonnull String filename, @Nonnull Matcher<? super String> subMatcher) { | ||
_filename = filename; | ||
_subMatcher = subMatcher; | ||
} | ||
|
||
@Override | ||
public void describeTo(Description description) { | ||
description | ||
.appendText("A ParseVendorConfigurationAnswerElement with a parse warning with text:") | ||
.appendDescriptionOf(_subMatcher); | ||
} | ||
|
||
@Override | ||
protected boolean matchesSafely( | ||
ParseVendorConfigurationAnswerElement item, Description mismatchDescription) { | ||
Warnings warnings = item.getWarnings().get(_filename); | ||
if (warnings == null) { | ||
mismatchDescription.appendText(String.format("No warnings for filename '%s'", _filename)); | ||
return false; | ||
} | ||
if (warnings.getParseWarnings().stream() | ||
.map(ParseWarning::getComment) | ||
.noneMatch(_subMatcher::matches)) { | ||
mismatchDescription.appendText( | ||
String.format("No parse warnings for filename '%s' match", _filename)); | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
|
||
private ParseVendorConfigurationAnswerElementMatchers() {} | ||
} |
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
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
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
17 changes: 17 additions & 0 deletions
17
...sources/org/batfish/grammar/cisco/testconfigs/ios-eigrp-distribute-list-refs-and-warnings
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,17 @@ | ||
! | ||
hostname ios-eigrp-distribute-list-refs-and-warnings | ||
! | ||
access-list 1 permit 172.21.30.0 0.0.0.255 | ||
! | ||
access-list 2 permit 172.21.30.0 0.0.0.255 | ||
! | ||
interface GigabitEthernet0/0 | ||
ip address 2.2.2.2 255.255.255.0 | ||
! | ||
router eigrp 1 | ||
distribute-list 1 out GigabitEthernet0/0 | ||
distribute-list 2 out | ||
|
||
distribute-list 1 in GigabitEthernet0/0 | ||
distribute-list 2 in | ||
! |