Workflow to Run Process Scripts
Complete the following tasks to provision process scripts:
-
Download the script—Store the script on an HTTP server or copy to the harddisk of the router. Add the script from the HTTP server or harddisk to the script management repository on the router using the script add process command.
-
Configure the checksum—Check script integrity and authenticity using the script process <script.py> checksum command.
-
Register the script—Register the script as an application in the app manager using appmgr process-script command.
-
Activate the script—Activate the registered application using appmgr process-script activate command.
-
View the script execution details—Retrieve the operational data using the show appmgr process-script command.
The following image shows the workflow diagram representing the steps that are involved in using a process script:
Download the Script to the Router
To manage the scripts, you must add the scripts to the script management repository on the router. A subdirectory is created for each script type. By default, this repository stores the downloaded scripts in the appropriate subdirectory based on script type.
Script Type | Download Location |
---|---|
config |
harddisk:/mirror/script-mgmt/config |
exec |
harddisk:/mirror/script-mgmt/exec |
process |
harddisk:/mirror/script-mgmt/process |
eem |
harddisk:/mirror/script-mgmt/eem |
-
Method 1: Add script from a server
-
Method 2: Copy script from external repository to harddisk using scp or copy command
In this section, you learn how to add process-script.py
script to the script management repository.
Procedure
Step 1 |
Add the script to the script management repository on the router using one of the two options:
|
||
Step 2 |
Verify that the scripts are downloaded to the script management repository on the router. Example:
process-script.py is copied to harddisk:/mirror/script-mgmt/process directory on the router.
|
Configure Checksum for Process Script
Every script is associated with a checksum hash value. This value ensures the integrity of the script, and that the script is not tampered. The checksum is a string of numbers and letters that acts as a fingerprint for script. The checksum of the script is compared with the configured checksum. If the values do not match, the script is not run and a warning message is displayed.
It is mandatory to configure the checksum to run the script.
Note |
Process scripts support the SHA256 checksum hash. |
Before you begin
Procedure
Step 1 |
Retrieve the SHA256 checksum hash value for the script from the IOS XR Linux bash shell. Example:
Make note of the checksum value. |
Step 2 |
View the status of the script. Example:
The |
Step 3 |
Configure the checksum. Example:
|
Step 4 |
Verify the status of the script. Example:
The status |
Register the Process Script as an Application
Register the process script with the app manager to enable the script. The registration is mandatory for using process script on the router.
Before you begin
Ensure that the following prerequisites are met before you register the script:
Procedure
Step 1 |
Register the script with an application (instance) name in the app manager. Example:
Here, |
||||||||||||||
Step 2 |
Provide the arguments for the script. Example:
|
||||||||||||||
Step 3 |
Set a restart policy for the script if there is an error. Example:
Here, the maximum attempts to restart the script is set to 3. After 3 attempts, the script stops. You can set more options to restart the process:
|
||||||||||||||
Step 4 |
View the status of the registered script. Example:
The script is registered but is not active. |
Activate the Process Script
Activate the process script that you registered with the app manager.
Before you begin
Ensure that the following prerequisites are met before you run the script:
Procedure
Step 1 |
Activate the process script. Example:
The instance |
||
Step 2 |
View the status of the activated script. Example:
The process script is activated and running.
|
Obtain Operational Data and Logs
Retrieve the operational data and logs of the script.
Before you begin
Ensure that the following prerequisites are met before you obtain the operational data:
Procedure
Step 1 |
View the registration information, pending configuration, execution information, and run time of the process script. Example:
|
Step 2 |
View the logs for the process scripts. App manager shows the logs for errors and output. Example:
|