205
[Sysname-rtm-test] action 2 cli ip address $loopback0IP 24
# Add an action that sends the matching
loopback0
command with a priority of 0 from the logging
facility
local7
when the event occurs.
[Sysname-rtm-test] action 3 syslog priority 0 facility local7 msg $_cmd
# Specify the
network-admin
user role for executing the policy.
[Sysname-rtm-test] user-role network-admin
# Enable the policy.
[Sysname-rtm-test] commit
[Sysname-rtm-test] return
<Sysname>
Verifying the configuration
# Enable the information center to output log messages to the current monitoring terminal.
<Sysname> terminal monitor
# Execute the
loopback0
command. Verify that the system displays the
loopback0
message and a
policy successfully executed message on the terminal screen.
<Sysname> loopback0
<Sysname>
%Jan 3 09:46:10:592 2014 Sysname RTM/0/RTM_ACTION: loopback0
%Jan 3 09:46:10:613 2014 Sysname RTM/6/RTM_POLICY: CLI policy test is running
successfully.
# Verify that Loopback 0 has been created and assigned the IP address 1.1.1.1.
<Sysname> display interface loopback brief
Brief information on interfaces in route mode:
Link: ADM - administratively down; Stby - standby
Protocol: (s) - spoofing
Interface Link Protocol Primary IP Description
Loop0 UP UP(s) 1.1.1.1
<Sysname>
Tcl-defined policy configuration example
Network requirements
As shown in
, use Tcl to create a monitor policy on the Device. This policy must meet the
following requirements:
•
EAA sends the log message "rtm_tcl_test is running" when a command that contains the
display this
string is entered.
•
The system executes the command only after it executes the policy successfully.
Figure 58
Network diagram
Configuration procedure
# Edit a Tcl script file (rtm_tcl_test.tcl, in this example) for EAA to send the message "rtm_tcl_test is
running" when a command that contains the
display this
string is executed.
Internet
Device
PC
TFTP client
TFTP server
1.1.1.1/16
1.2.1.1/16