-
Notifications
You must be signed in to change notification settings - Fork 61
/
README
349 lines (205 loc) · 9.53 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
1. EasyCwmp
===========
EasyCwmp is a GPLv2 open source implementation of the TR069 cwmp standard. EasyCwmp is developed by PIVA Software (www.pivasoftware.com) and it is derived from the project freecwmp.The aim of this project is to be fully conform with the TR069 CWMP standard.
2. EasyCwmp sources
====================
http://www.easycwmp.org/index.php/downloads
3. EasyCwmp dependencies
=========================
libuci
libcurl
json-c
libubox: minimum version [git version: 0608d1299546d4af1facc271a090cb2abb8c6105, date: 2012-05-30]
libubus: minimum version [git version: a62e2f8c15a65efb1a82404d8f31e3bfc1cbe7d9, date: 2012-06-01]
microxml: microxml is a fork of Mini-XML, it's being used to parse XML blocks passed between ACS and the client and it's published by freecwmp guys:
microxml source:
git clone https://github.com/pivasoftware/microxml.git
microxml OpenWRT package:
wget http://easycwmp.org/download/libmicroxml.tar.gz
4. EasyCwmp install for OpenWRT Linux
======================================
EasyCwmp
========
EasyCwmp is mainly developed and tested with OpenWRT Linux platform.
Download:
Download the easycwmp-openwrt-{x}.{y}.{z}.tar.gz and then copy it to your /path/to/openwrt/package/
cd /path/to/openwrt/package/
tar -xzvf easycwmp-openwrt.tar.gz
cd ..
Build as built-in
make menuconfig #(And then select the package as <*>)
make
Build as package:
make menuconfig #(And then select the package as <M>)
make package/easycwmp/compile
Install:
Build as built-in: install your OpenWRT system in your device according to the OpenWRT manuals and then start your system and you will get easycwmp running automatically
Build as package: copy the package to the OpenWRT system and then install it with:
opkg install
And then run it with:
/etc/init.d/easycwmpd start
or run it with:
/etc/init.d/easycwmpd boot
Note: If you run easycwmpd with start command then it will send inform to the ACS containing "2 PERIODIC" event and send GetRPCMethods to the ACS. And if you run easycwmpd with boot command then it will send inform to the ACS containing "1 BOOT" event.
Note: A third party application could trigger EasyCwmp daemon to send notify (inform with value change event) by calling the command:
ubus call tr069 notify
If the EasyCwmp daemon receive the ubus call notify then it will check if there is a value changed of parameters with notification not equal to 0
microxml
========
If you got any problem related to libmicroxml when building EasyCwmp in OpenWRT, then you can use the following libmicroxml package:
cd /path/to/openwrt/package/
wget http://easycwmp.org/download/libmicroxml.tar.gz
5. EasyCwmp install for other Linux distributions:
==================================================
general
=======
easycwmp will be placed in /opt/dev/ directory. All other dependencies will be installed in /opt/git/ directory.
Configure USER and GROUP variables that we are going to use:
USER=your_user
GROUP=your_group
Create directories:
sudo mkdir -p /opt/{dev,git}
sudo chown -R $USER:$GROUP /opt/{dev,git}
curl
====
Your distribution should already have curl development package. Use that for now.
Note: If you build libcurl with an SSL package dependency, it is recommended to build with OpenSSL since EasyCwmp was mainly tested with libcurl using OpenSSL.
The digest authentication with ACS server will not work if you build libcurl with PolarSSL.
json-c
======
git clone git://github.com/json-c/json-c.git /opt/git/json-c
cd /opt/git/json-c/
Generate configuration files:
autoreconf -i
Configure:
./configure --prefix=/usr
Build:
make
Install:
sudo make install
sudo ln -sf /usr/include/json-c /usr/include/json
libubox
=======
Get the sources:
git clone git://nbd.name/luci2/libubox.git /opt/git/libubox
cd /opt/git/libubox/
Configure:
cmake CMakeLists.txt -DBUILD_LUA=OFF
Build:
make
Install:
sudo make install
sudo ln -sf /usr/local/lib/libubox.so /usr/lib/libubox.so
sudo mkdir -p /usr/share/libubox
sudo ln -sf /usr/local/share/libubox/jshn.sh /usr/share/libubox/jshn.sh
uci
===
Get the sources:
git clone git://nbd.name/uci.git /opt/git/uci
cd /opt/git/uci/
Configure:
cmake CMakeLists.txt -DBUILD_LUA=OFF
Build:
make
Install:
class="western"
sudo make install
sudo ln -sf /usr/local/bin/uci /sbin/uci
sudo ln -sf /usr/local/lib/libuci.so /usr/lib/libuci.so
ubus
====
Get the sources:
git clone git://nbd.name/luci2/ubus.git /opt/git/ubus
cd /opt/git/ubus/
Configure:
cmake CMakeLists.txt -DBUILD_LUA=OFF
Build:
make
Install:
sudo make install
sudo ln -sf /usr/local/sbin/ubusd /usr/sbin/ubusd
sudo ln -sf /usr/local/lib/libubus.so /usr/lib/libubus.so
microxml
========
Get the sources:
git clone https://github.com/pivasoftware/microxml.git /opt/git/microxml
cd /opt/git/microxml/
Generate configuration files:
autoconf -i
Configure:
./configure --prefix=/usr --enable-threads --enable-shared --enable-static
Build:
make
Install:
sudo make install
sudo ln -sf /usr/lib/libmicroxml.so.1.0 /lib/libmicroxml.so
sudo ln -sf /usr/lib/libmicroxml.so.1.0 /lib/libmicroxml.so.1
easycwmp
========
compiling:
Once the dependencies have been installed we can start compiling easycwmp.
Get the sources:
Download the easycwmp-{x}.{y}.{z}.tar.gz under /opt/dev/
cd /opt/dev/
tar -xzvf easycwmp-{x}.{y}.{z}.tar.gz
mv easycwmp-{x}.{y}.{z} easycwmp
cd /opt/dev/easycwmp/
Generate configuration files:
autoreconf -i
Configure:
./configure --enable-debug --enable-devel --enable-acs=multi --enable-jsonc=1
Build:
make
configuration
We won’t install easycwmp, we’ll use it from /opt/dev/easycwmp/ directory. Make sure we are located there:
cd /opt/dev/easycwmp/
Because we are using this setup for development we want that all our changes are visible in our git clone. Best way to do this is to use symlinks. First create the directory where scripts are located on actual device:
sudo mkdir -p /usr/share/easycwmp/functions
sudo mkdir -p /etc/easycwmp
Then create symlinks for easycwmp scripts:
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/easycwmp.sh /usr/sbin/easycwmp
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/defaults /usr/share/easycwmp/defaults
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/common/common /usr/share/easycwmp/functions/common
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/common/device_info /usr/share/easycwmp/functions/device_info
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/common/management_server /usr/share/easycwmp/functions/management_server
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/common/ipping_launch /usr/share/easycwmp/functions/ipping_launch
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/tr181/root /usr/share/easycwmp/functions/root
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/tr181/ip /usr/share/easycwmp/functions/ip
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/scripts/functions/tr181/ipping_diagnostic /usr/share/easycwmp/functions/ipping_diagnostic
then
chmod +x /opt/dev/easycwmp/ext/openwrt/scripts/functions/*
Also, you can create symlink for easycwmp configuration file:
sudo mkdir /etc/config
sudo ln -sf /opt/dev/easycwmp/ext/openwrt/config/easycwmp /etc/config/easycwmp
And finally create symlink for easycwmpd binary:
sudo ln -sf /opt/dev/easycwmp/bin/easycwmpd /usr/sbin/easycwmpd
We need to export few variables that are used in easycwmp scripts:
export UCI_CONFIG_DIR="/opt/dev/easycwmp/ext/openwrt/config/"
export UBUS_SOCKET="/var/run/ubus.sock"
Install few shell scripts from OpenWrt:
sudo mkdir -p /lib/{config,functions}
sudo wget http://pastebin.lukaperkov.net/openwrt/20121219_lib_functions.sh -O /lib/functions.sh
sudo wget http://pastebin.lukaperkov.net/openwrt/20121219_lib_config_uci.sh -O /lib/config/uci.sh
sudo wget http://pastebin.lukaperkov.net/openwrt/20121219_lib_functions_network.sh -O /lib/functions/network.sh
If everything is configured properly when you run:
bash /usr/sbin/easycwmp -–json get value Device.
You should see some output like this:
{ "parameter": "Device.DeviceInfo.Manufacturer", "fault_code": "", "value": "easycwmp", "type": "xsd:string" }
{ "parameter": "Device.DeviceInfo.ManufacturerOUI", "fault_code": "", "value": "FFFFFF", "type": "xsd:string" }
{ "parameter": "Device.DeviceInfo.ProductClass", "fault_code": "", "value": "easycwmp", "type": "xsd:string" }
{ "parameter": "Device.DeviceInfo.SerialNumber", "fault_code": "", "value": "FFFFFF123456", "type": "xsd:string" }
{ "parameter": "Device.DeviceInfo.HardwareVersion", "fault_code": "", "value": "example_hw_version", "type": "xsd:string" }
{ "parameter": "Device.DeviceInfo.SoftwareVersion", "fault_code": "", "value": "example_sw_version", "type": "xsd:string" }
{ "parameter": "Device.DeviceInfo.UpTime", "fault_code": "", "value": "429120", "type": "xsd:string" }
...
Depending on your system you might need to:
export PATH=$PATH:/usr/sbin:/sbin
sudo ln -sf bash /bin/sh
Please note that your system /bin/sh symbolic link should be pointed to the bash interpretor.
Make changes in /etc/config/easycwmp and in /usr/share/easycwmp/defaults so easycwmpd can connect to your ACS server. But before you run easycwmpd make sure that you have in another terminal running ubusd:
/usr/sbin/ubusd -s /var/run/ubus.sock
Finally run easycwmpd as root:
/usr/sbin/easycwmpd -f -b
Note: A third party application could trigger EasyCwmp daemon to send notify (inform with value change event) by calling the command:
ubus call tr069 notify
If the EasyCwmp daemon receive the ubus call notify then it will check if there is a value changed of parameters with notification not equal to 0