I'm trying to use EEM / TCL to run a command in response to a Tunnel interface going up, but it requires the use of a parameter that I need to parse from a show command.
When interface Tunnel1 goes up, I'd like to run these commands:
1. Remove configuration with "no" command
2. Add configuration "ipv6 local pool MY-POOL <PARSED-PARAMETER-FROM-SHOW-COMMAND> 56"
For command 1, I need to do a
"show run | i ipv6[ ]local"
... and remove the corresponding config that's returned:
ipv6 local pool MY-POOL 1:2:9B00:FD00::/56 56
"no ipv6 local pool MY-POOL 1:2:9B00:FD00::/56 56"
For command 2, I need to grab the "General Prefix", including the /56 netmask.
"show tunnel 6rd"
... which gives me the following output:
R1#show tunnel 6rd
Interface Tunnel1:
Tunnel Source: 114.63.91.184
6RD: Operational, V6 Prefix: 2602::/24
V4 Prefix, Length: 0, Value: 0.0.0.0
V4 Suffix, Length: 0, Value: 0.0.0.0
Border Relay address: 199.238.1.96
General Prefix: 2602:BD5C:2B16:F100::/56
R1#
For command 2, I'd need EEM to run "ipv6 local pool MY-POOL 2602:BD5C:2B16:F100::/56 56" when Tunnel1 comes up.
Any ideas on how to accomplish this? Thanks in advance :)