Cisco Systems OL-27172-01 Mobility Aid User Manual


 
18-2
Cisco Broadband Access Center 3.8 Administrator Guide
OL-27172-01
Chapter 18 Scripting Framework
Extension Script
By default the following frequently used Java packages are imported into the Script's Shared Scope:
java.lang.*;
java.util.*;
com.cisco.provisioning.cpe.cwmp.main.*;
com.cisco.provisioning.cpe.cwmp.soap.messages.*;
com.cisco.provisioning.cpe.cwmp.soap.types.*;
com.cisco.provisioning.cpe.extensions.dpe.api.events.*;
com.cisco.provisioning.cpe.extensions.dpe.faults.*;
com.cisco.csrc.dpe.extensions.script.*;
You can also add any third-party libraries into the Script's Scope by adding the jar files into /dpe/lib
folder. During DPE start-up, the class loader will load all the jars available in /dpe/lib folder. You can
import the Java packages in the extension scripts to make use of the Java classes available in the libraries
loaded.
For example, you can import the java packages using the following command:
importPackage (Packages.com.mylib.test);
Note Restart the DPE after adding the jar files.
Extension Script
Extension scripts are classified into two categories:
DPE Extension Script—These script files are main extension scripts having the main provisioning
logic.
The following script is a sample DPE extension script:
log.debug(" Executing sample extension...");
var params = ["Device.DeviceInfo.SoftwareVersion"];
log.debug(" Getting SoftwareVersion info...");
var result = getParamValues(scriptSupport, response, params);
log.debug(" Got response from the device ==> ");
log.debug(result.toString());
Helper Script—These script files are utilities which can be used by multiple main extension scripts.
The helper scripts are called from both main extension scripts and other helper scripts.
The following script is a sample Helper script:
function getParamValues(scriptSupport, response, params)
{
if (params && params.length > 0)
{
session CwmpHttpSession
scriptSupport ScriptSupport
service CwmpHttpService
log DefaultLogStream
Table 18-1 Java Objects
Object Name API