- Preface
- Introduction to the Prime Provisioning API
- Getting Started
- Common APIs
- Using Templates
- Monitoring APIs
- MPLS Provisioning
- L2VPN Provisioning
- VPLS Provisioning
- EVC Provisioning
- Traffic Engineering Management Provisioning
- RAN Backhaul Provisioning
- MPLS Transport Profile Provisioning
- GUI to API Mapping
- Implementing a Notification Server
- Scripts
- Prime Provisioning XDE SDK
Scripts
These UNIX shell scripts automate the input of XML requests to, and process the resulting output from, the Northbound Interface (NBI) Application Programmers Interface (API) of the Cisco Prime Provisioning network management application.
This appendix contains information about the following scripts:
README File
The README file contains an example of a working script file and describes the required environment variables and parameters, and the location for optional files.
Scripts Main directory
This section describes the scripts in the main directory. See the “Script Subdirectories” section for more information about these optional files required by the UNIX shell scripts in the main scripts directory.
Note These scripts work with either the Sybase and Oracle database.
env
The env file contains all of the environment or UNIX shell variable definitions required by all of the UNIX shell scripts in the main scripts directory. All existing UNIX shell scripts in this directory reference the env file. Any new scripts created must also include a reference to this file.
changeMaxRoutes
This script changes the maximum allowed VPN routes for the service request links that belong to the specified VPN and Customer. It also downloads the maxRoutes value to the PE devices that belong to the service request links.
changeMaxRoutes [-v vpnName ] [-c customerName ] -m maxroutes
|
|
---|---|
The maximum number of VPN routes allowed in the device configuration. Required parameter. |
Where State is either Success or Failure. The OutputString is:
The log information is stored in <Prime Provisioning log Location>/http.0.* in XML format.
The information stored depends on the log level. Log levels range from SEVERE to FINEST, and are set using Administration > Control Center > Hosts > Configuration > Logging > Default > Loglevel.
changepasswd
This script causes the Prime Provisioning application to change the password on a specified device.
changepasswd -f inputfilename [-log logfilename ] | changepasswd -help
The default log name is $PRIMEF_HOME/tmp/changepasswd.log. $$, where $$ is the process ID. An alternate log file name can be specified in the input parameters.
changepw
This script causes the Prime Provisioning application to change the password on a specified device (single instance).
changepw host password enablepassword authpassword encrpassword
Fcollect
This script collects device configurations on a supplied list of devices.
collectConfig
Use this script to collect the device configuration for a specified device (rpmName). The device configuration is stored in the directory $PRIMEF_HOME/tmp in a file named after the device. You can list multiple device names (multiple rpmName parameters).
$PRIMEF_HOME/tmp/device, where device is the name of the device (for example, 3550_6-1).
$PRIMEF_HOME/tmp/collectConfig.log
deletece
Deletes all CE devices in the repository that have no service requests associated with them.
Optionally, you can specify a single CE device using the pvc_id value with the -p script option flag.
deletesr
This script performs the following actions:
1) Decommissions the specified list of service requests (SRs).
2) Runs a report on all specified SRs returning the jobId and status.
3) Runs a purge request for a closed SR.
deleteSR
This script performs the following actions:
- Decommissions the list of service requests from the Prime Provisioning database. The service request is specified using the SRJobId.
- Produces an audit report for all specified service requests, returning the associated JobId and state for each one.
- Purges service requests in the Closed state.
The audit report can be disabled using the -noaudit option flag.
deleteSR SRJobId [ SRJobId,...]
deleteUnusedCpes
This script performs the following actions:
1. Finds all CPEs that are not part of an MPLS SR.
3. Deletes their corresponding target devices.
4. Deletes any sites that no longer have any CPEs.
Note This script only checks for CPEs that are part of an MPLS SR. If any CPE is part of any other type of SR (L2VPN, for example), the script will fail.
deployallsr
This script performs the following actions:
- Finds all the MPLS service requests that are in the Requested state.
- Deploys the above listed MPLS service requests to the Prime Provisioning-managed network.
- The SRs are deployed in batches of 100.
deployallsr [-outdir dir_name ] [-log log_file_name ]
$PRIMEF_HOME/tmp/deployallsr.log.1897_08_03_04_09_06_29
Where 1897 is the process ID, and the remaining numbers are the date and time. An alternate log file name can be specified in the input parameters.
deployAllSR
This script deploys all MPLS SRs that are in the Requested state sequentially. It performs an audit by default unless the arguement -noaudit is passed.
It performs the following actions:
deploysr
This script performs the following actions:
- Deploys all service requests listed in the input parameters, regardless of the state.
- Produces an audit report for all specified service requests, returning the associated JobId and state for each one.
deploysr SR_ID [-noaudit] [-force]
|
|
---|---|
An audit is performed by default unless the argument -noaudit is passed. |
|
The service request is deployed by default unless the argument -force is passed. |
None, unless there is an error. The following is an example of an error output:
downinterface
Use this script to turn off or shut down a given network interface (interfaceName) on a given device (rpmName). This script logs into the listed RPM device and inserts the shutdown IOS command on the specified interface.
downinterface -rpm rpmName [-user userName ] -pw userPassword -enableuser enableUserName -enablepw enablePassword -interface interfaceName [-log logFilename ]
getfile
This script will get the latest config for a device from the repository.
getfile {{-device device_name } [-dirname outputFileDirectory ] {-outfile outputFileName }} | {-r deviceName }}
getpe
This script provides a report for all PE device names and associated IP addresses contained in the Prime Provisioning database. The display is sent to the computer screen by default, or you can specify an output file, using the -f filename script option flag.
Creating getpe.txt in current directory
Default is getpe.txt (found in the directory where the script was executed). An alternate file name can be specified in the input parameters.
getPEs
This script will print all of the names of the PEs along with their management IP addresses.
modifyce
This script modifies the CE device names in the Prime Provisioning database. The inputfilename parameter is used to specify the CE device names to be changed.
For example, the following input file:
- The site named C1234 is changed to C5678
- The device named c1234 is changed to c5678
- The site named C4321 is changed to C8765
- The device named c4321 is changed to c8765
modifyce -input filename [-log logFileName ]
To send the output to a log file, use the -log script option and specify a logFileName.
Default log name is $PRIMEF_HOME/tmp/modifyce.log.$$
Where $$ is the UNIX process id assigned to this script when it is run. An alternate log file name can be specified in the input parameters.
purgeces
This script purges all closed SRs/CEs belonging to a VPN.
It performs the following actions:
1. Finds all closed SRs that are associated with the specified VPN.
3. Deletes any CPEs and sites that are no longer used.
|
|
---|---|
purgeConfigs
This script performs the following actions:
1. Runs a report to determine, which devices are candidates to have their configs removed.
2. Creates one or more collect config tasks. These task will perform collect config tasks on devices, which have exceeded the recommended number of stored configs.
purgesrs
This script performs the following actions:
1. Finds all service requests in the Prime Provisioning database that are in the Closed state.
2. Purges or removes each of these service requests from the Prime Provisioning database.
If you specify a file and filename that contains a list of service request job IDs (SRJobId), only the service requests listed in the file are purged, and only if they are in the Closed state.
To purge service requests regardless of the state use the -force script option flag.
purgesrs [-file <filename>] [-log <logFileName>] [-force]
If no arguments are given, all service requests in the Closed state are purged.
|
|
---|---|
The file containing the list of service requests to be purged. |
|
Specified on the command line.
removesr
Use this script to change a specified service request to the Decommissioned state. The service request remains in the Prime Provisioning database but is not deployed. Use the job ID (SRJobId) to specify the service request to decommission.
showces
This script performs the following actions:
1. Shows all SRs/CEs belonging to a specified VPN.
showces [-h | -n vpnName | -a]
(use only one option with this script)
|
|
---|---|
where vpn1 is the name of the vpn. This command displays all the ces’es related to vpn1.
showsr
This script performs the following actions:
- Finds all the MPLS service requests in the Prime Provisioning database which are not in the Deployed, Functional, or Closed state.
- Finds the VPNs associated with each MPLS service request.
- Finds the PE and CE devices associated with each MPLS service request.
- Displays this information in a table format.
When no arguments are specified, the output lists all service requests that are not in the Deployed, Functional, or Closed state.
showsr [-a] [ last_N_sr ] [ sr_state ]
Job_ID SR_STATE PE_ROUTER CE_ROUTER VPN_ID CREATION_DATE_TIME
149 DEPLOYED dllstx95r10-0033 c1333698 V34 2004-1-27 15:56:18
srdump
This script performs one of these actions:
- Returns information about all service requests in the Prime Provisioning database, which contain the network device specified by the pvc_id parameter.
- Returns information about the service request designated by the sr_id. The -sr script option is required when requesting sr_id.
srdump pvc_id [-disable] [-configlet]
srDump
This script performs the following actions:
Example: srDump [-d] [-c] PVC_Id
1) Prints a list of SRs associated with a CPE
- If more than one SR is found, the following brief output is printed:
- If only one SR is found, the following detailed information is printed:
MVRFCE_CE_Routes_To_Site_IP_Address
2) Prints only a brief summary if the -d flag is used.
3) Prints the configlet also if the -c flag is used.
Example: srDump [-d] [-c] [-s] SR_Id
1) The -s flag is required to make the script treat the id variable as an SR ID.
2) The -c flag also prints the configlet if the -configlet flag is used.
taskdump
This script provides information about service request tasks. Indicate the detail of the report by specifying either a:
taskdump -h | sr_id | task_name [-verbose]
|
|
---|---|
Obtain information about tasks associated with service request. |
|
taskDump
This script provides information about service request tasks.
taskDump <[-A] [-I id ] [-S] [-R]> [-r] [-a] [-f file_name ] [-h]
(One or more of the first four options is required for this script.)
|
|
---|---|
upinterface
Use this script to turn on (or turn up) a given network interface (interfaceName) on a given device (rpmName). This script logs into the specified RPM device and inserts the no shutdown IOS command on the specified interface.
upinterface -rpm rpmName [-user userName ] -pw userPassword -enableuser enableUserName -enablepw enablePassword -interface interfaceName [-log logFileName ]
VrfPing
VrfPing checks the connectivity between the PE and CE by executing the traceroute vrf and ping atm commands. If the traceroute vrf command succeeds, VrfPing returns with an exit status of 0. The ping atm command is executed only if the VCI value is specified with the -vci option and the traceroute command fails.
The exit states of VrfPing are:
- 0 - traceroute command successful.
- 1 - traceroute command failed. ping atm command successful (if vci was specified).
- 2 - traceroute command failed. ping atm command failed.
VrfPing -pe pe_name -ce ce_name -vrf vrf_name [-vci vci_value ] [-user user_name ] -pw user_passwd [-enuser enable_username ] -enpw enable_passwd [-log log_file_name ]
Script Subdirectories
These subdirectories are located in the scripts main directory.
util
This directory contains UNIX shell scripts that are used by the UNIX shell scripts in the main scripts directory. They perform utility functions which might be used by any of the UNIX shell scripts in the main directory. Users that create or modify scripts in the main directory have reference to these utility scripts, but they cannot be used directly or modified.
xml
This directory contains input request XML template files. The main directory UNIX shell scripts read, copy, and modify the copied XML template file to generate inputs for the Prime Provisioning NBI. The files in this directory are not modified throughout the process.
filters
This directory contains variables, used by the UNIX shell scripts in the main directory, to filter the responses generated by the Prime Provisioning NBI before the response data is formatted for output to the user. As you create or modify UNIX shell scripts in the main directory, you might need to modify or add new filter files to this directory.
queries
This directory contains input request XML template files, similar to those in the xml subdirectory, but these files are in a different and more detailed format. The main directory UNIX shell scripts use the files in this directory in much the same way those in the xml directory are used. The resulting output from the NBI API are more detailed, and the scripts using the files of this directory can generate more detailed and formatted output to present to the user.