原创作品,转载请注明出处
copyright:weishusheng 2015.3.18
email:642613208@qq.com
平台:
Linux version 2.6.32-279.el6.x86_64
交叉编译器路径:/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-
开发板:FL2440
开发板运行内核:linux3.0
开发板文件系统:initramfs
openacs和easycwmp要能正确通信,需要修改脚本配置,下面给出需要修改的脚本,及修改方法。
一.修改/etc/config/easycwmp,它是一个链接,链接到了easycwmp/ext/openwrt/config/easycwmp
[weishusheng@centOS6 ~]$ vim /etc/config/easycwmp
# easycwmp uci configuration
config local
option interface eth0
option port 7547
option ubus_socket /var/run/ubus.sock
option date_format %FT%T%z
option username easycwmp
option password easycwmp
config acs
option scheme http
option username openacs
option password openacs
option hostname 192.168.1.21 #acs服务器ip
option port 8080
option path /openacs/acs #路径,注意后面还有个acs
option parameter_key '1'
option periodic_enable 'true'
option periodic_interval '180'
option periodic_time '1'
config device
option manufacturer easycwmp
option oui FFFFFF
option product_class weishusheng #如果你在浏览器里登上acs服务器,点击find cpe,如果能连上,这个名字就会出现
option serial_number FFFFFF12345 #这个信息会出现在jboos运行窗口
option hardware_version example_hw_version
option software_version example_sw_version
config scripts
# load OpenWrt generic network functions
list location /lib/functions/network.sh
# load easycwmp common functions
list location /usr/share/easycwmp/functions/common
# easycwmp specific functions
list location /usr/share/easycwmp/functions/device_info
list function device_info
list location /usr/share/easycwmp/functions/lan_device
list function lan_device
list location /usr/share/easycwmp/functions/management_server
list function management_server
list location /usr/share/easycwmp/functions/wan_device
list function wan_device
二. 运行jboos
[weishusheng@centOS6 bin]$ ./run.sh -b 0.0.0.0
让jboos运行着。
三.运行easycwmp,注意切换到超级用户模式下,不然你的easycwmp启动时会卡在执行easycwmp.sh那里
[weishusheng@localhost ~]$ su
Password:
[root@localhost weishusheng]# /usr/sbin/easycwmpd -f -b
四. 在浏览器里访问http://192.168.1.21:8080/openacs/,点击"find CPE",如果cpe成功上报的话,Hardware的下拉框里面就会有cpe的型号(在这里我是weishusheng),在SerialNumber框里面输入cpe的sn号(这个在Inform报文里面有)即可进行查询。
五. 查询页面的overview页面有个reboot按钮,点击之后acs就会向cpe下发reboot方法,cpe收到后就会自动重启。
六 . 接下来我们就可以创建自己的脚本来测试TR069协议了。在"Configuration scripts"-->"Default"里输入要操作的脚本,点击SAVE,当ACS收到CPE发来的INFORM消息后,ACS就会运行Default脚本。比如:在Default里面输入以下脚本
logger("=======>GetRPCMethods<=============");
var methods = cpe.GetRPCMethods ();
for (i = 0; i < methods.length; i++) {
logger ("Method: "+methods[i]);
}
logger("============>END<====================");
logger("=========>WEISHUSHENG<================");
运行easycwmp,会在acs服务器端看到以下信息:
04:42:34,998 ERROR [STDERR] 2015-2-3 4:42:34 org.openacs.Configurator log
信息: FFFFFF:FFFFFF123456 Configurator::run
04:42:35,017 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.Configurator log
信息: FFFFFF:FFFFFF123456 Backup cwmp tree
04:42:35,021 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.utils.Version Set
警告: Invalid version string: example_sw_version Non numeric elements assumed to be 0
04:42:35,023 INFO [STDOUT] swUpdate=null
04:42:35,024 INFO [STDOUT] Configurator: UPDATE ProvisioningCode
04:42:35,033 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.Configurator log
警告: FFFFFF:FFFFFF123456 Config lookup: No such entity!
04:42:35,041 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: =======>GetRPCMethods<=============
04:42:35,041 INFO [STDOUT] Received: GetRPCMethods
04:42:35,044 INFO [STDOUT] End of processing
04:42:35,048 WARN [EnvelopeBuilderDOM] Ignore child type: 3
04:42:35,048 WARN [EnvelopeBuilderDOM] Ignore child type: 3
04:42:35,050 INFO [STDOUT] URI null
04:42:35,050 INFO [STDOUT] cwmp NS =urn:dslforum-org:cwmp-1-2
04:42:35,050 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.ACSServlet log
信息: oui=FFFFFF sn=FFFFFF123456 Request is GetRPCMethodsResponse
04:42:35,050 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: GetRPCMethods
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: SetParameterValues
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: GetParameterValues
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: GetParameterNames
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: GetParameterAttributes
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: SetParameterAttributes
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: AddObject
04:42:35,051 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: DeleteObject
04:42:35,052 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: Download
04:42:35,052 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: Reboot
04:42:35,052 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: FactoryReset
04:42:35,052 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: Method: ScheduleInform
04:42:35,053 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: ============>END<====================
04:42:35,053 ERROR [STDERR] 2015-2-3 4:42:35 org.openacs.js.Script logger
信息: =========>WEISHUSHENG<================
04:42:40,055 INFO [STDOUT] Received: null
04:42:40,055 INFO [STDOUT] End of processing
如果看到这些信息,那环境就搭建完成了。