-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
299 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
48 changes: 48 additions & 0 deletions
48
tests/unit/mock/config/compliance/compliance/hp_comware/hp_comware_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_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_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_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" | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
tests/unit/mock/config/parser/base/hp_comware/hp_comware_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,38 @@ | ||
from netutils.config.parser import ConfigLine | ||
|
||
data = [ | ||
ConfigLine(config_line="sysname HP-JKT-01", parents=()), | ||
ConfigLine(config_line="dhcp enable", parents=()), | ||
ConfigLine(config_line="dhcp server forbidden-ip 10.10.10.1 10.10.10.100", parents=()), | ||
ConfigLine(config_line="dhcp server always-broadcast", parents=()), | ||
ConfigLine(config_line="dhcp server ip-pool CKP", parents=()), | ||
ConfigLine(config_line=" gateway-list 10.10.10.1", parents=("dhcp server ip-pool CKP",)), | ||
ConfigLine(config_line=" domain-name intra.data.co.id", parents=("dhcp server ip-pool CKP",)), | ||
ConfigLine(config_line=" expired day 30", parents=("dhcp server ip-pool CKP",)), | ||
ConfigLine(config_line=" netbios-type b-node", parents=("dhcp server ip-pool CKP",)), | ||
ConfigLine(config_line="bgp 65330", parents=()), | ||
ConfigLine(config_line=" router-id 10.10.10.254", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" graceful-restart", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" graceful-restart timer restart 120", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" graceful-restart timer wait-for-rib 360", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" peer 10.20.240.1 description ***Point to Point Connection**", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" peer 10.20.240.1 ebgp-max-hop 10", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==", parents=("bgp 65330",)), | ||
ConfigLine(config_line=" address-family ipv4 unicast", parents=("bgp 65330"," peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==")), | ||
ConfigLine(config_line=" balance 4", parents=("bgp 65330"," peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==")), | ||
ConfigLine(config_line=" peer 10.30.240.1 enable", parents=("bgp 65330"," peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==")), | ||
ConfigLine(config_line=" peer 10.30.240.1 route-policy P2P-FirstTry import", parents=("bgp 65330"," peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==")), | ||
ConfigLine(config_line=" peer 10.30.240.1 route-policy P2P-FirstTry export", parents=("bgp 65330"," peer 10.30.240.1 password cipher $x$x$xxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx==")), | ||
ConfigLine(config_line="snmp-agent", parents=()), | ||
ConfigLine(config_line="snmp-agent local-engineid 8000XXX123456789AB503C00000001", parents=()), | ||
ConfigLine(config_line="snmp-agent community read RO", parents=()), | ||
ConfigLine(config_line="snmp-agent community read read", parents=()), | ||
ConfigLine(config_line="snmp-agent community read ro", parents=()), | ||
ConfigLine(config_line="acl advanced name HPE", parents=()), | ||
ConfigLine(config_line=" rule 1 permit source 10.180.50.254 0 destination 10.1.0.249 0", parents=("acl advanced name HPE",)), | ||
ConfigLine(config_line=" rule 2 permit source 10.180.50.0 0.0.0.127 destination 10.1.4.62 0", parents=("acl advanced name HPE",)), | ||
ConfigLine(config_line=" rule 3 permit source 10.180.50.0 0.0.0.127 destination 10.2.4.62 0", parents=("acl advanced name HPE",)), | ||
ConfigLine(config_line="header motd #", parents=()), | ||
ConfigLine(config_line="===================================================\n!!! WARNING !!!\nsystem monitoring for law enforcement and other\npurpose. Unauthorized use of this machine may\nsubject you to criminal prosecution and penalties\n==================================================#", parents=("header motd #",)), | ||
ConfigLine(config_line="return", parents=()), | ||
] |
48 changes: 48 additions & 0 deletions
48
tests/unit/mock/config/parser/base/hp_comware/hp_comware_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,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 |