Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1376 juniper junos show interfaces #1392

Merged
Merged
45 changes: 39 additions & 6 deletions ntc_templates/templates/juniper_junos_show_interfaces.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,52 @@ Value Required INTERFACE (\S+)
Value LINK_STATUS (\w+)
Value ADMIN_STATE (\S+)
Value HARDWARE_TYPE (\S+)
Value DESCRIPTION (\w+.*)
Value DESCRIPTION (.*)
Value DESTINATION (\S+)
Value LOCAL (\S+)
Value MTU (\d+|Unlimited)

Start
^\s*\S+\s+interface -> Continue.Record
## ^\s*\S+\s+[Ii]nterface -> Continue.Record
^\s*$$ -> Record
^Physical\s+interface:\s+${INTERFACE},\s+${ADMIN_STATE},\s+Physical\s+link\s+is\s+${LINK_STATUS}
^.*Description:\s+${DESCRIPTION}
^.*ype:\s+${HARDWARE_TYPE},.*MTU:\s+${MTU}.*
^\s+Interface index:
^\s+Description:\s+${DESCRIPTION}$$
# match "Type: xx, Link-level type:" and " Link-level type:"
^.*\s+Link-level\s+type:\s+${HARDWARE_TYPE},\s+MTU:\s+${MTU}(,.+)?$$
^\s+Pad to minimum frame size:
^\s+Link-mode
^\s+MAC-REWRITE
^\s+Flow control
^\s+Device [Ff]lags
^\s+Interface flags
^\s+Link flags
^\s+Physical info
^\s+CoS queues
^\s+Schedulers
^\s+Current address
^\s+Last flapped
^\s+Input rate
^\s+Output rate
^\s+Active alarms
^\s+Active defects
^\s+PCS statistics
^\s+Bit errors
^\s+Errored blocks
^\s+Interface transmit statistics
#
^\s+Logical\s+interface\s+${INTERFACE}
^\s+Flags:\s+${LINK_STATUS}\s+\S+\s+\w+\s+(\S+\s+)*Encapsulation:
^\s+Protocol\s+inet.*,\s+MTU:\s+${MTU}
^.*Destination:\s+${DESTINATION},\s+Local:\s+${LOCAL},.*
^\s*$$
^\s{2,4}Flags
^\s+Input packets
^\s+Output packets
^\s+Security
^\s+Protocol
^\s{6}Flags
^\s{6}Address
^\s+Destination:\s+${DESTINATION},\s+Local:\s+${LOCAL},.*
^\s+MAC:
^{master:\d+}
^\s*$$
^. -> Error
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def cli(context):
context.run(f"{dev}", pty=True)


@task(help={"local": "Run locally or within the Docker container"})
@task(help={"local": "Run locally or within the Docker container"}, aliases=["test"])
def tests(context, local=INVOKE_LOCAL):
"""Run all tests for this repository."""
black(context, local)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Physical interface: xe-0/1/0, Enabled, Physical link is Up
Interface index: 153, SNMP ifIndex: 564
Description: ### My description - remote host - remote location - feature codes - info here ###
Link-level type: Ethernet, MTU: 9114, MRU: 9122, LAN-PHY mode, Speed: 10Gbps, BPDU Error: None, Loop Detect PDU Error: None, MAC-REWRITE Error: None, Loopback: None, Source filtering: Disabled, Flow control: Enabled, Speed Configuration: 1G
Pad to minimum frame size: Disabled
Device flags : Present Running
Interface flags: SNMP-Traps Internal: 0x4000
Link flags : None
CoS queues : 8 supported, 8 maximum usable queues
Schedulers : 0
Current address: 0a:aa:aa:aa:aa:aa, Hardware address: 0a:aa:aa:aa:aa:aa
Last flapped : 2022-07-28 21:30:59 GMT (43w0d 15:54 ago)
Input rate : 648 bps (1 pps)
Output rate : 968 bps (0 pps)
Active alarms : None
Active defects : None
PCS statistics Seconds
Bit errors 1
Errored blocks 0
Interface transmit statistics: Disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
parsed_sample:
- admin_state: "Enabled"
description: "### My description - remote host - remote location - feature codes\
\ - info here ###"
destination: ""
hardware_type: "Ethernet"
interface: "xe-0/1/0"
link_status: "Up"
local: ""
mtu: "9114"
Loading