cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1625
Views
0
Helpful
2
Replies

EEM applet: context retrieve with variables pattern?

Hello!

 

For example, save variables: var1, var2, var3 by variables pattern: var* to single context key: vars.

 

event manager applet ctx_save

event none

 action 1.0 set var1 1

 action 2.0 set var2 2

 action 3.0 set var3 3

 action 4.0 context save key vars variable "var*"

 

But, how retrieve?

event manager applet ctx_retrieve

event none

 !

 ! action 1.0 context retrieve key vars variable "var*"

 !

 ! retrieve data, but how access to values?

 action 1.0 context retrieve key vars

 

How to retrieve variables and access to its values using the same pattern?

2 Replies 2

balaji.bandi
Hall of Fame
Hall of Fame

I do believe that is possible, in a programming point of view, what is the var stored? what value does it retrieve from 1 or 2 or 3?

 

here is some guidelines :

 

https://community.cisco.com/t5/networking-documents/eem-built-in-quot-action-quot-variables/ta-p/3123406

 

you can call variable when the action required.#

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

This is not a function I have used before, but having read up on it the pattern is:

context save key <key_name> variable <variable_name>

context retrieve key <key_name> variable <target_variable_name>

So an example would be:

!
action 1.0 set var1 1
action 2.0 set var2 2
action 3.0 set var3 3
action 4.0 context save key k_var1 variable "var1"
action 4.1 context save key k_var2 variable "var2"
action 4.2 context save key k_var3 variable "var3"
action 5.0 retrieve key k_var1 variable "old_var1"
action 5.1 retrieve key k_var2 variable "old_var2"
action 5.2 retrieve key k_var3 variable "old_var3"
action 6.0 syslog msg "Old variables, $old_var1, $old_var2, $old_var3"
!

cheers,

Seb.