Skip to content

Commit

Permalink
Huawei - display acl all - add rule description
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard Lavaud authored and k-ribot committed Dec 5, 2022
1 parent a60cb92 commit 103c2f1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ntc_templates/templates/huawei_vrp_display_acl_all.textfsm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Value Filldown ACL_NAME (.*?)
Value Filldown ACL_NUMBER (\d+)
Value Required SN (\d+)
Value ACTION (deny|permit)
Value Required ACTION (deny|permit)
Value PROTOCOL (\d+|icmp(v6)?|tcp|udp|gre|igmp|ip(v6)?|ipinip|ospf)
Value SOURCE (((\d+.){3}\d+|[0-9a-fA-F]{1,4}([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4})[\/\s]((\d+.){3}\d+|\d+))
Value SOURCE_PORT_MODIFIER (eq|lt|gt|range)
Expand All @@ -10,13 +10,18 @@ Value DESTINATION (((\d+.){3}\d+|[0-9a-fA-F]{1,4}([0-9a-fA-F]{0,4}:){1,7}[0-9a-f
Value DESTINATION_PORT_MODIFIER (eq|lt|gt|range)
Value DESTINATION_PORT_RANGE ((\S+)(\s(\S+))?)
Value MATCHES (\d+)
Value DESCRIPTION (.*)

Start
^\s*rule\s\d+\s(deny|permit) -> Continue.Record
^\S+\sIPv6\sACL\s -> Continue.Record
^\S+\sACL\s -> Continue.Record
^\s*Total\squantity\sof\snonempty\sACL\snumber\sis\s\d+\s*$$
^\s*Total\snonempty\sacl6\snumber\sis\s\d+\s*$$
^\S+\sIPv6\sACL\s${ACL_NUMBER}(\sname\s${ACL_NAME})?,\s\d+.*$$
^\S+\sACL\s(${ACL_NAME}\s)?${ACL_NUMBER},\s\d+.*$$
^\S+\sIPv6\sACL\s${ACL_NUMBER}(\sname\s${ACL_NAME})?,\s\d+\srules?.*$$
^\S+\sACL\s(${ACL_NAME}\s)?${ACL_NUMBER},\s\d+\srules?.*$$
^\s*Acl's\sstep\sis\s\d+\s*$$
^\s*rule\s${SN}\s${ACTION}(\s${PROTOCOL})?(\ssource\s${SOURCE})?(\ssource-port\s${SOURCE_PORT_MODIFIER}\s${SOURCE_PORT_RANGE})?(\sdestination\s${DESTINATION})?(\sdestination-port\s${DESTINATION_PORT_MODIFIER}\s${DESTINATION_PORT_RANGE})?(\s\(${MATCHES}\smatch(es)?\))?\s*$$ -> Record
^\s*rule\s${SN}\s${ACTION}(\s${PROTOCOL})?(\ssource\s${SOURCE})?(\ssource-port\s${SOURCE_PORT_MODIFIER}\s${SOURCE_PORT_RANGE})?(\sdestination\s${DESTINATION})?(\sdestination-port\s${DESTINATION_PORT_MODIFIER}\s${DESTINATION_PORT_RANGE})?(\s\(${MATCHES}\smatch(es)?\))?\s*$$
^\s*rule\s\d+\sdescription\s"${DESCRIPTION}"\s*$$
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Acl's step is 5
Advanced ACL 3997, 1 rule
Acl's step is 5
rule 5 permit ip source 192.165.3.5 0
rule 5 description "qsdqsdqsdqsdqsdqsdqs az"

Advanced ACL REGLE_NAT 3998, 3 rules
Acl's step is 5
Expand Down
13 changes: 13 additions & 0 deletions tests/huawei_vrp/display_acl_all/huawei_vrp_display_acl_all_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: "94"
description: ""
- acl_name: ""
acl_number: "2000"
sn: "10"
Expand All @@ -24,6 +25,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: "26939"
description: ""
- acl_name: ""
acl_number: "2000"
sn: "15"
Expand All @@ -36,6 +38,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: "24"
description: ""
- acl_name: ""
acl_number: "2000"
sn: "20"
Expand All @@ -48,6 +51,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""
- acl_name: ""
acl_number: "2000"
sn: "25"
Expand All @@ -60,6 +64,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""
- acl_name: ""
acl_number: "2000"
sn: "30"
Expand All @@ -72,6 +77,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""
- acl_name: ""
acl_number: "2000"
sn: "35"
Expand All @@ -84,6 +90,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""
- acl_name: ""
acl_number: "2500"
sn: "35"
Expand All @@ -96,6 +103,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: "5431"
description: ""
- acl_name: ""
acl_number: "3997"
sn: "5"
Expand All @@ -108,6 +116,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: "qsdqsdqsdqsdqsdqsdqs az"
- acl_name: "REGLE_NAT"
acl_number: "3998"
sn: "5"
Expand All @@ -120,6 +129,7 @@ parsed_sample:
destination_port_modifier: "eq"
destination_port_range: "8022"
matches: "18"
description: ""
- acl_name: "REGLE_NAT"
acl_number: "3998"
sn: "10"
Expand All @@ -132,6 +142,7 @@ parsed_sample:
destination_port_modifier: "eq"
destination_port_range: "www"
matches: "8"
description: ""
- acl_name: "REGLE_NAT"
acl_number: "3998"
sn: "15"
Expand All @@ -144,6 +155,7 @@ parsed_sample:
destination_port_modifier: "range"
destination_port_range: "50 80"
matches: "8"
description: ""
- acl_name: "REGLE_NAT"
acl_number: "3998"
sn: "20"
Expand All @@ -156,3 +168,4 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: "278450"
description: ""
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""
- acl_name: "MyACL_IPv6"
acl_number: "3999"
sn: "5"
Expand All @@ -24,6 +25,7 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""
- acl_name: "MyACL_IPv6"
acl_number: "3999"
sn: "10"
Expand All @@ -36,3 +38,4 @@ parsed_sample:
destination_port_modifier: ""
destination_port_range: ""
matches: ""
description: ""

0 comments on commit 103c2f1

Please sign in to comment.