Once saved information is retrieved, it is automatically deleted. If that information is needed by another
Note
policy, the policy that retrieves it (using the context_retrieve command extension) should also save it
again (using the context_save command extension).
Syntax
context_save ctxt [pattern]
Arguments
ctxt
pattern
Result String
None
Set _cerrno
A string displaying _cerrno, _cerr_sub_num, _cerr_sub_err, _cerr_posix_err, _cerr_str due to appl_setinfo
error.
Sample Usage
The following examples show how to use the context_saveand context_retrieve command extension
functionality to save and retrieve data. The examples are shown in save and retrieve pairs.
Example 1: Save
If var is unspecified or if a pattern if specified, saves multiple variables to the context.
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
set testvara 123
set testvarb 345
set testvarc 789
if {[catch {context_save TESTCTX "testvar*"} errmsg]} {
action_syslog msg "context_save failed: $errmsg"
} else {
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
(Mandatory) Context name.
(Optional) The glob-style pattern as used by the string
matchTcl command. If this argument is not specified,
the pattern defaults to the wildcard *.
There are three constructs used in glob patterns:
• * = all characters
• ? = 1 character
• [abc] = match one of a set of characters
context_save
1865