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

Linux arp a #814

Merged
merged 7 commits into from
Oct 22, 2020
Merged

Linux arp a #814

merged 7 commits into from
Oct 22, 2020

Conversation

jifox
Copy link
Contributor

@jifox jifox commented Oct 20, 2020

ISSUE TYPE
  • New Template Pull Request
COMPONENT

linux_arp_a.textfsam, linux arp -a

SUMMARY

Parse arp-table arp -a on linux host

? (192.168.13.197) at 00:04:4b:cc:9c:ba [ether] on eth1.100
? (192.168.10.100) at <incomplete> on eth1.10
? (192.168.13.252) at 5c:e2:8c:fc:a4:74 [ether] on eth1.100
esxi (192.168.13.5) at 00:e0:67:05:9d:5a [ether] on eth1.100
? (192.168.13.253) at dc:f7:19:cd:d6:c4 [ether] on eth1.100
? (192.168.123.199) at 00:0f:c9:0e:c8:ec [ether] on eth0.21
? (192.168.10.52) at <incomplete> on eth1.10
? (192.168.10.7) at 00:0c:29:02:3b:93 [ether] on eth1.10
? (192.168.10.249) at 00:0c:29:bb:5f:a2 [ether] on eth1.10
---
parsed_sample:
  - hw_type: "ether"
    interface: "eth1.100"
    ip_address: "192.168.13.197"
    mac_address: "00:04:4b:cc:9c:ba"
    rev_dns: "?"
  - hw_type: "ether"
    interface: "eth1.100"
    ip_address: "192.168.13.252"
    mac_address: "5c:e2:8c:fc:a4:74"
    rev_dns: "?"
  - hw_type: "ether"
    interface: "eth1.100"
    ip_address: "192.168.13.5"
    mac_address: "00:e0:67:05:9d:5a"
    rev_dns: "esxi"
  - hw_type: "ether"
    interface: "eth1.100"
    ip_address: "192.168.13.253"
    mac_address: "dc:f7:19:cd:d6:c4"
    rev_dns: "?"
  - hw_type: "ether"
    interface: "eth0.21"
    ip_address: "192.168.123.199"
    mac_address: "00:0f:c9:0e:c8:ec"
    rev_dns: "?"
  - hw_type: "ether"
    interface: "eth1.10"
    ip_address: "192.168.10.7"
    mac_address: "00:0c:29:02:3b:93"
    rev_dns: "?"
  - hw_type: "ether"
    interface: "eth1.10"
    ip_address: "192.168.10.249"
    mac_address: "00:0c:29:bb:5f:a2"
    rev_dns: "?"

Copy link
Contributor

@jmcgill298 jmcgill298 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jifox thanks for your contribution. The only thing missing is the validation that all output was captured as expected.

templates/linux_arp_a.textfsm Outdated Show resolved Hide resolved
@jifox
Copy link
Contributor Author

jifox commented Oct 21, 2020

Hi @jmcgill298

I've extended my set of test machines and saw that the cli output is translated on output. Therfore I've replaced the text constants ("at","on","auf") to \S+ so hopefully every language is accepted. I've also added regex for the -mac record.

I use the template already and it parses correctly, although the test is failing.

Value REV_DNS (\S+)
Value IP_ADDRESS (\S+)
Value MAC_ADDRESS (\S+)
Value HW_TYPE (\S+)
Value INTERFACE (\S+)

Start
^${REV_DNS}\s+(${IP_ADDRESS})\s+\S+\s+${MAC_ADDRESS}\s+[${HW_TYPE}]\s+\S+\s+${INTERFACE}$$ -> Record
^${REV_DNS}\s+(${IP_ADDRESS})\s+\S+\s+<${MAC_ADDRESS}>\s+\S+\s+${INTERFACE}$$ -> Record
^\s*$$
^. -> Error

@jmcgill298
Copy link
Contributor

Should be fixed in jifox#1

BugFix: Correctly derive OS name from template name
@jmcgill298 jmcgill298 merged commit d322c77 into networktocode:master Oct 22, 2020
@jifox
Copy link
Contributor Author

jifox commented Oct 22, 2020

Thx for support

@jifox jifox deleted the linux_arp_a branch October 22, 2020 14:41
thomasblass pushed a commit to thomasblass/ntc-templates that referenced this pull request Oct 25, 2020
jvanderaa pushed a commit that referenced this pull request Nov 10, 2021
guillaume-mbali pushed a commit to unyc-io/ntc-templates that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants