5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/arista/eapi/parser/show.rb', line 5
def self.show_lldp_neighbors(body)
lldp = {
:last_update => nil,
:ports => {}
}
lldp[:last_update] = body.match(/^Last table change time\s+:\s(?<last_update>.*?)$/m)[:last_update]
ports = body.match(/.*Neighbor Port ID\s*TTL\s(?<ports>.*)/m)[:ports]
unless ports.nil?
ports.split("\n").each do |line|
name, neighbor_device_id, neighbor_port_id, ttl = line.split
lldp[:ports][name] = {
:neighbor_device_id => neighbor_device_id,
:neighbor_port_id => neighbor_port_id,
:ttl => ttl
}
end
end
{ :lldp_neighbors => lldp }
end
|