-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
failing test for banner stripping trailing newlines during parsing (#569
) * failing test for banner stripping trailing newlines during parsing * possible fix to rstrip of banners * fix all banner test --------- Co-authored-by: Jeff Kala <[email protected]>
- Loading branch information
Showing
18 changed files
with
75 additions
and
50 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
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
4 changes: 2 additions & 2 deletions
4
tests/unit/mock/config/compliance/compliance/cisco_iosxr/iosxr_basic_received.json
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
2 changes: 1 addition & 1 deletion
2
...it/mock/config/compliance/config_section_not_parsed/cisco_iosxr/iosxr_basic_received.json
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
8 changes: 4 additions & 4 deletions
8
tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_exec_received.py
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
data = { | ||
"compliant": False, | ||
"missing": "banner exec ^C\n=========\nintended config exec banner\n-========^C", | ||
"extra": "banner exec ^C\n=========\nactual config exec banner\n-========^C", | ||
"missing": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C", | ||
"extra": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C", | ||
"cannot_parse": True, | ||
"unordered_compliant": False, | ||
"ordered_compliant": False, | ||
"actual": "banner exec ^C\n=========\nactual config exec banner\n-========^C", | ||
"intended": "banner exec ^C\n=========\nintended config exec banner\n-========^C", | ||
"actual": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C", | ||
"intended": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C", | ||
} |
8 changes: 4 additions & 4 deletions
8
tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_motd_received.py
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
data = { | ||
"compliant": False, | ||
"missing": "banner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||^C", | ||
"extra": "banner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||^C", | ||
"missing": "banner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C", | ||
"extra": "banner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C", | ||
"cannot_parse": True, | ||
"unordered_compliant": False, | ||
"ordered_compliant": False, | ||
"actual": "banner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||^C", | ||
"intended": "banner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||^C", | ||
"actual": "banner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C", | ||
"intended": "banner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C", | ||
} |
8 changes: 4 additions & 4 deletions
8
tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_received.py
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
data = { | ||
"compliant": False, | ||
"missing": "banner exec ^C\n=========\nintended config exec banner\n-========^C\nbanner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||^C", | ||
"extra": "banner exec ^C\n=========\nactual config exec banner\n-========^C\nbanner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||^C", | ||
"missing": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C\nbanner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C", | ||
"extra": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C\nbanner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C", | ||
"cannot_parse": True, | ||
"unordered_compliant": False, | ||
"ordered_compliant": False, | ||
"actual": "banner exec ^C\n=========\nactual config exec banner\n-========^C\nbanner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||^C", | ||
"intended": "banner exec ^C\n=========\nintended config exec banner\n-========^C\nbanner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||^C", | ||
"actual": "banner exec ^C\n=========\nactual config exec banner\n-========\n^C\nbanner motd ^C\n======\nactual config motd banner\n======\n || ($hostname) ||\n^C", | ||
"intended": "banner exec ^C\n=========\nintended config exec banner\n-========\n^C\nbanner motd ^C\n======\nintended config motd banner\n======\n || ($hostname) ||\n^C", | ||
} |
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
12 changes: 12 additions & 0 deletions
12
tests/unit/mock/config/parser/base/cisco_ios/ios_banner_newline_received.py
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,12 @@ | ||
from netutils.config.parser import ConfigLine | ||
|
||
data = [ | ||
ConfigLine(config_line="hostname banner_with_newline", parents=()), | ||
ConfigLine(config_line="banner login ^C", parents=()), | ||
ConfigLine( | ||
config_line="****************************************************\nWARNING TO UNAUTHORIZED USERS:\nThis system is for use by authorized users only.\n****************************************************\n^C", | ||
parents=("banner login ^C",), | ||
), | ||
ConfigLine(config_line="line vty 0 4", parents=()), | ||
ConfigLine(config_line=" transport ssh", parents=("line vty 0 4",)), | ||
] |
13 changes: 13 additions & 0 deletions
13
tests/unit/mock/config/parser/base/cisco_ios/ios_banner_newline_sent.txt
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,13 @@ | ||
hostname banner_with_newline | ||
! | ||
banner login ^C | ||
**************************************************** | ||
WARNING TO UNAUTHORIZED USERS: | ||
This system is for use by authorized users only. | ||
**************************************************** | ||
|
||
^C | ||
! | ||
line vty 0 4 | ||
transport ssh | ||
! |
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
Oops, something went wrong.