I have some trouble with textFSM, and I don't know if I am doing it right:
So the output that i want to parse is this one:
snmp-server host 10.140.300.200 traps version 2c ldldo-1ldd
snmp-server host 10.140.300.200 use-vrf management
snmp-server host 10.132.300.101 traps version 2c oelee-doeoel
snmp-server host 10.132.300.101 use-vrf management
snmp-server host 10.132.300.101 source-interface kedl1
snmp-server host 10.151.230.230 traps version 2c SNMP1sAPain
snmp-server host 10.105.10.104 traps version 2c oelee-doeoel
snmp-server host 10.105.10.104 use-vrf management
snmp-server host 10.105.10.104 source-interface kedl1
And my template is:
Value host (\S+)
Value version (\S+)
Value community (\S+)
Value vrf (\S+)
Value source_interface (\S+)
Start
^snmp-server\s+host\s+${host}\s+traps\s+version\s+${version}\s+${community}
^snmp-server\s+host\s+${host}\s+use-vrf\s+${vrf}
^snmp-server\s+host\s+${host}\s+source-interface\s+${source_interface} -> Record
the output:
[{'host': '10.132.300.101',
'version': '2c',
'community': 'oelee-doeoel',
'vrf': 'management',
'source_interface': 'kedl1'},
{'host': '10.105.10.104',
'version': '2c',
'community': 'oelee-doeoel',
'vrf': 'management',
'source_interface': 'kedl1'}
But with that template I only capture the output which mirror that.
How can I capture the others hosts: '10.140.300.200', '10.151.230.230'?
Thanks in advance
Here's a simple solution without requiring any external modules:
Output: