cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1718
Views
0
Helpful
1
Replies

using action info in applets

iParadigms.net
Level 1
Level 1

So Cisco documents these perculiar $_info_foo_bar_[1-N] variables here:

http://www.cisco.com/en/US/docs/ios-xml/ios/eem/command/eem-cr-a1.html#wp8708912800

But give no example or tcl-esque action (such as subst/eval?) to actually use them in an applet!

Can someone demonstrate how to make this work in an applet:

event manager applet B0RK-ACTION-INFO

event none

action 1 info type cli history

action 2 puts "num entries: $_info_cli_hist_num_entries"

action 3 puts "first entry: $_info_cli_hist_cmd_1"

action 4 puts "last entry: $_info_cli_hist_cmd_$_info_cli_hist_num_entries" ! <-- b0rk b0rk b0rk

!

Output:

ios#event manager run B0RK-ACTION-INFO

num entries: 8

first entry: end

%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: _info_cli_hist_cmd_

%HA_EM-3-FMPD_ERROR: Error executing applet B0RK-ACTION-INFO statement 4

Are these fools errand features? Of course one could write a tcl script. But that defeats the whole purpose of using the documented applet api.

../C

1 Reply 1

avayner
Level 1
Level 1

Curtis,

Unfortunatly EEM would not exapnd variable content to be used as part of the EEM syntax...

The only way I am aware you can accomplish what you tried to do is by generating a dynamic EEM applet...

The problem with this specific solution is that actually creating the child policies would break the cli history ;-)

So it doesn't really do what you want... so just a nice concept for other similar things...

Something like this:

conf t

no event manager applet PARENT

event manager applet PARENT

event none

action 1   info type cli history

action 2   puts "num entries: $_info_cli_hist_num_entries"

action 3.1 set entry "1"

action 3.2 cli command "enable"

action 3.3 cli command "conf t"

action 3.4 handle-error type ignore

action 4   while $entry le $_info_cli_hist_num_entries

action 4.01  cli command "event manager applet CHILD"

action 4.02  cli command "event none"

action 4.021 puts "  >>> ENTRY=$entry"

action 4.03  cli command "action 1 info type cli history"

action 4.04  cli command "action 2 set result $q \$_info_cli_hist_cmd_$entry $q"

action 4.05  cli command "action 3 context save key result_context variable result"

action 4.06  cli command "do event manager run CHILD"

!action 4.07  cli command "no event manager applet CHILD"

action 4.08 context retrieve key result_context variable result

action 4.09  puts "INFO-CLI-HIST-CMD-$entry = $result"

action 4.10  increment entry 1

action 5   end

end

event manager run PARENT