源码:ext/openwrt/scripts/
设备路径:
/usr/sbin/easycwmp
/usr/share/easycwmp/functions/
源码目录 | 设备目录 | 说明 |
---|---|---|
ext/openwrt/scripts/easycwmp.sh | /usr/bin/easycwmp | 1.命令的入参处理 2.与系统接口的定义(uci,log目录) |
ext/openwrt/scripts/functions/common/common | /usr/share/easycwmp/functions/common | 1.操作方法的具体实现2.Json相关函数3.其他函数封装 |
ext/openwrt/scripts/functions/…/management_server | /usr/share/easycwmp/functions/management_server | 数据模型ManagementServer相关节点定义,GET和SET方法实现 |
ext/openwrt/scripts/functions/…/device_info | /usr/share/easycwmp/functions/device_info | 数据模型DeviceInfo相关节点定义,GET和SET方法实现 |
ext/openwrt/scripts/functions/…/lan_device | /usr/share/easycwmp/functions/lan_device | 数据模型LANDevice相关节点定义,GET和SET方法实现 |
其他文件都是,相应的数据模型定义,ET和SET方法实现;如果要添加数据模型,添加相应的脚步即可。
get | GET节点方法 |
---|---|
set | SET节点方法 |
apply | 未知-后期补充 |
add | 添加节点 |
delete | 删除节点 |
download | 下载操作 |
upload | 上传操作 |
factory_reset | 恢复出厂操作 |
reboot | 重启操作 |
inform | inform操作 |
easycwmp get
{ "parameter": "InternetGatewayDevice.DeviceInfo.SpecVersion", "value": "1.0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.ProvisioningCode", "value": "" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.Manufacturer", "value": "easycwmp" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.ManufacturerOUI", "value": "FFFFFF" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.ProductClass", "value": "easycwmp" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.SerialNumber", "value": "FFFFFF123456" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.HardwareVersion", "value": "example_hw_version" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.SoftwareVersion", "value": "example_sw_version" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.UpTime", "value": "152", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.DeviceLog", "value": "" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.MemoryStatus.Total", "value": "3934328" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.MemoryStatus.Free", "value": "3899292" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.DiagnosticsState", "value": "None" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.Host", "value": "" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.NumberOfRepetitions", "value": "3", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.Timeout", "value": "1000", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.DataBlockSize", "value": "64", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.SuccessCount", "value": "0", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.FailureCount", "value": "0", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.AverageResponseTime", "value": "0", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.MinimumResponseTime", "value": "0", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.MaximumResponseTime", "value": "0", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.ManagementServer.URL", "value": "http:\/\/192.168.1.110:8080\/openacs\/acs" }
{ "parameter": "InternetGatewayDevice.ManagementServer.Username", "value": "easycwmp" }
{ "parameter": "InternetGatewayDevice.ManagementServer.Password", "value": "" }
{ "parameter": "InternetGatewayDevice.ManagementServer.PeriodicInformEnable", "value": "1", "type": "xsd:boolean" }
{ "parameter": "InternetGatewayDevice.ManagementServer.PeriodicInformInterval", "value": "100", "type": "xsd:unsignedInt" }
{ "parameter": "InternetGatewayDevice.ManagementServer.PeriodicInformTime", "value": "0001-01-01T00:00:00Z", "type": "xsd:dateTime" }
{ "parameter": "InternetGatewayDevice.ManagementServer.ConnectionRequestURL", "value": "" }
{ "parameter": "InternetGatewayDevice.ManagementServer.ConnectionRequestUsername", "value": "easycwmp" }
{ "parameter": "InternetGatewayDevice.ManagementServer.ConnectionRequestPassword", "value": "" }
{ "parameter": "InternetGatewayDevice.ManagementServer.ParameterKey", "value": "" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus", "value": "Connected" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress", "value": "" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress", "value": "" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable", "value": "", "type": "xsd:boolean" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username", "value": "" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password", "value": "" }
# easycwmp get InternetGatewayDevice.DeviceInfo.MemoryStatus.Total
{ "parameter": "InternetGatewayDevice.DeviceInfo.MemoryStatus.Total", "value": "3934328" }
# easycwmp get InternetGatewayDevice.DeviceInfo.MemoryStatus.Tot
{ "parameter": "InternetGatewayDevice.DeviceInfo.MemoryStatus.Tot", "fault_code": "9005" }
如果要获取整个数据模型的name使用命令easycwmp get name InternetGatewayDevice. 0
easycwmp get name InternetGatewayDevice.WANDevice. 0
{ "parameter": "InternetGatewayDevice.WANDevice.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable", "writable": "1" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username", "writable": "1" }
{ "parameter": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password", "writable": "1" }
easycwmp get name InternetGatewayDevice. 1
{ "parameter": "InternetGatewayDevice.DeviceInfo.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.IPPingDiagnostics.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.LANDevice.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.ManagementServer.", "writable": "0" }
{ "parameter": "InternetGatewayDevice.WANDevice.", "writable": "0" }
使用方法类似get value
# easycwmp get notification InternetGatewayDevice.DeviceInfo.
{ "parameter": "InternetGatewayDevice.DeviceInfo.SpecVersion", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.ProvisioningCode", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.Manufacturer", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.ManufacturerOUI", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.ProductClass", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.SerialNumber", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.HardwareVersion", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.SoftwareVersion", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.UpTime", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.DeviceLog", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.MemoryStatus.Total", "notification": "0" }
{ "parameter": "InternetGatewayDevice.DeviceInfo.MemoryStatus.Free", "notification": "0" }
# easycwmp set value InternetGatewayDevice.ManagementServer.PeriodicInformInterval 1002
# easycwmp get value InternetGatewayDevice.ManagementServer.PeriodicInformInterval
{ "parameter": "InternetGatewayDevice.ManagementServer.PeriodicInformInterval", "value": "1002", "type": "xsd:unsignedInt" }
set操作时,源码中有一个bug,导致无法设置成功
common文件 line 686
[ "$permission" != "1" -o -z "$setcmd" ] && exit $E_NON_WRITABLE_PARAMETER
替换成
[ "$permission" != "1" -o -z `$setcmd $val` ] && exit $E_NON_WRITABLE_PARAMETER
其他操作后期补充
脚本模块一方面通过系统调用,完成与系统的连接;另一方面,通过输出固定的格式(Json)的数据,与C语言实现TR069协议的其他模块进行通信,详细通信细节后期补充。