-
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.
More IOS banner related fixes. (#509)
* dual banner parser actual parser fix and empty banner fix
- Loading branch information
Showing
11 changed files
with
80 additions
and
2 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
2 changes: 1 addition & 1 deletion
2
tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_feature.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,2 +1,2 @@ | ||
feature = {"name": "exec banner", "ordered": False, "section": ["banner"]} | ||
feature = {"name": "dual banner", "ordered": False, "section": ["banner"]} | ||
network_os = "cisco_ios" |
2 changes: 1 addition & 1 deletion
2
tests/unit/mock/config/compliance/feature_compliance/ios_dual_banner_motd_feature.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,2 +1,2 @@ | ||
feature = {"name": "exec banner", "ordered": False, "section": ["banner motd"]} | ||
feature = {"name": "motd banner", "ordered": False, "section": ["banner motd"]} | ||
network_os = "cisco_ios" |
7 changes: 7 additions & 0 deletions
7
tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_actual.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,7 @@ | ||
hostname emptybanner | ||
! | ||
banner motd ^C^C | ||
! | ||
line vty 0 4 | ||
transport ssh | ||
! |
2 changes: 2 additions & 0 deletions
2
tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_feature.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,2 @@ | ||
feature = {"name": "banner", "ordered": False, "section": ["banner"]} | ||
network_os = "cisco_ios" |
9 changes: 9 additions & 0 deletions
9
tests/unit/mock/config/compliance/feature_compliance/ios_empty_banner_intended.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,9 @@ | ||
hostname emptybanner | ||
! | ||
banner motd ^C | ||
actual banner example | ||
^C | ||
! | ||
line vty 0 4 | ||
transport ssh | ||
! |
10 changes: 10 additions & 0 deletions
10
tests/unit/mock/config/compliance/feature_compliance/ios_empty_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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
data = { | ||
"actual": "banner motd ^C^C", | ||
"cannot_parse": True, | ||
"compliant": False, | ||
"extra": "banner motd ^C^C", | ||
"intended": "banner motd ^C\n" "actual banner example^C", | ||
"missing": "banner motd ^C\n" "actual banner example^C", | ||
"ordered_compliant": False, | ||
"unordered_compliant": False, | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/unit/mock/config/parser/base/cisco_ios/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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from netutils.config.parser import ConfigLine | ||
|
||
data = [ | ||
ConfigLine(config_line="hostname dual-banner", parents=()), | ||
ConfigLine(config_line="banner exec ^C", parents=()), | ||
ConfigLine(config_line="=========\nintended config exec banner\n-========^C", parents=("banner exec ^C",)), | ||
ConfigLine(config_line="banner motd ^C", parents=()), | ||
ConfigLine( | ||
config_line="======\nintended config motd banner\n======\n || ($hostname) ||^C", parents=("banner motd ^C",) | ||
), | ||
ConfigLine(config_line=None, parents=()), | ||
] |
14 changes: 14 additions & 0 deletions
14
tests/unit/mock/config/parser/base/cisco_ios/ios_dual_banner_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,14 @@ | ||
hostname dual-banner | ||
! | ||
banner exec ^C | ||
========= | ||
intended config exec banner | ||
-======== | ||
^C | ||
banner motd ^C | ||
====== | ||
intended config motd banner | ||
====== | ||
|| ($hostname) || | ||
^C | ||
! |
8 changes: 8 additions & 0 deletions
8
tests/unit/mock/config/parser/base/cisco_ios/ios_empty_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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from netutils.config.parser import ConfigLine | ||
|
||
data = [ | ||
ConfigLine(config_line="hostname emptybanner", parents=()), | ||
ConfigLine(config_line="banner motd ^C^C", parents=()), | ||
ConfigLine(config_line="line vty 0 4", parents=()), | ||
ConfigLine(config_line=" transport ssh", parents=("line vty 0 4",)), | ||
] |
7 changes: 7 additions & 0 deletions
7
tests/unit/mock/config/parser/base/cisco_ios/ios_empty_banner_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,7 @@ | ||
hostname emptybanner | ||
! | ||
banner motd ^C^C | ||
! | ||
line vty 0 4 | ||
transport ssh | ||
! |