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 regex: Update VyOS template to match addresses without netmask de… #608

Merged
merged 3 commits into from
Mar 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions templates/vyatta_vyos_show_interfaces.textfsm
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Value INTERFACE (\S+)
Value List IP_ADDRESS ((?:[A-Fa-f0-9:\.]+\/\d+)|-)
Value List IP_ADDRESS (\S+)
Value STATUS (\S+)
Value DESCRIPTION (.+?)

Start
^Codes:
^Interface\s+IP\s+Address\s+S/L\s+Description\s*$$ -> Interface
^Interface\s+IP\s+Address\s+S/L\s+Description
^-+\s+-+\s+-+\s+-+$$ -> Interface
^\s*$$
^. -> Error

Interface
^\S+\s+ -> Continue.Record
^${INTERFACE}\s+${IP_ADDRESS}\s+${STATUS}\s+(${DESCRIPTION}|)\s*$$
^\s+${IP_ADDRESS}\s*$$
^-+\s+-+\s+-+\s+-+$$
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 - u/u
eth0.42 172.11.100.1/31 u/u Utside
eth0.40 123.123.120.123/27 u/u OUTSIDE
eth1 - u/u
eth1.1727 172.11.100.11/31 u/u SERVICES-LINK
eth1.1800 172.11.100.3/31 u/u DS-LAN
eth1.1801 172.11.100.5/31 u/u Link
eth1.1804 172.11.100.7/31 u/u TEST-NET
eth1.204 123.123.123.81/28 u/u CUST-DS-LAN
eth1.269 172.18.32.14/28 u/u CUST-COM
123.123.123.123/32
eth1.437 123.123.116.169/29 u/u CUST-VIDEO
eth1.1753 172.18.161.196/29 u/u SERVICE-LINK
eth2 - u/u
eth2.1802 172.18.254.3/31 u/u SYNC
fe80:3023:1234:d::3/127
lo 127.0.0.1/8 u/u
172.18.255.3/32
172.18.255.110/32
::1/128
vtun0 192.168.80.2 u/u
vtun1 192.168.80.4 u/u OpenVPN-TUNNEL1
vtun2 192.168.80.6 u/u

54 changes: 32 additions & 22 deletions tests/vyatta_vyos/show_interfaces/vyatta_vyos_show_interfaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,61 @@ parsed_sample:
ip_address:
- "-"
status: "u/u"
- description: "Utside"
interface: "eth0.42"
- description: "OUTSIDE"
interface: "eth0.40"
ip_address:
- "172.11.100.1/31"
- "123.123.120.123/27"
status: "u/u"
- description: ""
interface: "eth1"
ip_address:
- "-"
status: "u/u"
- description: "SERVICES-LINK"
interface: "eth1.1727"
- description: "CUST-DS-LAN"
interface: "eth1.204"
ip_address:
- "172.11.100.11/31"
- "123.123.123.81/28"
status: "u/u"
- description: "DS-LAN"
interface: "eth1.1800"
- description: "CUST-COM"
interface: "eth1.269"
ip_address:
- "172.11.100.3/31"
- "172.18.32.14/28"
- "123.123.123.123/32"
status: "u/u"
- description: "Link"
interface: "eth1.1801"
- description: "CUST-VIDEO"
interface: "eth1.437"
ip_address:
- "172.11.100.5/31"
- "123.123.116.169/29"
status: "u/u"
- description: "TEST-NET"
interface: "eth1.1804"
- description: "SERVICE-LINK"
interface: "eth1.1753"
ip_address:
- "172.11.100.7/31"
- "172.18.161.196/29"
status: "u/u"
- description: ""
interface: "eth2"
ip_address:
- "-"
status: "u/u"
- description: "SYNC"
interface: "eth2.1802"
ip_address:
- "172.18.254.3/31"
- "fe80:3023:1234:d::3/127"
status: "u/u"
- description: ""
interface: "lo"
ip_address:
- "127.0.0.1/8"
- "172.18.255.3/32"
- "172.18.255.110/32"
- "::1/128"
status: "u/u"
- description: ""
interface: "vtun0"
ip_address:
- "192.168.80.2"
status: "u/u"
- description: "OpenVPN-TUNNEL1"
interface: "vtun1"
ip_address:
- "192.168.80.4"
status: "u/u"
- description: ""
interface: "vtun2"
ip_address:
- "192.168.80.6"
status: "u/u"