11.11.2014 Views

Using VigorACS Web Service API - Draytek

Using VigorACS Web Service API - Draytek

Using VigorACS Web Service API - Draytek

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

<strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong><br />

Version 1.0<br />

1


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

Summary<br />

This application note describes the <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong> and how to use it. This document<br />

applies for <strong>VigorACS</strong> 0.0.1.0 or later.<br />

References<br />

• <strong>VigorACS</strong> User Guide.<br />

• <strong>VigorACS</strong> Quick Start Guide.<br />

• TR-069 specification.<br />

• TR-104 specification.<br />

Revision History<br />

Issue Date Description<br />

1 September 30, 2008 Initial release for <strong>VigorACS</strong><br />

0.0.1.0 or later, by Boham Liu.<br />

2


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

Table of Content<br />

1. Introduction .................................................................................................................................... 4<br />

2. <strong>Web</strong> <strong>Service</strong> <strong>API</strong> ............................................................................................................................. 4<br />

2.1 Packages ................................................................................................................................ 4<br />

2.2 Examples ............................................................................................................................... 4<br />

2.2.1 Network management ............................................................................................... 4<br />

2.2.1.1 Get network information ............................................................................... 5<br />

2.2.1.2 Change network configuration ..................................................................... 6<br />

2.2.2 Devices management ................................................................................................. 8<br />

2.2.2.1 Get devices count ............................................................................................ 8<br />

2.2.2.2 Get devices information ................................................................................. 9<br />

2.2.2.3 Enable Device ............................................................................................... 11<br />

2.2.3 CPE parameters management ............................................................................... 12<br />

2.2.3.1 Get RPC methods ......................................................................................... 12<br />

2.2.3.2 Get CPE parameter names .......................................................................... 13<br />

2.2.3.3 Get CPE parameter values .......................................................................... 15<br />

2.2.3.4 Get CPE parameter attributes .................................................................... 16<br />

2.2.3.5 Set CPE parameter values ........................................................................... 18<br />

2.2.3.6 Set CPE parameter attributes ..................................................................... 20<br />

2.2.3.7 addObject (Parameters or other objects defined with multiple instances)<br />

.................................................................................................................................... 22<br />

2.2.3.8 deleteObject (Parameters or other objects defined with multiple<br />

instances) ................................................................................................................... 23<br />

2.2.4 Provision management ........................................................................................... 26<br />

2.2.5 Reboot the CPE ....................................................................................................... 29<br />

3


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

1. Introduction<br />

For companies want to integrate their current systems with <strong>VigorACS</strong>, <strong>VigorACS</strong> provides<br />

web service <strong>API</strong> for this requirement. Users are able to access information or management devices<br />

through the web service <strong>API</strong>. This function is convenient and flexible for the companies that wish to<br />

keep their current systems unchanged and integrate with <strong>VigorACS</strong>.<br />

2. <strong>Web</strong> <strong>Service</strong> <strong>API</strong><br />

The web service <strong>API</strong> supports many functions, ex. management of network, retrieving<br />

parameters, getting RPC methods from CPES, uploading or downloading files, setting parameters<br />

and attributes...etc.<br />

2.1 Packages<br />

There are 3 packages of web service <strong>API</strong>: obj, property and web services. The obj package<br />

includes object class that defined and manipulate in web service. The property package includes<br />

<strong>Web</strong><strong>Service</strong>Property class that defined static variables used in web service. The web services<br />

include services classes that defined various web services.<br />

2.2 Examples<br />

To access <strong>VigorACS</strong> web service, you have to know the information below 1 :<br />

• <strong>Web</strong> service URL:<br />

http://[IP Address of <strong>VigorACS</strong>]:8080/ACS<strong>Web</strong><strong>Service</strong>s/services/ACS<strong>Web</strong><strong>Service</strong>s 2<br />

• User name: The user name used for log in <strong>VigorACS</strong>.<br />

• User password: The password used for log in <strong>VigorACS</strong>.<br />

2.2.1 Network management<br />

From this section, <strong>VigorACS</strong> web service demo codes would be displayed and <strong>API</strong> would be<br />

listed with descriptions.<br />

<strong>VigorACS</strong> web service <strong>API</strong> provides network management functions, including get current<br />

network information, change devices to different networks.<br />

1 You must know serial number of the device you want to manage, too.<br />

2 The IP Address is IPv4 IP, as a.b.c.d format, for example: 192.168.1.1<br />

4


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

2.2.1.1 Get network information<br />

An example of getting network information is as below:<br />

