'; Working With Device Model Scripts | Incognito Help
    [0] => Array
            [version] => 4.3
            [language] => en

Rel: acs/tutorials/acs/dita/working_with_scripts
URI: acs/tutorials/working_with_scripts
=== Tags ===
    [997] => working with device model scripts

=== Related ===

Working With Device Model Scripts

This tutorial describes how to edit a simple device model script. Scripts display and control the widgets on the CSR Dashboard.

This tutorial:

  • is intended for TR-069 devices, but is generic enough that it can be applied, with some changes, to SNMP and MQTT devices
  • requires a device that supports DHCP. For devices with DHCP support, the script for configuring the DHCP tile on the CSR Dashboard is added by default

By default, the DHCP tile on the CSR Dashboard contains a toggle for enabling or disabling the DHCP service. In this tutorial, you will edit the script that controls this tile and remove the toggle so that it no longer displays on the tile. When the toggle is removed, the DHCP is always enabled.

Edit a Script

  1. From the ACS Hub, go to Device Models.

  2. Select a device model, and in the action bar, click View.
    A screen with the device model details appears.
  3. Under Options, click CPE Service Configurations.

  4. Select the DHCP tile, and from the action bar, click View.

    The CPE Service Configuration Details screen appears.
  5. Under Script Definition*, click the link to the script.

    The link should read “<device-model>: DHCP”, although it may differ.
  6. Using the inline editor, comment out (//) the following line in the script.
    Note: Refer to the example script shown in the previous section.
    { label:"Enable DHCP service", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DHCPServerEnable" },
  7. In the action bar, click Save and Publish to save and enable the changes to the script.
  8. In the action bar, click OK and Confirm to confirm the changes.
  9. In the action bar, click Save to save the changes to the device model.

Go to Devices > View Device > Device Hub > CSR Dashboard and click the DHCP tile. The Enable DHCP service toggle no longer appears.

DHCP Script Example

This example shows a generic version of the DHCP script that create the DHCP tile on the CSR Dashboard.

var dsc = require("deviceserviceconfiguration");
var data = {
  label: "DHCP",
  parameters: [
    { label:"Enable DHCP service", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DHCPServerEnable" },
    { label:"DNS Servers", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers" },
    { label:"DHCP Start Address", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MinAddress" },
    { label:"DHCP End Address", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MaxAddress" },
    { label:"Lease Time", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DHCPLeaseTime" },
    { label:"LAN IP Address", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.IPInterface.1.IPInterfaceIPAddress" }
var response = dsc.createResponse({
    data: data,
    scriptParameters: scriptParameters