![Cisco ASR 9000 Serie Configuration Manuals Download Page 208](http://html.mh-extra.com/html/cisco/asr-9000-serie/asr-9000-serie_configuration-manuals_66679208.webp)
action_syslog msg "context_retrieve failed: $errmsg"
} else {
action_syslog msg "context_retrieve succeeded"
}
if {[info exists testvar]} {
action_syslog msg "testvar exists and is [array get testvar]"
} else {
action_syslog msg "testvar does not exist"
}
Example 4: Save
If var is specified, saves the value of var even if it is an array.
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set testvar
“
testvar1 ok testvar2 not_ok
”
if {[catch {context_save TESTCTX testvar} errmsg]} {
action_syslog msg "context_save failed: $errmsg"
} else {
action_syslog msg "context_save succeeded"
}
Example 4: Retrieve
If var is specified, and index_if_array is specified, and var is an array variable, retrieves the specified array
element value.
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
if {[catch {set testvar [context_retrieve TESTCTX testvar testvar1]} errmsg]} {
action_syslog msg "context_retrieve failed: $errmsg"
} else {
action_syslog msg "context_retrieve succeeded"
}
if {[info exists testvar]} {
action_syslog msg "testvar exists and is $testvar"
} else {
action_syslog msg "testvar doesn't exist"
}
context_save
Saves Tcl variables that match a given pattern in current and global namespaces with the given context name
as identification. Use this Tcl command extension to save information outside of a policy. Saved information
can be retrieved by a different policy using the
context_retrieve
command extension.
Once saved information is retrieved, it is automatically deleted. If that information is needed by another
policy, the policy that retrieves it (using the
context_retrieve
command extension) should also save it
again (using the
context_save
command extension).
Note
Cisco ASR 9000 Series Aggregation Services Router System Monitoring Configuration Guide, Release 4.2.x
192
Configuring and Managing Embedded Event Manager Policies
Tcl Context Library Command Extensions