public void getNetworks(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into getNetworks...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

GetNetworksObj getNetworksObj = new GetNetworksObj();<br />

getNetworksObj.setUsername(username);<br />

getNetworksObj.setPassword(password);<br />

tw.com.draytek.acs.obj.NetworkList networkList = null;<br />

networkList = binding.getNetworks(getNetworksObj);<br />

tw.com.draytek.acs.obj.Network networks[] = networkList.<br />

getNetworkList();<br />

for (int i = 0; i < networks.length; i++) {<br />

networks[i].getId();<br />

networks[i].getName();<br />

System.out.println("i=" + i + ",id=" +<br />

networks[i].getId() + ",name=" +<br />

networks[i].getName() + ",parentId=" +<br />

networks[i].getParent_id());<br />

}<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

5


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

As mentioned above, you need information of web service URL, user name and user password of<br />

<strong>VigorACS</strong> to use the web service. The <strong>API</strong> class used in this sample described as following:<br />

<strong>API</strong> Class and method<br />

tw.com.draytek.acs.webservicse.execute.A<br />

CS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

Description<br />

Build a Stub binding to client(line4)<br />

tw.com.draytek.acs.webservicse.execute.A<br />

CS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator<br />

Locate and get the web service(line9~10)<br />

GetNetworksObj<br />

Operations object of getting network<br />

configurations by input user name and<br />

password(line25~27)<br />

Return all network configuration on<br />

<strong>VigorACS</strong>, the returned object is<br />

binding.getNetworks(getNetworksObj)<br />

tw.com.draytek.acs.obj.NetworkList(line29<br />

~30)<br />

tw.com.draytek.acs.obj.Network<br />

The network object(line31)<br />

The process of get network information is as following:<br />

• Build stub binding of web services.<br />

• Locate and find web services by URL.<br />

• Define operation, input user name and password of <strong>VigorACS</strong>.<br />

• Manipulate network objects to get information.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

2.2.1.2 Change network configuration<br />

An example of change network configuration is as below:<br />

public void changeNetwork(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into changeNetwork...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

6


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

ChangeNetworkObj changeNetworkObj = new ChangeNetworkObj();<br />

changeNetworkObj.setUsername(username);<br />

changeNetworkObj.setPassword(password);<br />

changeNetworkObj.setSerialnumber(serialnumber);<br />

changeNetworkObj.setNetworkId(2);<br />

int value;<br />

value = binding.changeNetwork(changeNetworkObj);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

The client stub binding and web service finding process is same as section 2.2.1.1. If you have<br />

question about that please reference section 2.2.1.1.<br />

For changing devices or networks to specific network, you should know the serial number of<br />

this device, the id of the network you want to assign the device. Surely, the user name and user<br />

password is necessary.<br />

<strong>API</strong> Class and method<br />

ChangeNetworkObj<br />

changeNetworkObj.setSerialnumber(serial<br />

number)<br />

changeNetworkObj.setNetworkId(2)<br />

binding.changeNetwork(changeNetworkO<br />

bj)<br />

Description<br />

Operations object of changing network<br />

configurations.(line 23)<br />

Set serial number of the device that you<br />

want to change its network.(line26)<br />

Set network id for the device that you want<br />

to change.(line27)<br />

This method return value of the changing<br />

network result, 0 means change<br />

successfully, -1 means authentication fail,<br />

and -2 means change fails.(line30)<br />

7


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

2.2.2 Devices management<br />

<strong>VigorACS</strong> supports device management through web service. Users can get devices<br />

information, for example, get how many devices are managed by <strong>VigorACS</strong>, what are those<br />

devices, or enable specific devices.<br />

2.2.2.1 Get devices count<br />

How do you know how many devices are managed by <strong>VigorACS</strong> through web service? An<br />

example is as following:<br />

public void getDeviceCount(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into GetDeviceCount...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

GetDeviceCountObj getDeviceCountObj = new GetDeviceCountObj();<br />

getDeviceCountObj.setUsername(username);<br />

getDeviceCountObj.setPassword(password);<br />

//status: 0: all device, 1: admin device, 2: home device<br />

getDeviceCountObj.setStatus(<strong>Web</strong><strong>Service</strong>Property.DEVICE_TYPE_ALL);<br />

int value;<br />

value = binding.getDeviceCount(getDeviceCountObj);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

}<br />

8


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

The binding and finding web services has discussed in section 2.1.1.1(line4~18). <strong>Web</strong> service <strong>API</strong><br />

and method is described as following:<br />

<strong>API</strong> Class and method<br />

GetDeviceCountObj<br />

getDeviceCountObj.setStatus(<strong>Web</strong><strong>Service</strong>P<br />

roperty.DEVICE_TYPE_ALL)<br />

binding.getDeviceCount(getDeviceCountO<br />

bj)<br />

Description<br />

Operations object for getting devices<br />

count.(line25)<br />

This method get devices count at different<br />

criteria, the argument is 0 or 1, or 2. Set<br />

argument to 0 means retrieve all devices<br />

count, 1 means retrieve devices count<br />

under admin privilege, 2 means retrieve<br />

devices count at Table View.(line30)<br />

This method return value of the getting<br />

devices count result, 0 means get<br />

successfully, -1 means authentication fail,<br />

and -2 means change fails.(line30)<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

2.2.2.2 Get devices information<br />

How do you know what devices are managed by <strong>VigorACS</strong> through web service?<br />

An example is as following.<br />

public void getDevices(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into GetDevice...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

9


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

45<br />

46<br />

47<br />

48<br />

49<br />

GetDevicesObj getDevicesObj = new GetDevicesObj();<br />

getDevicesObj.setUsername(username);<br />

getDevicesObj.setPassword(password);<br />

//status: 0: all device, 1: admin device, 2: home device<br />

getDevicesObj.setStatus(<strong>Web</strong><strong>Service</strong>Property.DEVICE_TYPE_ALL);<br />

getDevicesObj.setFromIndex(0);<br />

getDevicesObj.setToIndex(1);<br />

tw.com.draytek.acs.obj.DeviceList deviceList = null;<br />

deviceList = binding.getDevices(getDevicesObj);<br />

tw.com.draytek.acs.obj.Device[] value = deviceList.getDeviceList();<br />

for (int i = 0; i < value.length; i++) {<br />

System.out.println("i=" + i + ",serialnumber=" +<br />

value[i].getSerialNumber() + ",ip=" +<br />

value[i].getIp() + ",deviceName=" +<br />

value[i].getDevice_name());<br />

}<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

}<br />

If you have any question about stub binding and web service finding, please reference section<br />

2.1.1.1.<br />

<strong>Web</strong> service <strong>API</strong> and method is described as following:<br />

<strong>API</strong> Class and method<br />

GetDevicesObj<br />

getDevicesObj.setStatus(<strong>Web</strong><strong>Service</strong>Prope<br />

rty.DEVICE_TYPE_ALL)<br />

getDevicesObj.setFromIndex()<br />

getDevicesObj.setToIndex()<br />

tw.com.draytek.acs.obj.DeviceList<br />

binding.getDevices(getDevicesObj)<br />

tw.com.draytek.acs.obj.Device<br />

Description<br />

Operations object for get devices<br />

information.(line27)<br />

This method get devices count at different<br />

criteria, the argument is 0 or 1, or 2. Set<br />

argument to 0 means retrieve all devices<br />

information, 1 means retrieve devices<br />

information under admin privilege, 2<br />

means retrieve devices information at<br />

Table View.(line32)<br />

Devices index that begins. The start index<br />

is 0.<br />

Devices index that ends. You should not<br />

assign a integer greater than devices count-<br />

1<br />

A list object of devices.<br />

This method return the device object list,<br />

defined as<br />

tw.com.draytek.acs.obj.DeviceList<br />

Object of the device information.<br />

10


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

2.2.2.3 Enable Device<br />

The enabled devices would be managed by <strong>VigorACS</strong>. How to enable devices through web<br />

service? An example is as following:<br />

public void enableDevice(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into EnableDevice...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

EnableDeviceObj enableDeviceObj = new EnableDeviceObj();<br />

enableDeviceObj.setUsername(username);<br />

enableDeviceObj.setPassword(password);<br />

enableDeviceObj.setSerialnumber(serialnumber);<br />

//status: 0: disable device, 1: enable device, 2: delete device<br />

enableDeviceObj.setStatus(<strong>Web</strong><strong>Service</strong>Property.DISABLE_DEVICE);<br />

int value;<br />

value = binding.enableDevice(enableDeviceObj);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

<strong>Web</strong> service <strong>API</strong> and method is described as following.<br />

<strong>API</strong> Class and method<br />

EnableDeviceObj<br />

enableDeviceObj.setSerialnumber(serialnu<br />

mber)<br />

Description<br />

Operations object for enable a device.<br />

This method set the serial number of the<br />

device you want to enable to manage.<br />

11


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

enableDeviceObj.setStatus(<strong>Web</strong><strong>Service</strong>Pro<br />

perty.DISABLE_DEVICE)<br />

binding.enableDevice(enableDeviceObj)<br />

Set the status of the device. There are 3<br />

status, 0 means disable the device, 1 means<br />

enable the device and 2 means delete the<br />

device.<br />

Return values for the enable device result.<br />

0 means success,-1 means authentication<br />

fail and -2 means fail.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

2.2.3 CPE parameters management<br />

<strong>VigorACS</strong> web service <strong>API</strong> support management of CPE parameters, for example: get all<br />

RPC methods of TR069 support by the specific CPE, get and set parameter values or parameter<br />

attributes.<br />

2.2.3.1 Get RPC methods<br />

How to know which RPC method is supported by a specific CPE? Knowing those methods<br />

would useful for TR069 parameters settings. The web service <strong>API</strong> provides functions to access<br />

CPEs and retrieve those RPC methods.<br />

An example is as following:<br />

public void getRPCMethods(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into GetRPCMethods...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

GetRPCMethodsObj getRPCMethodsObj = new GetRPCMethodsObj();<br />

getRPCMethodsObj.setUsername(username);<br />

12


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

getRPCMethodsObj.setPassword(password);<br />

getRPCMethodsObj.setSerialnumber(serialnumber);<br />

java.lang.String[] value = null;<br />

value = binding.getRPCMethods(getRPCMethodsObj);<br />

for (int i = 0; i < value.length; i++) {<br />

System.out.println("i=" + i + ", value=" + value[i]);<br />

}<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

}<br />

The web service <strong>API</strong> and method is described as following:<br />

<strong>API</strong> Class and method<br />

GetRPCMethodsObj<br />

getRPCMethodsObj.setSerialnumber(serial<br />

number)<br />

binding.getRPCMethods(getRPCMethods<br />

Obj)<br />

2.2.3.2 Get CPE parameter names<br />

13<br />

Description<br />

Operations object for getting RPC methods<br />

of specific CPE.<br />

This method sets serial numbers of the<br />

CPE that you want get its RPC methods.<br />

This method returns an array of String,<br />

containing RPC method names.<br />

The web service <strong>API</strong> allows users to get TR069 parameters and parameter status (writable or<br />

not writable) of to specific CPE. An example of get CPE parameters is as following:<br />

public void getParameterNames(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into GetParameterNames...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

45<br />

46<br />

47<br />

// Test operation<br />

GetParameterNamesObj getParameterNames = new GetParameterNamesObj();<br />

getParameterNames.setUsername(username);<br />

getParameterNames.setPassword(password);<br />

getParameterNames.setSerialnumber(serialnumber);<br />

getParameterNames.setNextLevel(true);<br />

getParameterNames.setParameterPath(<br />

"InternetGatewayDevice.LANDeviceNumberOfEntries");<br />

tw.com.draytek.acs.obj.ParameterInfoStructList structList = null;<br />

structList = binding.getParameterNames(getParameterNames);<br />

tw.com.draytek.acs.obj.ParameterInfoStruct[] value = structList.<br />

getParameterInfoStructList();<br />

for (int i = 0; i < value.length; i++) {<br />

System.out.println("i=" + i + ",Name=" + value[i].getName());<br />

System.out.println("i=" + i + ",Writable=" +<br />

value[i].isWritable());<br />

}<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

}<br />

The web service <strong>API</strong> and method described as following:<br />

<strong>API</strong> Class and method<br />

GetParameterNamesObj<br />

getParameterNames.setSerialnumber(serial<br />

number)<br />

getParameterNames.setNextLevel(true)<br />

getParameterNames.setParameterPath("Int<br />

ernetGatewayDevice.LANDeviceNumber<br />

OfEntries")<br />

Description<br />

Operations object for getting TR069<br />

parameter names and parameter status from<br />

a specific CPE.<br />

Set serial number of the CPE that you want<br />

to retrieve its parameter names and status.<br />

The parameter value of this method is true<br />

or false, or empty. If the parameter value is<br />

set false, the method returns all parameter<br />

names that with path start from the given<br />

parameter path string. If the parameter<br />

value is set true, the method returns<br />

parameter names one level below the given<br />

parameter path string. If the parameter<br />

value is empty, the method returns all<br />

accessible parameter names.<br />

The parameter value is string of TR069<br />

parameter name and its path.<br />

14


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

tw.com.draytek.acs.obj.ParameterInforStru<br />

ctList<br />

tw.com.draytek.acs.obj.ParameterInforStru<br />

ct<br />

A list of parameters information.<br />

Containing parameter names and<br />

information and returned by<br />

tw.com.draytek.acs.webservicse.execute.A<br />

CS<strong>Web</strong><strong>Service</strong>sSoapBindingStub object<br />

with getParameterNames method<br />

Object contains parameter name and<br />

information.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

2.2.3.3 Get CPE parameter values<br />

How to get CPE parameter values through <strong>VigorACS</strong> web service <strong>API</strong>? An example is as<br />

following:<br />

public void getParameterValues(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into GetParameterValues...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

String parameterNames[] = {<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformInterval",<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformEnable"};<br />

tw.com.draytek.acs.obj.GetParameterValuesObj getParameterValues = new<br />

tw.com.draytek.acs.obj.GetParameterValuesObj();<br />

getParameterValues.setSerialnumber(serialnumber);<br />

getParameterValues.setUsername(username);<br />

getParameterValues.setPassword(password);<br />

15


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

45<br />

46<br />

47<br />

48<br />

49<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

getParameterValues.setParameterNames(parameterNames);<br />

tw.com.draytek.acs.obj.ParameterValueStructList structList;<br />

structList = binding.getParameterValues(getParameterValues);<br />

tw.com.draytek.acs.obj.ParameterValueStruct[] value = structList.<br />

getParameterValueStructList();<br />

for (int i = 0; i < value.length; i++) {<br />

System.out.println("i=" + i);<br />

System.out.println("name=" + value[i].getName());<br />

System.out.println("value=" + value[i].getValue());<br />

}<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

}<br />

The web service <strong>API</strong> and method described as following:<br />

<strong>API</strong> Class and method<br />

tw.com.draytek.acs.obj.GetParameterValue<br />

sObj<br />

getParameterValues.setSerialnumber(serial<br />

number)<br />

getParameterValues.setParameterNames(pa<br />

rameterNames)<br />

tw.com.draytek.acs.obj.ParameterValueStru<br />

ctList<br />

tw.com.draytek.acs.obj.ParameterValueStru<br />

ct<br />

2.2.3.4 Get CPE parameter attributes<br />

Description<br />

Operations object for getting CPE TR069<br />

parameter values.<br />

This method sets serial number of the CPE<br />

that you want to retrieve its parameter<br />

values.<br />

The argument of this method is a string<br />

array, containing parameter names<br />

A list of parameter names and values<br />

information, return by getParameterValues<br />

method of<br />

tw.com.draytek.acs.webservicse.execute.A<br />

CS<strong>Web</strong><strong>Service</strong>sSoapBindingStub object<br />

Object contains name and value of each<br />

requested parameter.<br />

The web service <strong>API</strong> allows users get CPE parameter attribute. An example is as following:<br />

public void getParameterAttributes(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into GetParameterAttributes...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

16


13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

45<br />

46<br />

47<br />

48<br />

49<br />

50<br />

51<br />

52<br />

53<br />

54<br />

}<br />

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

String parameterNames[] = {<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformInterval",<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformEnable"};<br />

GetParameterAttributesObj getParameterAttributesObj = new<br />

GetParameterAttributesObj();<br />

getParameterAttributesObj.setSerialnumber(serialnumber);<br />

getParameterAttributesObj.setUsername(username);<br />

getParameterAttributesObj.setPassword(password);<br />

getParameterAttributesObj.setParameterNames(parameterNames);<br />

tw.com.draytek.acs.obj.ParameterAttributeStructList structList;<br />

structList = binding.getParameterAttributes(<br />

getParameterAttributesObj);<br />

tw.com.draytek.acs.obj.ParameterAttributeStruct[] value =<br />

structList.getParameterAttributeStructList();<br />

for (int i = 0; i < value.length; i++) {<br />

System.out.println("i=" + i);<br />

System.out.println("name=" + value[i].getName());<br />

System.out.println("Notification=" + value[i].getNotification());<br />

String accessList[] = value[i].getAccessList();<br />

for (int j = 0; j < accessList.length; j++) {<br />

System.out.println("j=" + j);<br />

System.out.println("Notification=" + accessList[j]);<br />

}<br />

}<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

The web service <strong>API</strong> and method described as following:<br />

<strong>API</strong> Class and method<br />

GetParameterAttributesObj<br />

Description<br />

Operations object for getting CPE TR069<br />

parameter attributes.<br />

17


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

getParameterAttributesObj.setSerialnumbe<br />

r(serial number)<br />

getParameterAttributesObj.setParameterNa<br />

mes(parameterNames)<br />

tw.com.draytek.acs.obj.ParameterAttribute<br />

StructList<br />

tw.com.draytek.acs.obj.ParameterAttribute<br />

Struct<br />

This method sets serial number of the CPE<br />

that you want to retrieve its parameter<br />

attributes.<br />

The argument of this method is a string<br />

array, containing parameter names<br />

A list of parameter names and values<br />

information, return by<br />

getParameterAttributes method of<br />

tw.com.draytek.acs.webservicse.execute.A<br />

CS<strong>Web</strong><strong>Service</strong>sSoapBindingStub object<br />

Object contains name and value of each<br />

requested parameter attribute.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

2.2.3.5 Set CPE parameter values<br />

The web service <strong>API</strong> allows users to set parameter values to CPEs. An example is as<br />

following:<br />

public void setParameterValues(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into setParametervalues...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

ArrayList requestList = new ArrayList();<br />

tw.com.draytek.acs.obj.ParameterValueStruct<br />

requestParameter;<br />

requestParameter = new tw.com.draytek.acs.obj.<br />

ParameterValueStruct();<br />

18


31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

45<br />

46<br />

47<br />

48<br />

49<br />

50<br />

51<br />

52<br />

53<br />

54<br />

55<br />

56<br />

57<br />

58<br />

59<br />

60<br />

}<br />

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

requestParameter.setName(<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformInterval");<br />

requestParameter.setValue("86488");<br />

requestList.add(requestParameter);<br />

requestParameter = new tw.com.draytek.acs.obj.<br />

ParameterValueStruct();<br />

requestParameter.setName(<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformEnable");<br />

requestParameter.setValue("true");<br />

requestList.add(requestParameter);<br />

SetParameterValuesObj setParameterValues = new<br />

SetParameterValuesObj();<br />

setParameterValues.setSerialnumber(serialnumber);<br />

setParameterValues.setUsername(username);<br />

setParameterValues.setPassword(password);<br />

setParameterValues.setParameterKey("<strong>Web</strong><strong>Service</strong> Test");<br />

setParameterValues.setParameterList((tw.com.draytek.acs.obj.<br />

ParameterValueStruct[])<br />

requestList.toArray(new<br />

tw.com.draytek.acs.obj.ParameterValueStruct[0]));<br />

int value;<br />

value = binding.setParameterValues(setParameterValues);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

For this case, you should assign the value and parameter name in<br />

tw.com.draytek.acs.obj.ParameterValueStruct class objects, and then set those objects with<br />

SetParameterValuesObj class objects. The web service <strong>API</strong> is described as following:<br />

<strong>API</strong> Class and method<br />

SetParameterValuesObj<br />

setParameterValues.setSerialnumber(serial<br />

number)<br />

setParameterValues.setParameterKey("")<br />

setParameterValues.setParameterList()<br />

Description<br />

Object for setting CPE parameter values.<br />

This method set serial number of the CPE<br />

that you want to set its parameter values.<br />

The argument of this method is a string.<br />

The parameter key is set for distinguishing<br />

the parameters set at different time. Thus<br />

the argument string should be unique. This<br />

method allows the argument be an empty<br />

string and left to the discretion of<br />

<strong>VigorACS</strong>.<br />

The argument of this method is a<br />

tw.com.draytek.acs.obj.<br />

ParameterValueStruct object array<br />

19


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

binding.setParameterValues()<br />

(line55) This method returns 0 or 1 to<br />

indicate the result of setting parameter<br />

values. 0 means parameter has been set and<br />

applied with new values. 1 means the<br />

parameter values has been validated but<br />

not applied yet. (For example, the<br />

parameter value changes require CPE<br />

rebooting to applied)<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

2.2.3.6 Set CPE parameter attributes<br />

The web service <strong>API</strong> provides functions to modify parameter attributes, an example is as<br />

following:<br />

public void setParameterAttributes(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into SetParameterAttributes...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

ArrayList requestList = new ArrayList();<br />

tw.com.draytek.acs.obj.SetParameterAttributesStruct<br />

requestParameter;<br />

requestParameter = new tw.com.draytek.acs.obj.<br />

SetParameterAttributesStruct();<br />

requestParameter.setAccessList(new String[] {"Subscriber"});<br />

requestParameter.setAccessListChange(true);<br />

requestParameter.setName(<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformInterval");<br />

requestParameter.setNotification(0);<br />

requestParameter.setNotificationChange(true);<br />

20


36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

44<br />

45<br />

46<br />

47<br />

48<br />

49<br />

50<br />

51<br />

52<br />

53<br />

54<br />

55<br />

56<br />

57<br />

58<br />

59<br />

60<br />

61<br />

62<br />

63<br />

64<br />

65<br />

66<br />

67<br />

}<br />

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

requestList.add(requestParameter);<br />

requestParameter = new tw.com.draytek.acs.obj.<br />

SetParameterAttributesStruct();<br />

requestParameter.setAccessList(new String[] {"Subscriber"});<br />

requestParameter.setAccessListChange(true);<br />

requestParameter.setName(<br />

"InternetGatewayDevice.ManagementServer.PeriodicInformEnable");<br />

requestParameter.setNotification(0);<br />

requestParameter.setNotificationChange(true);<br />

requestList.add(requestParameter);<br />

SetParameterAttributesObj setParameterAttributesObj = new<br />

SetParameterAttributesObj();<br />

setParameterAttributesObj.setSerialnumber(serialnumber);<br />

setParameterAttributesObj.setUsername(username);<br />

setParameterAttributesObj.setPassword(password);<br />

setParameterAttributesObj.setParameterList((tw.com.draytek.acs.obj.<br />

SetParameterAttributesStruct[])<br />

requestList.toArray(new<br />

tw.com.draytek.acs.obj.<br />

SetParameterAttributesStruct[<br />

0]));<br />

int value;<br />

value = binding.setParameterAttributes(setParameterAttributesObj);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

The web service <strong>API</strong> is described as following:<br />

<strong>API</strong> Class and method<br />

tw.com.draytek.acs.obj.SetParameterAttrib<br />

utesStruct<br />

requestParameter.setAccessList(new<br />

String[] {"Subscriber"})<br />

requestParameter.setAccessListChange(tru<br />

e)<br />

Description<br />

Object class for assign parameter<br />

attributes. Parameter attributes information<br />

is stored.<br />

The write access to the specified<br />

parameters is granted. At present, only<br />

“Sbuscriber” is defined.<br />

The argument of the method is Boolean. If<br />

the argument set true, the value of<br />

AccessList replaces the current access list<br />

for this parameter. If false, no change is<br />

made to the access list.<br />

21


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

requestParameter.setNotification(0)<br />

requestParameter.setNotificationChange(tr<br />

ue)<br />

SetParameterAttributesObj<br />

Indicates whether the CPE will include<br />

changed values of the specified parameters<br />

in the inform message. The specified<br />

parameter value changes when the CPE<br />

initiate a session. The argument is default<br />

set to 0 (Notification off), the CPE change<br />

specified parameters without informing<br />

<strong>VigorACS</strong>.<br />

The argument is a Boolean. If the argument<br />

is set true, the value of notification replaces<br />

the current notification setting for this<br />

parameter or group of parameters. If false,<br />

no change is made.<br />

Operations object for setting parameter<br />

attributes.<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

2.2.3.7 addObject (Parameters or other objects defined with multiple instances)<br />

The web service allows users to create a new instance of a multi-instance object – a<br />

collection of Parameters and/or other objects for which multiple instances are defined. An example<br />

is as following:<br />

public void addObject(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into AddObject...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

String objectName =<br />

"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.";<br />

AddObjectObj addObjectObj = new<br />

22


28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

}<br />

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

AddObjectObj();<br />

addObjectObj.setSerialnumber(serialnumber);<br />

addObjectObj.setUsername(username);<br />

addObjectObj.setPassword(password);<br />

addObjectObj.setParameterKey("<strong>Web</strong><strong>Service</strong>AddObject");<br />

addObjectObj.setObjectName(objectName);<br />

tw.com.draytek.acs.obj.AddObjectResponse value;<br />

value = binding.addObject(addObjectObj);<br />

System.out.println("objectName=" + objectName);<br />

System.out.println("InstanceNumber=" + value.getInstanceNumber());<br />

System.out.println("Status=" + value.getStatus());<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

The web service <strong>API</strong> and method are as following:<br />

<strong>API</strong> Class and method<br />

AddObjectObj<br />

addObjectObj.setSerialnumber(serialnumb<br />

er)<br />

addObjectObj.setParameterKey("<strong>Web</strong>Servi<br />

ceAddObject")<br />

addObjectObj.setObjectName(objectName<br />

)<br />

value.getStatus()<br />

Description<br />

Object for adding new multi-instanced<br />

object.<br />

This method set serial number of the CPE<br />

that you want to add new multi-instanced<br />

objects.<br />

The argument of this method is a string.<br />

The parameter key is set for distinguishing<br />

the parameters set at different time. Thus<br />

the argument string should be unique. This<br />

method allows the argument be an empty<br />

string and left to the discretion of<br />

<strong>VigorACS</strong>.<br />

Set name of the newly added multiinstanced<br />

object.<br />

The status indicates result of adding object,<br />

0Object has been created, 1Object<br />

creation has been validated and committed,<br />

but not yet applied (for example, if reboot<br />

is required).<br />

2.2.3.8 deleteObject (Parameters or other objects defined with multiple<br />

instances)<br />

The web service allows users to delete multi-instance objects – a collection of Parameters<br />

and/or other objects for which multiple instances are defined. An example is as following:<br />

1<br />

public void deleteObject(String url) throws Exception {<br />

23


2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

}<br />

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

System.out.println("**************************");<br />

System.out.println("into DeleteObject...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

String objectName =<br />

"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.3.";<br />

DeleteObjectObj deleteObjectObj = new<br />

DeleteObjectObj();<br />

deleteObjectObj.setSerialnumber(serialnumber);<br />

deleteObjectObj.setUsername(username);<br />

deleteObjectObj.setPassword(password);<br />

deleteObjectObj.setParameterKey("<strong>Web</strong><strong>Service</strong>DeleteObject");<br />

deleteObjectObj.setObjectName(objectName);<br />

int value;<br />

value = binding.deleteObject(deleteObjectObj);<br />

System.out.println("objectName=" + objectName);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

24


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

The web service <strong>API</strong> and method are as following:<br />

<strong>API</strong> Class and method<br />

Description<br />

DeleteObjectObj<br />

Object for deleting multi-instanced objects.<br />

This method set serial number of the CPE<br />

deleteObjectObj.setSerialnumber(serialnu<br />

that you want to delete multi-instanced<br />

mber)<br />

objects.<br />

deleteObjectObj.setParameterKey("<strong>Web</strong>Se<br />

rviceDeleteObject")<br />

deleteObjectObj.setObjectName(objectNa<br />

me)<br />

value<br />

The argument of this method is a string.<br />

The parameter key is set for distinguishing<br />

the parameters set at different time. Thus<br />

the argument string should be unique. This<br />

method allows the argument be an empty<br />

string and left to the discretion of<br />

<strong>VigorACS</strong>.<br />

Set name of the newly added multiinstanced<br />

object.<br />

The value indicates result of deleting<br />

object, 0Object has been deleted,<br />

1Object deletion has been validated and<br />

committed, but not yet applied (for<br />

example, if reboot is required).<br />

25


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

2.2.4 Provision management<br />

<strong>VigorACS</strong> web service <strong>API</strong> allows users to download files to specified CPEs, for example:<br />

firmware upgrade image, web content or vendor configuration file.<br />

An example is as following:<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

39<br />

40<br />

41<br />

42<br />

43<br />

public void download(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into Download...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

DownloadObj downloadObj = new<br />

DownloadObj();<br />

downloadObj.setSerialnumber(serialnumber);<br />

downloadObj.setUsername(username);<br />

downloadObj.setPassword(password);<br />

downloadObj.setCommandKey("<strong>Web</strong><strong>Service</strong>Download");<br />

downloadObj.setDelaySeconds(0);<br />

downloadObj.setDownload_username("acs");<br />

downloadObj.setDownload_password("password");<br />

downloadObj.setFailureURL("FailureURL");<br />

downloadObj.setFileSize(2789432);<br />

downloadObj.setFileType("1 Firmware Upgrade Image");<br />

downloadObj.setSuccessURL("SuccessURL");<br />

downloadObj.setTargetFileName("TargerFileName");<br />

downloadObj.setURL(<br />

"http://172.17.3.111:8080/ACSServer/FileServlet?fileName=v2k7v001.all");<br />

tw.com.draytek.acs.obj.DownloadResponse value;<br />

value = binding.download(downloadObj);<br />

26


44<br />

45<br />

46<br />

47<br />

48<br />

49<br />

50<br />

}<br />

2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

System.out.println("CompleteTime=" + value.getCompleteTime());<br />

System.out.println("StartTime=" + value.getStartTime());<br />

System.out.println("Status=" + value.getStatus());<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

The web service <strong>API</strong> and method are described as following:<br />

<strong>API</strong> Class and method<br />

downloadObj.setURL("http://172.17.3.111:<br />

8080/ACSServer/FileServlet?fileName=v2<br />

k7v001.all")<br />

DownloadObj<br />

downloadObj.setCommandKey("<strong>Web</strong>Servi<br />

ceDownload")<br />

downloadObj.setDelaySeconds(0)<br />

downloadObj.setDownload_username("acs<br />

")<br />

downloadObj.setDownload_password("pas<br />

sword")<br />

downloadObj.setFileSize()<br />

Description<br />

Specified the source file location.<br />

Operations object for the download task.<br />

The argument of this method is a string.<br />

The string the CPE uses to refer to a<br />

particular download. The value of the<br />

CommandKey is entirely at the discretion<br />

of the ACS and may be an empty string.<br />

The argument has different meanings for<br />

Unicast and Multicast downloads. For<br />

Unicast downloads it is the number of<br />

second before the CPE will initiate the<br />

download. For Multicast downloads the<br />

CPE will initiate the download<br />

immediately and it is the number of<br />

seconds available for initiating, performing<br />

and applying the download.<br />

This method set user name used by the<br />

CPE to authenticate with the file server.<br />

The argument could be empty string if no<br />

authentication is required.<br />

This method set password used by the CPE<br />

to authenticate with the file server. The<br />

argument could be empty string if no<br />

authentication is required.<br />

This method set the size of the file to be<br />

downloaded in bytes. The argument is<br />

intended as a hint to the CPE, which the<br />

CPE may use to determine if it has<br />

sufficient space for the file to be<br />

downloaded. If the argument is set to 0, the<br />

CPE would attempt to proceed with the<br />

download under the presumption that<br />

sufficient space is available.<br />

27


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

downloadObj.setFileType("1 Firmware<br />

Upgrade Image")<br />

downloadObj.setTargetFileName("TargerFi<br />

leName")<br />

downloadObj.setSuccessURL("SuccessUR<br />

L")<br />

downloadObj.setFailureURL("FailureURL<br />

")<br />

tw.com.draytek.acs.obj.DownloadResponse<br />

The argument is a string defined with the<br />

following values:<br />

“1 firmware Upgrade Image”<br />

“2 <strong>Web</strong> Content”<br />

“3 Vendor Configuration File”<br />

The name of the file to be used on the<br />

target file system. This argument may be<br />

left empty if the target file name can be<br />

extracted from the downloaded file itself or<br />

from the URL argument.<br />

The CPE should redirect the user’s browser<br />

to if the download completes successfully.<br />

The CPE should redirect the user’s browser<br />

to if the download not completes<br />

successfully.<br />

Object class to instantiate object containing<br />

the download result information.<br />

There are 3 field of the object.<br />

Status indicates the download result,<br />

returns 0 if download has completed and<br />

been applied, or returns 1 if download has<br />

not been completed and applied. (For<br />

example: the CPE need to reboot to apply<br />

the changes).<br />

StartTime: the date and time download<br />

was started in UTC.<br />

CompleteTime: the date and time the<br />

download was fully completed and applied<br />

in UTC.<br />

28


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

25<br />

26<br />

27<br />

28<br />

29<br />

30<br />

31<br />

32<br />

33<br />

34<br />

35<br />

36<br />

37<br />

38<br />

2.2.5 Reboot the CPE<br />

The web service allows users to reboot the CPEs. Some CPEs don’t need to reboot after<br />

configuration, so this function should not used to reboot after CPE configured.<br />

An example is as following:<br />

public void reboot(String url) throws Exception {<br />

System.out.println("**************************");<br />

System.out.println("into Reboot...");<br />

tw.com.draytek.acs.webservicse.execute.ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub<br />

binding;<br />

try {<br />

binding = (tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>sSoapBindingStub)<br />

new tw.com.draytek.acs.webservicse.execute.<br />

ACS<strong>Web</strong><strong>Service</strong>s<strong>Service</strong>Locator().getACS<strong>Web</strong><strong>Service</strong>s(new java.<br />

net.URL(url));<br />

} catch (javax.xml.rpc.<strong>Service</strong>Exception jre) {<br />

if (jre.getLinkedCause() != null) {<br />

jre.getLinkedCause().printStackTrace();<br />

}<br />

throw new junit.framework.AssertionFailedError(<br />

"JAX-RPC <strong>Service</strong>Exception caught: " + jre);<br />

}<br />

try {<br />

// Time out after a minute<br />

binding.setTimeout(60000);<br />

// Test operation<br />

RebootObj rebootObj = new<br />

RebootObj();<br />

rebootObj.setSerialnumber(serialnumber);<br />

rebootObj.setUsername(username);<br />

rebootObj.setPassword(password);<br />

rebootObj.setCommandKey("<strong>Web</strong><strong>Service</strong>Reboot");<br />

int value;<br />

value = binding.reboot(rebootObj);<br />

System.out.println("value=" + value);<br />

} catch (Exception e) {<br />

e.printStackTrace();<br />

}<br />

}<br />

The web service <strong>API</strong> and method are as following:<br />

<strong>API</strong> Class and method<br />

RebootObj rebootObj<br />

Description<br />

Operations object for rebooting the CPEs.<br />

29


2008, September, <strong>Using</strong> <strong>VigorACS</strong> <strong>Web</strong> <strong>Service</strong> <strong>API</strong>-1.0<br />

rebootObj.setSerialnumber(serialnumber)<br />

rebootObj.setCommandKey("<strong>Web</strong><strong>Service</strong>R<br />

eboot")<br />

binding.reboot(rebootObj)<br />

Set serial number for the CPE you want to<br />

reboot.<br />

The argument of this method is a string.<br />

The string to return in the CommandKey<br />

element of the informStruct when the CPE<br />

reboots and calls the inform method.<br />

The value of the CommandKey is entirely<br />

at the discretion of the ACS and MAY be<br />

an empty string.<br />

This method returns 0, -1 and -2 as the<br />

reboot result. 0 means reboot successfully.<br />

-1 means authenticate fail. -2 means fail.<br />

30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!