-
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.
* Add HP Comware config parser
- Loading branch information
Showing
16 changed files
with
404 additions
and
0 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
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
5 changes: 5 additions & 0 deletions
5
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_banner_backup.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,5 @@ | ||
# | ||
header motd "my banner" | ||
# | ||
hwtacacs nas-ip 1.1.1.1 | ||
# |
3 changes: 3 additions & 0 deletions
3
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_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,3 @@ | ||
features = [ | ||
{"name": "header", "ordered": True, "section": ["header "]}, | ||
] |
9 changes: 9 additions & 0 deletions
9
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_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 @@ | ||
# | ||
header motd ^C | ||
=================================================== | ||
* GOOD DATA LINE 1 | ||
* BAD DATA LINE 2 | ||
==================================================^C | ||
# | ||
hwtacacs nas-ip 1.1.1.4 | ||
# |
12 changes: 12 additions & 0 deletions
12
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_bad_banner_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"header": { | ||
"compliant": false, | ||
"missing": "header motd ^C\n===================================================\n* GOOD DATA LINE 1\n* BAD DATA LINE 2\n==================================================^C", | ||
"extra": "header motd \"my banner\"", | ||
"cannot_parse": true, | ||
"unordered_compliant": false, | ||
"ordered_compliant": false, | ||
"actual": "header motd \"my banner\"", | ||
"intended": "header motd ^C\n===================================================\n* GOOD DATA LINE 1\n* BAD DATA LINE 2\n==================================================^C" | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_basic_backup.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,48 @@ | ||
sysname HP-JKT-01 | ||
# | ||
dhcp enable | ||
dhcp server forbidden-ip 10.10.10.1 10.10.10.100 | ||
dhcp server always-broadcast | ||
# | ||
dhcp server ip-pool CKP | ||
gateway-list 10.10.10.1 | ||
domain-name intra.data.co.id | ||
expired day 30 | ||
netbios-type b-node | ||
# | ||
bgp 65330 | ||
router-id 10.10.10.254 | ||
graceful-restart | ||
graceful-restart timer restart 120 | ||
graceful-restart timer wait-for-rib 360 | ||
peer 10.20.240.1 description ***Point to Point Connection** | ||
peer 10.20.240.1 ebgp-max-hop 10 | ||
peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx== | ||
address-family ipv4 unicast | ||
balance 4 | ||
peer 10.30.240.1 enable | ||
peer 10.30.240.1 route-policy P2P-FirstTry import | ||
peer 10.30.240.1 route-policy P2P-FirstTry export | ||
# | ||
snmp-agent | ||
snmp-agent local-engineid 8000XXX123456789AB503C00000001 | ||
snmp-agent community read RO | ||
snmp-agent community read read | ||
snmp-agent community read ro | ||
# | ||
acl advanced name HPE | ||
rule 1 permit source 10.180.50.254 0 destination 10.1.0.249 0 | ||
rule 2 permit source 10.180.50.0 0.0.0.127 destination 10.1.4.62 0 | ||
rule 3 permit source 10.180.50.0 0.0.0.127 destination 10.2.4.62 0 | ||
# | ||
header motd # | ||
=================================================== | ||
|
||
!!! WARNING !!! | ||
system monitoring for law enforcement and other | ||
purpose. Unauthorized use of this machine may | ||
subject you to criminal prosecution and penalties | ||
|
||
==================================================# | ||
# | ||
return |
7 changes: 7 additions & 0 deletions
7
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_basic_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,7 @@ | ||
features = [ | ||
{"name": "bgp", "ordered": True, "section": ["bgp "]}, | ||
{"name": "snmp-agent", "ordered": True, "section": ["snmp-server "]}, | ||
{"name": "dhcp", "ordered": False, "section": ["dhcp "]}, | ||
{"name": "header", "ordered": True, "section": ["header "]}, | ||
{"name": "acl", "ordered": True, "section": ["acl "]}, | ||
] |
48 changes: 48 additions & 0 deletions
48
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_basic_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,48 @@ | ||
sysname HP-JKT-01 | ||
# | ||
dhcp enable | ||
dhcp server forbidden-ip 10.10.10.1 10.10.10.100 | ||
dhcp server always-broadcast | ||
# | ||
dhcp server ip-pool CKP | ||
gateway-list 10.10.10.1 | ||
domain-name intra.data.co.id | ||
expired day 30 | ||
netbios-type b-node | ||
# | ||
bgp 65330 | ||
router-id 10.10.10.254 | ||
graceful-restart | ||
graceful-restart timer restart 120 | ||
graceful-restart timer wait-for-rib 360 | ||
peer 10.20.240.1 description ***Point to Point Connection** | ||
peer 10.20.240.1 ebgp-max-hop 10 | ||
peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx== | ||
address-family ipv4 unicast | ||
balance 4 | ||
peer 10.30.240.1 enable | ||
peer 10.30.240.1 route-policy P2P-FirstTry import | ||
peer 10.30.240.1 route-policy P2P-FirstTry export | ||
# | ||
snmp-agent | ||
snmp-agent local-engineid 8000XXX123456789AB503C00000001 | ||
snmp-agent community read RO | ||
snmp-agent community read read | ||
snmp-agent community read ro | ||
# | ||
acl advanced name HPE | ||
rule 1 permit source 10.180.60.254 0 destination 10.1.0.249 0 | ||
rule 2 permit source 10.180.60.0 0.0.0.127 destination 10.1.4.62 0 | ||
rule 3 permit source 10.180.60.0 0.0.0.127 destination 10.2.4.62 0 | ||
# | ||
header motd # | ||
=================================================== | ||
|
||
!!! WARNING !!! | ||
system monitoring for law enforcement and other | ||
purpose. Unauthorized use of this machine may | ||
subject you to criminal prosecution and penalties | ||
|
||
==================================================# | ||
# | ||
return |
52 changes: 52 additions & 0 deletions
52
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"bgp": { | ||
"compliant": true, | ||
"missing": "", | ||
"extra": "", | ||
"cannot_parse": true, | ||
"unordered_compliant": true, | ||
"ordered_compliant": true, | ||
"actual": "bgp 65330\n router-id 10.10.10.254\n graceful-restart\n graceful-restart timer restart 120\n graceful-restart timer wait-for-rib 360\n peer 10.20.240.1 description ***Point to Point Connection**\n peer 10.20.240.1 ebgp-max-hop 10\n peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==\n address-family ipv4 unicast\n balance 4\n peer 10.30.240.1 enable\n peer 10.30.240.1 route-policy P2P-FirstTry import\n peer 10.30.240.1 route-policy P2P-FirstTry export", | ||
"intended": "bgp 65330\n router-id 10.10.10.254\n graceful-restart\n graceful-restart timer restart 120\n graceful-restart timer wait-for-rib 360\n peer 10.20.240.1 description ***Point to Point Connection**\n peer 10.20.240.1 ebgp-max-hop 10\n peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==\n address-family ipv4 unicast\n balance 4\n peer 10.30.240.1 enable\n peer 10.30.240.1 route-policy P2P-FirstTry import\n peer 10.30.240.1 route-policy P2P-FirstTry export" | ||
}, | ||
"snmp-agent": { | ||
"compliant": true, | ||
"missing": "", | ||
"extra": "", | ||
"cannot_parse": true, | ||
"unordered_compliant": true, | ||
"ordered_compliant": true, | ||
"actual": "", | ||
"intended": "" | ||
}, | ||
"dhcp": { | ||
"compliant": true, | ||
"missing": "", | ||
"extra": "", | ||
"cannot_parse": true, | ||
"unordered_compliant": true, | ||
"ordered_compliant": true, | ||
"actual": "dhcp enable\ndhcp server forbidden-ip 10.10.10.1 10.10.10.100\ndhcp server always-broadcast\ndhcp server ip-pool CKP\n gateway-list 10.10.10.1\n domain-name intra.data.co.id\n expired day 30\n netbios-type b-node", | ||
"intended": "dhcp enable\ndhcp server forbidden-ip 10.10.10.1 10.10.10.100\ndhcp server always-broadcast\ndhcp server ip-pool CKP\n gateway-list 10.10.10.1\n domain-name intra.data.co.id\n expired day 30\n netbios-type b-node" | ||
}, | ||
"header": { | ||
"compliant": true, | ||
"missing": "", | ||
"extra": "", | ||
"cannot_parse": true, | ||
"unordered_compliant": true, | ||
"ordered_compliant": true, | ||
"actual": "header motd #\n===================================================\n!!! WARNING !!!\nsystem monitoring for law enforcement and other\npurpose. Unauthorized use of this machine may\nsubject you to criminal prosecution and penalties\n==================================================#", | ||
"intended": "header motd #\n===================================================\n!!! WARNING !!!\nsystem monitoring for law enforcement and other\npurpose. Unauthorized use of this machine may\nsubject you to criminal prosecution and penalties\n==================================================#" | ||
}, | ||
"acl": { | ||
"compliant": false, | ||
"missing": "acl advanced name HPE\n rule 1 permit source 10.180.60.254 0 destination 10.1.0.249 0\n rule 2 permit source 10.180.60.0 0.0.0.127 destination 10.1.4.62 0\n rule 3 permit source 10.180.60.0 0.0.0.127 destination 10.2.4.62 0", | ||
"extra": "acl advanced name HPE\n rule 1 permit source 10.180.50.254 0 destination 10.1.0.249 0\n rule 2 permit source 10.180.50.0 0.0.0.127 destination 10.1.4.62 0\n rule 3 permit source 10.180.50.0 0.0.0.127 destination 10.2.4.62 0", | ||
"cannot_parse": true, | ||
"unordered_compliant": false, | ||
"ordered_compliant": false, | ||
"actual": "acl advanced name HPE\n rule 1 permit source 10.180.50.254 0 destination 10.1.0.249 0\n rule 2 permit source 10.180.50.0 0.0.0.127 destination 10.1.4.62 0\n rule 3 permit source 10.180.50.0 0.0.0.127 destination 10.2.4.62 0", | ||
"intended": "acl advanced name HPE\n rule 1 permit source 10.180.60.254 0 destination 10.1.0.249 0\n rule 2 permit source 10.180.60.0 0.0.0.127 destination 10.1.4.62 0\n rule 3 permit source 10.180.60.0 0.0.0.127 destination 10.2.4.62 0" | ||
} | ||
} |
Oops, something went wrong.