关于CWMP基础(二)----TR069通信流程 1.通信流程图建立TCP连接SSL初始化进行加密建立安全机制由CPE端发起HTTP请求发送Inform报文开始建立CWMP连接。Inform中使用Eventcode字段描述发送Inform请求的原因 如 6 CONNECTION REQUEST 表示ACS要求建立连接。如果ACS通过CPE的请求则连接建立。如果CPE无别的请求则发送一个空报文。满足HTTP报文请求/响应报文交互规则。ACS查询CPE上设置的ACS URL的值CPE将所需要获取的值返回给ACS。ACS发现CPE的ACS URL是本机URL的值于是发起Set请求要求将CPE的ACS URL设置为备用ACS的URL的值。设置成功CPE发送响应报文。ACS无别的请求发送空报文。CPE发送关闭连接2.简单的报文实例POST/acs/xx HTTP/1.1Host:acs.avsystem.com:10301User-Agent:xxx CPE-0.21.3.31(3.6.13)Authorization:Digest username,realmACSRealm,algorithmMD5,nonceJVwsZqxc3qEyTday/kL6C0HBhQLbZCu,uri/acs/xxx,qopauth,nc0000000a,cnonce65da02d074fa0db3,responsea4dfe2ee1670802d4f1e12f330724fc7Content-Type:text/xml;charsetutf-8SOAPAction:cwmp:Inform Content-Length:2970soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemaxmlns:cwmpurn:dslforum-org:cwmp-1-0soap:Headercwmp:ID soap:mustUnderstand1haU761yJla/cwmp:ID/soap:Headersoap:Bodycwmp:InformDeviceIdManufacturerxxx/ManufacturerOUIC074AD/OUIProductClassXXXX/ProductClassSerialNumberXXXXXXX/SerialNumber/DeviceIdEvent soap-enc:arrayTypecwmp:EventStruct[1]EventStructEventCode6CONNECTION REQUEST/EventCodeCommandKey/CommandKey/EventStruct/EventMaxEnvelopes1/MaxEnvelopesCurrentTime2021-04-06T17:05:44/CurrentTimeRetryCount0/RetryCountParameterList soap-enc:arrayTypecwmp:ParameterValueStruct[11]ParameterValueStructNameDevice.GatewayInfo.ManufacturerOUI/NameValue xsi:typexsd:string/Value/ParameterValueStructParameterValueStructNameDevice.GatewayInfo.ProductClass/NameValue xsi:typexsd:string/Value/ParameterValueStructParameterValueStructNameDevice.GatewayInfo.SerialNumber/NameValue xsi:typexsd:string/Value/ParameterValueStructParameterValueStructNameDevice.DeviceInfo.HardwareVersion/NameValue xsi:typexsd:string1.3A/Value/ParameterValueStructParameterValueStructNameDevice.DeviceInfo.SoftwareVersion/NameValue xsi:typexsd:string0.0.0.0/Value/ParameterValueStructParameterValueStructNameDevice.DeviceInfo.ProvisioningCode/NameValue xsi:typexsd:string/Value/ParameterValueStructParameterValueStructNameDevice.ManagementServer.ConnectionRequestURL/NameValue xsi:typexsd:stringhttp://X.X.X.X:7547/4LUa1m6SgD5GBzaR/Value/ParameterValueStructParameterValueStructNameDevice.ManagementServer.ParameterKey/NameValue xsi:typexsd:stringn/a/Value/ParameterValueStructParameterValueStructNameDevice.LAN.IPAddress/NameValue xsi:typexsd:string192.168.131.X/Value/ParameterValueStructParameterValueStructNameDevice.LAN.MACAddress/NameValue xsi:typexsd:string00:00:00:00:00/Value/ParameterValueStructParameterValueStructNameDevice.DeviceSummary/NameValue xsi:typexsd:stringDevice:1.3[](Baseline:1,UDPConnReq:1,GatewayInfo:1,LAN:1,Time:1,IPPing:1,TraceRoute:1,Download:1,Upload:1,MemoryStatus:1),VoiceService:1.0[1](Endpoint:1,SIPEndpoint:1)/Value/ParameterValueStruct/ParameterList/cwmp:Inform/soap:Body/soap:Envelope当建立连接后CPE发送请求并发送Inform报文通知。Eventcode表示请求原因 如connect requestHTTP/1.1200OK Date:Tue,06Apr202109:05:44GMT Set-Cookie:AVSSESSIONID8FbL3sKSb9CFE4BrPp6WmmL_jZb81lXKOmCByV0ja-wILFtvXN_Zgg;Path/Expires:Thu,01Jan197000:00:00GMT Content-Type:text/xml;charsetUTF-8Content-Length:459soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:cwmpurn:dslforum-org:cwmp-1-0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemasoap:Headercwmp:ID soap:mustUnderstand1haU761yJla/cwmp:ID/soap:Headersoap:Bodycwmp:InformResponseMaxEnvelopes1/MaxEnvelopes/cwmp:InformResponse/soap:Body/soap:EnvelopePOST/acs/xx HTTP/1.1ACS收到请求后发送Inform报文响应。soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:cwmpurn:dslforum-org:cwmp-1-0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemasoap:Headercwmp:ID soap:mustUnderstand1haU761yJla/cwmp:ID/soap:Headersoap:Bodycwmp:InformResponseMaxEnvelopes1/MaxEnvelopes/cwmp:InformResponse/soap:Body/soap:EnvelopePOST/acs/xx HTTP/1.1Host:acs.avsystem.com:10301User-Agent:xxxx CPE-0.21.3.31(3.6.13)Cookie:AVSSESSIONID8FbL3sKSb9CFE4BrPp6WmmL_jZb81lXKOmCByV0ja-wILFtvXN_Zgg Authorization:Digest username,realmACSRealm,algorithmMD5,nonceJVwsZqxc3qEyTday/kL6C0HBhQLbZCu,uri/acs/grandstream,qopauth,nc0000000b,cnonce65da02d074fa0db3,response1a89bfd8e8d89377bc9a961769644ef5Content-Type:text/xml;charsetutf-8Content-Length:0CPE发送空报文无别的请求满足HTTP报文的请求/响应的交互规则。HTTP/1.1200OK Date:Tue,06Apr202109:05:45GMT Content-Type:text/xml;charsetUTF-8Content-Length:406soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:cwmpurn:dslforum-org:cwmp-1-0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemasoap:Headercwmp:ID soap:mustUnderstand147ed9304/cwmp:ID/soap:Headersoap:Bodycwmp:GetRPCMethods//soap:Body/soap:EnvelopePOST/acs/xxx HTTP/1.1ACS响应获取getRPCMethods的请求soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemaxmlns:cwmpurn:dslforum-org:cwmp-1-0soap:Headercwmp:ID soap:mustUnderstand147ed9304/cwmp:ID/soap:Headersoap:Bodycwmp:GetRPCMethodsResponseMethodList soap-enc:arrayTypexsd:string[18]stringGetRPCMethods/stringstringGetParameterNames/stringstringGetParameterValues/stringstringSetParameterValues/stringstringSetParameterAttributes/stringstringGetParameterAttributes/stringstringAddObject/stringstringDeleteObject/stringstringReboot/stringstringFactoryReset/stringstringDownload/stringstringUpload/stringstringScheduleInform/stringstringGetQueuedTransfers/stringstringGetAllQueuedTransfers/stringstringScheduleDownload/stringstringCancelTransfer/stringstringChangeDUState/string/MethodList/cwmp:GetRPCMethodsResponse/soap:Body/soap:EnvelopeCPE请求发送GetRPCMethods的响应HTTP/1.1200OK Date:Tue,06Apr202109:05:45GMT Content-Type:text/xml;charsetUTF-8Content-Length:566soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:cwmpurn:dslforum-org:cwmp-1-0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemasoap:Headercwmp:ID soap:mustUnderstand172518d29/cwmp:ID/soap:Headersoap:Bodycwmp:GetParameterValuesParameterNames soap-enc:arrayTypexsd:string[1]stringDevice.ManagementServer.PeriodicInformInterval/string/ParameterNames/cwmp:GetParameterValues/soap:Body/soap:EnvelopePOST/acs/xxxx HTTP/1.1Host:acs.avsystem.com:10301User-Agent:xxxx CPE-0.21.3.31(3.6.13)Cookie:AVSSESSIONID8FbL3sKSb9CFE4BrPp6WmmL_jZb81lXKOmCByV0ja-wILFtvXN_Zgg Authorization:Digest username,realmACSRealm,algorithmMD5,nonceJVwsZqxc3qEyTday/kL6C0HBhQLbZCu,uri/acs/grandstream,qopauth,nc0000000d,cnonce428822b01d33404d,response7598a61391e704feb7973476224382ceContent-Type:text/xml;charsetutf-8SOAPAction:Content-Length:737ACS响应发送getParameterValues的值。soap:Envelope xmlns:soaphttp://schemas.xmlsoap.org/soap/envelope/xmlns:soap-enchttp://schemas.xmlsoap.org/soap/encoding/xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:xsdhttp://www.w3.org/2001/XMLSchemaxmlns:cwmpurn:dslforum-org:cwmp-1-0soap:Headercwmp:ID soap:mustUnderstand172518d29/cwmp:ID/soap:Headersoap:Bodycwmp:GetParameterValuesResponseParameterList soap-enc:arrayTypecwmp:ParameterValueStruct[1]ParameterValueStructNameDevice.ManagementServer.PeriodicInformInterval/NameValue xsi:typexsd:unsignedInt86400/Value/ParameterValueStruct/ParameterList/cwmp:GetParameterValuesResponse/soap:Body/soap:EnvelopeCPE回复ACS的结果HTTP/1.1204No Content Date:Tue,06Apr202109:05:45GMTCPE请求关闭连接