Skip to content

Commit

Permalink
Merge branch 'networktocode:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ritkit authored Dec 23, 2024
2 parents 6aca23f + 068a44a commit 0b7b964
Show file tree
Hide file tree
Showing 15 changed files with 359 additions and 84 deletions.
20 changes: 15 additions & 5 deletions ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,29 @@ Value RECOVERY_TIME (\d+)
Value RECOVERY_MAX (\d+)
Value WTR_RUNNING (\#?)
Value WTR_TIME (\d+)
Value WAIT_TO_SHUTDOWN (\d+)
Value ALIAS (.*)

Start
^\s*-+\+ -> Table
^Legends: WTR - Wait To Restore
^\s+#
^\s+\*
^\s*Slot/\s+Admin\s+Link\s+Violations\s+Recovery\s+Recovery\s+WTR\s+Alias\s*$$
^\s*Port\s+Status\s+Status\s+Time\s+Max\s+\(sec\)\s*$$
^\s+Chas\/\s*$$
^\s*Slot\/\s+Admin\s+Link\s+Violations\s+Recovery\s+Recovery\s+WTR\s+Alias\s*$$
^\s*Port\s+Status\s+Status\s+Time\s+Max\s+\(sec\)\s*$$ -> Table_1
^\s*Slot\/\s+Admin\s+Link\s+WTR\s+WTS\s+Alias\s*$$
^\s*Port\s+Status\s+Status\s+\(sec\)\s+\(msec\)\s*$$ -> Table_2
^\s*$$
^.*$$ -> Error

Table
^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${VIOLATIONS}\s+${RECOVERY_TIME}\s+${RECOVERY_MAX}\s+(?:${WTR_RUNNING}\s+)?${WTR_TIME}\s+"${ALIAS}"\s*$$ -> Record
Table_1
^\s*-+\s*
^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${VIOLATIONS}\s+${RECOVERY_TIME}\s+${RECOVERY_MAX}\s+${WTR_RUNNING}\s+${WTR_TIME}\s+"${ALIAS}"\s*$$ -> Record
^\s*$$
^.*$$ -> Error

Table_2
^\s*-+\s*
^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${WTR_TIME}\s+${WAIT_TO_SHUTDOWN}\s+"${ALIAS}"\s*$$ -> Record
^\s*$$
^.*$$ -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Value INTERFACE (\S+)
Start
^\s+Vlan\s+Mac\s+Address\s+Type\s+Protocol\s+Operation\s+Interface\s+$$
^\s*-+\+
^\s*${ADDRESS_NOT_VALID}${VLAN_ID}\s+${MAC}\s+${TYPE}\s+(---|${PROTOCOL})\s+${OPERATION}\s+${INTERFACE}\s*$$ -> Record
^\s*(?:${ADDRESS_NOT_VALID}\s*)?${VLAN_ID}\s+${MAC}\s+${TYPE}\s+(---|${PROTOCOL})\s+${OPERATION}\s+${INTERFACE}\s*$$ -> Record
^\s*Domain\s+Vlan\/SrvcId\[(ISId\/vnId|:ID)\]\s+Mac\s+Address\s+Type\s+Operation\s+Interface\s*$$
^\s*${DOMAIN}\s+${VLAN_ID}\s+${MAC}\s+${TYPE}\s+${OPERATION}\s+${INTERFACE}\s*$$ -> Record
^\s*Total\s+number\s+of\s+Valid\s+MAC\s+addresses\s+above\s+=\s+\d+\s*$$ -> Record
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
Value Filldown PORT (\S+)
Value Key ONT_ID (\d+)
Value RUN_STATE (\w+)
Value Required RUN_STATE (\w+)
Value LAST_UPTIME (\S+\s*\S+)
Value LAST_DOWNTIME (\S+\s*\S+)
Value LAST_DOWNCAUSE (\S+)

Start
^\s+-
^\s+ONT\s+Run\s+Last\s+Last\s+Last
^\s+ID\s+State\s+UpTime\s+DownTime\s+DownCause -> ONTs
^\s*Command\s*is\s*being\s*executed\.\s*Please\s*wait\s*$$
^\s*-
^\s+ID\s+State\s+UpTime\s+DownTime\s+DownCause\s*$$ -> ONTs
^\s+ONT\s+Run\s+Last\s+Last\s+Last\s*$$
^\s*In\s*port\s*${PORT},\s*the\s*total\s*of\s*ONTs\s*are:\s*\d+,\s*online:\s*\d+\s*$$
^\s*\d+\s*\S+\s*(-|\S+)\s*(-|\d+)\s+(-?\d+\.\d+\/-?\d+\.\d+|\S+)\s+(\S.+\S)\s*$$
^\s+ID\s+\(m\)\s+\(dBm\)
^\s*$$
^. -> Error

ONTs
^\s*-+\s*$$
^\s+${ONT_ID}\s+${RUN_STATE}\s+(-|${LAST_UPTIME})\s*(-|${LAST_DOWNTIME})\s+(-|${LAST_DOWNCAUSE}) -> Record
^\s+-
^\s+ONT\s+SN\s+Type\s+Distance\s+Rx\/Tx\s+power\s+Description
^\s+ID\s+\(m\)\s+\(dBm\) -> EOF
^\s+ONT\s+SN\s+Type\s+Distance\s+Rx\/Tx\s+power\s+Description\s*$$ -> Start
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ Value Key ONT_ID (\d+)
Value SERIAL_NUMBER (\w+)
Value ONT_MODEL_TYPE (\S+)
Value DISTANCE_M (\d+|-)
Value RX_TX_POWER_DBM (-?\d+\.\d+\/-?\d+\.\d+|\S+)
Value DESCRIPTION (\S+)
Value RX_POWER_DBM (-?\d+\.\d+)
Value TX_POWER_DBM (-?\d+\.\d+)
Value DESCRIPTION (\S.+\S)

Start
^\s*Command\s*is\s*being\s*executed\.\s*Please\s*wait\s*$$
^\s*In\s*port\s*\S+,\s*the\s*total\s*of\s*ONTs\s*are:\s*\d+,\s*online:\s*\d+\s*$$
^\s*ONT\s*Run\s*Last\s*Last\s*Last\s*$$
^\s*ID\s*State\s*UpTime\s*DownTime\s*DownCause\s*$$
^\s*\d+\s*\S+\s*(-|\S+\s\S+)\s*(-|\S+\s*\S+)\s*\S+\s*$$
^\s+-
^\s+ONT\s+SN\s+Type\s+Distance\s+Rx\/Tx\s+power\s+Description
^\s+ID\s+\(m\)\s+\(dBm\) -> SNs

SNs
^\s+${ONT_ID}\s+${SERIAL_NUMBER}\s+${ONT_MODEL_TYPE}\s+${DISTANCE_M}\s+${RX_TX_POWER_DBM}\s+${DESCRIPTION} -> Record
^\s+-
^\s+-\s*$$
^\s*$$
^. -> Error

SNs
^\s+-\s*$$
^\s+${ONT_ID}\s+${SERIAL_NUMBER}\s+${ONT_MODEL_TYPE}\s+${DISTANCE_M}\s+(-|${RX_POWER_DBM})\/(-|${TX_POWER_DBM})\s+${DESCRIPTION} -> Record
^\s*$$ -> Start
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
Expand All @@ -18,6 +19,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
Expand All @@ -28,6 +30,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: "#"
wtr_time: "10"
- admin_status: "disable"
Expand All @@ -38,6 +41,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
- admin_status: "disable"
Expand All @@ -48,6 +52,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
Expand All @@ -58,6 +63,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
Expand All @@ -68,6 +74,7 @@ parsed_sample:
recovery_max: "10"
recovery_time: "300"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
Expand All @@ -78,5 +85,6 @@ parsed_sample:
recovery_max: "0"
recovery_time: "0"
violations: "none"
wait_to_shutdown: ""
wtr_running: ""
wtr_time: "0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Chas/
Slot/ Admin Link WTR WTS Alias
Port Status Status (sec) (msec)
--------+----------+---------+----------+----------+-----------------------
1/1/1 enable up 0 0 "This is a test"
1/1/2 enable up 0 0 "This_is_a_test"
1/1/3 enable up 0 0 "This"
1/1/4 enable up 0 0 ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
parsed_sample:
- admin_status: "enable"
alias: "This is a test"
link_status: "up"
permanent_shutdown: ""
port: "1/1/1"
recovery_max: ""
recovery_time: ""
violations: ""
wait_to_shutdown: "0"
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
alias: "This_is_a_test"
link_status: "up"
permanent_shutdown: ""
port: "1/1/2"
recovery_max: ""
recovery_time: ""
violations: ""
wait_to_shutdown: "0"
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
alias: "This"
link_status: "up"
permanent_shutdown: ""
port: "1/1/3"
recovery_max: ""
recovery_time: ""
violations: ""
wait_to_shutdown: "0"
wtr_running: ""
wtr_time: "0"
- admin_status: "enable"
alias: ""
link_status: "up"
permanent_shutdown: ""
port: "1/1/4"
recovery_max: ""
recovery_time: ""
violations: ""
wait_to_shutdown: "0"
wtr_running: ""
wtr_time: "0"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ Legend: Mac Address: * = address not valid

Vlan Mac Address Type Protocol Operation Interface
------+-------------------+--------------+-----------+------------+-----------
*1 aa:aa:aa:aa:aa:aa permanent --- bridging 1/1
* 1 aa:aa:aa:aa:aa:aa permanent --- bridging 1/1
2 bb:bb:bb:bb:bb:bb learned --- bridging 1/1
3 cc:cc:cc:cc:cc:cc learned --- bridging 1/1
4 dd:dd:dd:dd:dd:dd learned --- bridging 1/1
4 dd:dd:dd:dd:dd:dd learned --- bridging 1/1
* 999 ee:ee:ee:ee:ee:ee permanent 0 bridging 1/11

Total number of Valid MAC addresses above = 4
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ parsed_sample:
protocol: ""
type: "learned"
vlan_id: "4"
- address_not_valid: "*"
domain: ""
interface: "1/11"
mac: "ee:ee:ee:ee:ee:ee"
operation: "bridging"
protocol: "0"
type: "permanent"
vlan_id: "999"
Loading

0 comments on commit 0b7b964

Please sign in to comment.