Skip to content

Commit

Permalink
Add zte zxros templates (#1770)
Browse files Browse the repository at this point in the history
* add support zte_zxros

* add zte_zxros_show_mpls_traffic-eng_tunnels

* add inlabel_id and outlabel_id

* add IP_ROUTE

* Fix templates

---------

Co-authored-by: lutfisan <[email protected]>
  • Loading branch information
jmcgill298 and lutfisan authored Jul 20, 2024
1 parent ee792df commit 558dd69
Show file tree
Hide file tree
Showing 20 changed files with 1,825 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,13 @@ watchguard_firebox_show_arp.textfsm, .*, watchguard_firebox, sh[[ow]] arp
yamaha_show_environment.textfsm, .*, yamaha, sh[[ow]] en[[vironment]]
yamaha_show_ip_route.textfsm, .*, yamaha, sh[[ow]] ip ro[[ute]]

zte_zxros_show_mpls_traffic-eng_tunnels.textfsm, .*, zte_zxros, sh[[ow]] mpls traffic-eng tunnels
zte_zxros_show_interface_brief.textfsm, .*, zte_zxros, sh[[ow]] inter[[face]] br[[ief]]
zte_zxros_show_isis_adjacency.textfsm, .*, zte_zxros, sh[[ow]] is[[is]] ad[[jacency]]
zte_zxros_show_interface.textfsm, .*, zte_zxros, sh[[ow]] int[[erface]]
zte_zxros_show_version.textfsm, .*, zte_zxros, sh[[ow]] ver[[sion]]
zte_zxros_show_arp.textfsm, .*, zte_zxros, sh[[ow]] arp

zyxel_os_cfg_lan_get_--Name_name.textfsm, .*, zyxel_os, cfg lan get --Name .+
zyxel_os_zycli_Ethctl_media-type.textfsm, .*, zyxel_os, zycli Ethctl media-type(\s\w+)*
zyxel_os_cfg_firewall_acl_get.textfsm, .*, zyxel_os, cfg firewall(\s|_)acl get
Expand Down
21 changes: 21 additions & 0 deletions ntc_templates/templates/zte_zxros_show_arp.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Value ADDRESS (\d+\.\d+\.\d+\.\d+)
Value AGE (\S+)
Value MAC_ADDRESS (\S+)
Value List INTERFACE (\S+)
Value STATE (\S+)
Value EXTERNAL_VLAN (\d+|N/A)
Value INTERNAL_VLAN (\d+|N/A)
Value List SUB_INTERFACE (\S+)

Start
^\d+\.\d+\.\d+\.\d+ -> Continue.Record
^${ADDRESS}\s+${AGE}\s+${MAC_ADDRESS}\s+${INTERFACE}\s+${EXTERNAL_VLAN}\s+${INTERNAL_VLAN}\s+${SUB_INTERFACE}\s*$$
^\s+${INTERFACE}\s*$$
^\s+${INTERFACE}(\s+${SUB_INTERFACE})?\s*$$
^Arp\s+protect
^The\s+count\s+is\s+\d+
^IP\s+Hardware\s+Exter\s+Inter\s+Sub
^Address\s+Age\s+Address\s+Interface\s+VlanID\s+VlanID\s+Interface
^-+
^\s*$$
^. -> Error
58 changes: 58 additions & 0 deletions ntc_templates/templates/zte_zxros_show_interface.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Value Required INTERFACE (\S+)
Value LINK_STATUS (.+?)
Value INTERFACE_INDEX (\d+)
Value DESCRIPTION (.*?)
Value PROTOCOL_STATUS (.+?)
Value IPV4_PROTOCOL (.+?)
Value IPV6_PROTOCOL (.+?)
Value DETECT_STATUS (\S+)
Value UPTIME (.+?)
Value HARDWARE_TYPE (.+?)
Value MAC_ADDRESS (\S+)
Value IP_ADDRESS (\S+?)
Value MASK (\d*)
Value BANDWITH (.+?)
Value List MTU (\d+)

Start
^\S -> Continue.Record
^${INTERFACE}\s+is\s+${LINK_STATUS},\s+ifindex:\s+${INTERFACE_INDEX}\s*$$
^\s+Description:\s+${DESCRIPTION}\s*$$
^\s+Line\s+protocol\s+is\s+${PROTOCOL_STATUS},\s+IPv4\s+protocol\s+is\s+${IPV4_PROTOCOL},\s+IPv6\s+protocol\s+is\s+${IPV6_PROTOCOL},\s*$$
^\s+detected\s+status\s+is\s+${DETECT_STATUS}\s*$$
^\s+Last\s+line\s+protocol\s+up\s+time\s+:\s+${UPTIME}\s*$$
^\s+Hardware\s+is\s+${HARDWARE_TYPE},\s+address\s+is\s+${MAC_ADDRESS}\s*$$
^\s+Internet\s+address\s+is\s+${IP_ADDRESS}/?${MASK}\s*$$
^\s+BW\s+${BANDWITH}\s*$$
^\s+IP\s+MTU\s+${MTU}\s+bytes
^\s+MTU\s+${MTU}\s+bytes
^\s+IPv6\s+MTU\s+${MTU}\s+bytes
^\s+MPLS\s+MTU\s+${MTU}\s+bytes
^\s+The\s+interface\s+is
^\s+Fec-(eth|bypass)\s+:
^\s+ARP\s+(type|Timeout)
^\s+Last\s+Clear\s+Time
^\s+Rate\s+period
^\s+Input\s+:
^\s+Output\s+:
^\s+Peak\s+rate:
^\s+Intf\s+utilization:
^\s+HardwareCounters:
^\s+In_Bytes
^\s+In_Broadcasts
^\s+In_Unicasts
^\s+In_Fragments
^\s+In_65_127B
^\s+In_256_511B
^\s+In_1024_1518B
^\s+In_Undersize
^\s+E_Bytes
^\s+E_Broadcasts
^\s+E_Unicasts
^\s+E_64B
^\s+E_128_255B
^\s+E_512_1023B
^\s+E_1519_MaxB
^\s+StreamCounters
^\s*$$
^. -> Error
14 changes: 14 additions & 0 deletions ntc_templates/templates/zte_zxros_show_interface_brief.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Value INTERFACE (\S+)
Value ATTRIBUTE (\S+)
Value MODE (\S+)
Value BW (\S+)
Value ADMIN (up|down|administratively down)
Value PHYSICAL (up|down|administratively down)
Value PROTOCOL (up|down|administratively down)
Value DESCRIPTION (\S.*?)

Start
^Interface\s+Attribute\s+Mode\s+BW\s+Admin\s+Phy\s+Prot\s+Description
^${INTERFACE}\s+${ATTRIBUTE}\s+${MODE}\s+${BW}\s+${ADMIN}\s+${PHYSICAL}\s+${PROTOCOL}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$
^. -> Error
18 changes: 18 additions & 0 deletions ntc_templates/templates/zte_zxros_show_isis_adjacency.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Value Filldown CONTEXT (\d+)
Value Required INTERFACE (\S+)
Value SYSTEM_ID ((\d+.\d+.\d+)|\S+)
Value STATE (\S+)
Value LEV (\S+)
Value HOLD_TIME (\d+)
Value SNPA ((\d+.\d+.\d+)|\S+)
Value PRI (\S+)
Value MT (\S+)
Value NSF (\S+)
Value AF (\S+)

Start
^Process\s+ID:\s+${CONTEXT}\s*$$
^Interface\s+System\s+id\s+State\s+Lev\s+Holds\s+SNPA\S*\s+Pri\s+MT\s+NSF\s+AF\s*$$
^${INTERFACE}\s+${SYSTEM_ID}\s+${STATE}\s+${LEV}\s+${HOLD_TIME}\s+${SNPA}\s+${PRI}\s+${MT}?\s+${NSF}\s+${AF}\s*$$ -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Value Required NAME (\S+)
Value DESC (\S+)
Value DEST (\S+)
Value ADMIN (\S+)
Value OPER (\S+)
Value PATH (\S+)
Value SIGNAL (\S+)
Value INLABEL (\S+)
Value INLABEL_ID (\d+)
Value OUTLABEL (\S+)
Value OUTLABEL_ID (\d+)
Value SRC (\S+)
Value DST (\S+)
Value ID (\d+)
Value INSTANCE (\d+)
Value List IP_ROUTE (\d+\.\d+\.\d+\.\d+|NONE)


Start
^Name: -> Continue.Record
^Name:\s+${NAME}\s*$$
^\s+${DESC}\s+Destination:\s+${DEST}\s*$$
^\s+Admin:\s+${ADMIN}\s+Oper:\s+${OPER}\s+Path:\s+${PATH}\s+Signalling:\s+${SIGNAL}\s*$$
^\s+Signalling:\s+${SIGNAL}\s*$$
^\s+InLabel:\s+${INLABEL}(,\s+${INLABEL_ID})?\s*$$
^\s+OutLabel:\s+${OUTLABEL}(,\s+${OUTLABEL_ID})?\s*$$
^\s+Src\s+${SRC},\s+Dst\s+${DST},\s+Tun-ID\s+${ID},\s+Tun-Instance\s+${INSTANCE}\s*$$
^\s+Explicit\s+Route:\s+${IP_ROUTE},*\s*$$
^\s+Explicit\s+Route:\s+${IP_ROUTE},* -> Continue
^\s+Explicit\s+(?:\S+\s+){2}${IP_ROUTE},*\s*$$
^\s+Explicit\s+(?:\S+\s+){2}${IP_ROUTE},* -> Continue
^\s+Explicit\s+(?:\S+\s+){3}${IP_ROUTE},*\s*$$
^\s+Explicit\s+(?:\S+\s+){3}${IP_ROUTE},* -> Continue
^\s+Explicit\s+(?:\S+\s+){4}${IP_ROUTE},*\s*$$
^\s+Explicit\s+(?:\S+\s+){4}${IP_ROUTE},* -> Continue
^\s+Explicit\s+(?:\S+\s+){5}${IP_ROUTE},*\s*$$
^\s+${IP_ROUTE},*\s*$$
^\s+${IP_ROUTE},* -> Continue
^\s+\d+\.\d+\.\d+\.\d+\s+${IP_ROUTE},*\s*$$
^\s+\d+\.\d+\.\d+\.\d+\s+${IP_ROUTE},* -> Continue
^\s+(?:\d+\.\d+\.\d+\.\d+\s+){2}${IP_ROUTE},*\s*$$
^\s+(?:\d+\.\d+\.\d+\.\d+\s+){2}${IP_ROUTE},* -> Continue
^\s+(?:\d+\.\d+\.\d+\.\d+\s+){3}${IP_ROUTE},*\s*$$
^\s+(?:\d+\.\d+\.\d+\.\d+\s+){3}${IP_ROUTE},* -> Continue
^\s+(?:\d+\.\d+\.\d+\.\d+\s+){4}${IP_ROUTE},*\s*$$
^\s+Status:
^\s+Path\s+option:
^\s+Pre-setup\s+Path
^\s+Actual\s+Bandwidth
^\s+Hot-standby
^\s+protect\s+option
^\s+PCE
^\s+Active-MPLS-binding-SID
^\s+Config\s+Parameters:
^\s+Resv-Style
^\s+Metric\s+Type
^\s+Hop\s+Prior
^\s+Hot\s+Hop\s+Limit
^\s+Record-Route
^\s+(Facility|Detour)\s+Fast-reroute
^\s+Protect\s+(Coexist|Nest)
^\s+Main\s+LSP\s+Fast-reroute
^\s+Bandwidth
^\s+Hot-standby-lsp
^\s+E2E
^\s+BFD
^\s+Policy\s+Class
^\s+Track\s+Name
^\s+Auto-reoptimize
^\s+Reference
^\s+Tunnel-Status
^\s+CBS
^\s+(Main|HSB|FRR)\s+affinity:
^\s+Exclude-any
^\s+Include-any
^\s+Include-all
^\s+AutoRoute
^\s+AUTO-BW
^\s+Forwarding-adjacency
^\s+Co-routed\s+Bidirect
^\s+Associated\s+Bidirect
^\s+Rate-limit
^\s+Crankback
^\s+Soft\s+Preemption
^\s+Addresses\s+of\s+preempting\s+links
^\s+Graceful\s+shutdown
^\s+Without-CSPF
^\s+Ultralimit
^\s+Advertise
^\s+LSP\s+recoverd
^\s+RSVP\s+(Signalling|Path|Resv)
^\s+(Exclude|Record)\s+Route: -> IgnoreRouting
^\s
^\s+History: -> Logs
^\s*$$
^. -> Error

IgnoreRouting
^\s+(Exclude|Record)\s+Route:
^\s+(\d+\.){3}\d+(?:\s*\(\d+\))?
^\s+(F|T)spec -> Start
^\s*$$
^. -> Error

Logs
# Log data is unpredictable, and we can be confident important data has been captured by this point
^Name: -> Continue.Record
^Name:\s+${NAME}\s*$$ -> Start
13 changes: 13 additions & 0 deletions ntc_templates/templates/zte_zxros_show_version.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Value HARDWARE (.+)
Value VERSION (.+)
Value UPTIME (.+?)


Start
^ZXCTN${HARDWARE}
^ZTE.+Software,\s+Version:\s+${VERSION},\s+Release\s+software
^.+uptime\s+is\s+${UPTIME}\s*$$ -> EOF
^Copyright
^System\s+image
^\s*$$
^. -> Error
1 change: 1 addition & 0 deletions tests/test_index_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"vyos",
"watchguard_firebox",
"yamaha",
"zte_zxros",
"zyxel_os",
]
CHOICES_STRING = "|".join(OS_CHOICES)
Expand Down
38 changes: 38 additions & 0 deletions tests/zte_zxros/show_arp/zte_zxros_show_arp.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Arp protect whole is disabled
The count is 17
IP Hardware Exter Inter Sub
Address Age Address Interface VlanID VlanID Interface
--------------------------------------------------------------------------------
10.10.255.1 H 744a.a42b.2010 xgei-1/1/0/1 201 N/A N/A
.201
10.10.255.2 00:14:17 0427.5873.0b65 xgei-1/1/0/1 201 N/A xgei-1/1/0/1.
.201 201
10.10.10.249 H 744a.a42b.2010 xgei-1/1/0/1 301 N/A N/A
.301
10.10.10.250 00:14:17 0427.5873.0b65 xgei-1/1/0/1 301 N/A xgei-1/1/0/1.
.301 301
10.10.10.25 H 744a.a42b.2010 xgei-1/1/0/1 401 N/A N/A
.401
10.10.10.26 00:14:17 0427.5873.0b65 xgei-1/1/0/1 401 N/A xgei-1/1/0/1.
.401 401
10.10.10.253 H 744a.a42b.2010 xgei-1/1/0/1 1001 N/A N/A
.1001
10.10.10.254 00:14:17 0427.5873.0b65 xgei-1/1/0/1 1001 N/A xgei-1/1/0/1.
.1001 1001
10.102.195.181 H 744a.a42b.2010 xgei-1/1/0/2 3100 N/A N/A
.3100
10.102.195.182 00:00:39 8cdf.9d27.35c0 xgei-1/1/0/2 3100 N/A xgei-1/1/0/2.
.3100 3100
10.89.255.201 H 744a.a42b.2010 xgei-1/1/0/2 3901 N/A N/A
.3901
10.89.255.202 00:15:00 0020.85f8.5d58 xgei-1/1/0/2 3901 N/A xgei-1/1/0/2.
.3901 3901
10.10.184.255 H 744a.a42b.2010 xxvgei-1/1/0 N/A N/A N/A
/20
10.10.184.254 01:20:43 744a.a42b.1fe8 xxvgei-1/1/0 N/A N/A xxvgei-1/1/0/
/20 20
10.10.185.2 H 744a.a42b.2010 xxvgei-1/1/0 N/A N/A N/A
/24
10.10.185.3 03:09:39 744a.a42b.d358 xxvgei-1/1/0 N/A N/A xxvgei-1/1/0/
/24 24
192.168.1.11 H 744a.a42b.2011 mgmt_eth N/A N/A N/A
Loading

0 comments on commit 558dd69

Please sign in to comment.