TR-069協議完整的通訊過程
以下為裝置重啟到掛上TR069網管的報文流程解析 (1) 裝置啟動;根據配置的ACS(自動設定伺服器)地址,建立安全的HTTP串連以後,每次串連CPE都必須首先對ACS發出一個Inform的RPC調用請求來向ACS彙報本次串連的資訊。ACS會返回給一個Inform response作為確認串連。
標準的Inform方法的參數如表所示
| 參數名稱 |
參數說明 |
| DeviceID |
資料結構標識CPE |
| Event |
標識此次Inform發起的原因 |
| MaxEnvelopes |
HTTP Response可攜帶SOAP信封數 |
| CurrentTime |
CPE當前的時間 |
| RetryCount |
這次Session最大的重複串連次數 |
| ParameterList |
這次Inform所需攜帶的參數 |
POST /service.tr069 HTTP/1.1Host: 183.62.12.23:8012User-Agent: cwmpContent-Type: text/xml; charset=utf-8Connection: keep-aliveContent-Length: 1730<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <SOAP-ENV:Header> <cwmp:ID SOAP-ENV:mustUnderstand="1">946684824</cwmp:ID> </SOAP-ENV:Header> <SOAP-ENV:Body> <!-- inform方法任何時刻要建立與ACS的串連,都必須調用Inform方法--> <!-- 來初始化一個傳輸序列,向ACS伺服器上報一些事件,具體事件就攜帶在EventCode --> <cwmp:Inform> <!-- 裝置描述資訊 --> <DeviceId> <!-- 裝置廠商 --> <Manufacturer>star-net</Manufacturer> <!-- 裝置製造商的唯一標示 --> <OUI>00D0F8</OUI> <!-- 裝置類型 --> <ProductClass>SVP3000_V5_SIP_CN</ProductClass> <!-- 裝置序號 --> <SerialNumber>00100400RJ0100100000001AA9800003</SerialNumber> </DeviceId> <!-- 引起此次會話建立的具體事件 --> <Event SOAP-ENC:arrayType="cwmp:EventStruct[1]"> <EventStruct> <!-- 上報BOOT事件,也就是告訴ACS要發起CWMP串連了 --> <!-- 1 boot表明發起會話的原因是裝置上電(初次開機或者其他原因引起的裝置重啟) --> <EventCode>1 BOOT</EventCode> <CommandKey></CommandKey> </EventStruct> </Event> <!-- 接收響應的允許SOAP信包數目,0表示無限制 --> <MaxEnvelopes>1</MaxEnvelopes> <!-- cpe當前的時間 --> <CurrentTime>2000-01-01T08:00:23</CurrentTime> <!-- 完成inform調用前嘗試的次數每次加1 --> <RetryCount>0</RetryCount> <!-- CPE裝置參數列表--> <ParameterList SOAP-ENC:arrayType="cwmp:ParameterValueStruct[6]"> <ParameterValueStruct> <!-- 裝置描述資訊 --> <Name>Device.DeviceSummary</Name> <Value>Device:1.0[](Baseline:1), VoiceService:1.0[1](Baseline:1)</Value> </ParameterValueStruct> <ParameterValueStruct> <!-- 裝置的硬體版本資訊 --> <Name>Device.DeviceInfo.HardwareVersion</Name> <Value>5.0</Value> </ParameterValueStruct> <ParameterValueStruct> <!-- 裝置的軟體版本資訊 --> <Name>Device.DeviceInfo.SoftwareVersion</Name> <Value>AIM1.3.10.8</Value> </ParameterValueStruct> <ParameterValueStruct> <!-- 請求URL(裝置聯絡地址) --> <Name>Device.ManagementServer.ConnectionRequestURL</Name> <Value>http://192.168.99.17:7547/</Value> </ParameterValueStruct> <ParameterValueStruct> <!-- 對某些方法的調用會導致該值的該改變如 Scheduled Inform、reboot、download、upload方法 --> <!-- 除此以外的調用該值均為空白,此訊息中裝置只調用了 inform方法,故該值應該置為空白 --> <Name>Device.ManagementServer.ParameterKey</Name> <Value></Value> </ParameterValueStruct> <ParameterValueStruct> <!-- 裝置ip地址 --> <Name>Device.LAN.IPAddress</Name> <Value>192.168.99.17</Value> </ParameterValueStruct> </ParameterList> </cwmp:Inform> </SOAP-ENV:Body></SOAP-ENV:Envelope>
(2) ACS伺服器接受到裝置端(CPE端)發出的inform訊息之後,會給予一個 informresponse響應機cwmp串連建立成功
HTTP/1.1 200 OKDate: Tue, 02 Aug 2011 03:20:53 GMTServer: Microsoft-IIS/6.0X-Powered-By: ASP.NETX-AspNet-Version: 2.0.50727Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/Cache-Control: privateContent-Type: text/xml;charset=UTF-8Content-Length: 522<!-- 對裝置端inform訊息的響應即接受串連請求 --><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Header> <cwmp:ID soap:mustUnderstand="1">946684824</cwmp:ID> <cwmp:HoldRequests soap:mustUnderstand="1">0</cwmp:HoldRequests> </soap:Header> <soap:Body> <!-- ACS接受裝置端(cpe)端的inform請求(即建立cwmp串連的請求) --> <cwmp:InformResponse> <MaxEnvelopes>1</MaxEnvelopes> </cwmp:InformResponse> </soap:Body></soap:Envelope>
(3) 裝置端發送空訊息,表示沒有後續的請求
POST /service.tr069 HTTP/1.1Host: 183.62.12.23:8012 User-Agent: cwmpContent-Type: text/xml; charset=utf-8Connection: keep-aliveCookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/Content-Length: 0<!-- Host: ACS(自動設定伺服器)地址 --><!-- Cookie: 設定在裝置的序號--><!-- Content-Length: 訊息內容長度為0代表空訊息-->
(4) ACS伺服器收到空訊息後,根據空訊息中攜帶的序號對裝置進行合法性驗證,若驗證通過則進行後續操作,若不通過則下發訊息提示裝置非法。序號的判斷在ACS內部判斷,未體現在報文中
(5) ACS驗證裝置序號合法,發送訊息要求裝置端上報網管的帳號資訊
HTTP/1.1 200 OKDate: Tue, 02 Aug 2011 03:20:53 GMTServer: Microsoft-IIS/6.0X-Powered-By: ASP.NETX-AspNet-Version: 2.0.50727Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/Cache-Control: privateContent-Type: text/xml;charset=UTF-8Content-Length: 658<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Header> <cwmp:ID soap:mustUnderstand="1">1</cwmp:ID> <cwmp:HoldRequests soap:mustUnderstand="1">0</cwmp:HoldRequests> </soap:Header> <soap:Body> <!-- 請求的方法為GetParameterValues,擷取裝置端的參數資訊 --> <cwmp:GetParameterValues> <ParameterNamesSOAP-ENC:arrayType="xsd:string[2]"> <!-- 擷取裝置TR069網管使用者名稱 --> <string>Device.ManagementServer.Username</string> <!-- 擷取裝置TR069網管密碼 --> <string>Device.ManagementServer.Password</string> </ParameterNames> </cwmp:GetParameterValues> </soap:Body></soap:Envelope>
(6) 裝置端接收該ACS伺服器請求上報帳號的訊息後,將發送裝置上配置的帳號資訊作為請求的響應
HTTP/1.1Host: 183.62.12.23:8012User-Agent: cwmpContent-Type: text/xml; charset=utf-8Connection: keep-aliveCookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/Content-Length: 828SOAPAction: ""<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <SOAP-ENV:Header> <cwmp:ID SOAP-ENV:mustUnderstand="1">1</cwmp:ID> </SOAP-ENV:Header> <SOAP-ENV:Body> <!-- 將帳號資訊作為ACS請求的響應訊息 --> <cwmp:GetParameterValuesResponse> <ParameterList xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cwmp:ParameterValueStruct[2]"> <ParameterValueStruct> <!-- 設定在裝置上的網管使用者名稱 --> <Name>Device.ManagementServer.Username</Name> <!-- 使用者名稱的具體值 --> <Value>66661160</Value> </ParameterValueStruct> <ParameterValueStruct> <!-- 設定在裝置上的網管密碼 --> <Name>Device.ManagementServer.Password</Name> <!-- 密碼的具體值 --> <Value>66661160</Value> </ParameterValueStruct> </ParameterList> </cwmp:GetParameterValuesResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
(7) ACS伺服器收到訊息後,根據訊息中攜帶的帳號資訊進行合法性驗證,若驗證通過則進行後續操作,若不通過則下發訊息提示帳號非法。序號的判斷在ACS內部判斷,未體現在報文中
(8) ACS驗證帳號合法,發送訊息要求裝置從特定URL上下載設定檔
HTTP/1.1 200 OKDate: Tue, 02 Aug 2011 03:21:04 GMTServer: Microsoft-IIS/6.0X-Powered-By: ASP.NETX-AspNet-Version: 2.0.50727Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/Cache-Control: privateContent-Type: text/xml;charset=UTF-8Content-Length: 856<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Header> <cwmp:ID soap:mustUnderstand="1">1</cwmp:ID> <cwmp:HoldRequests soap:mustUnderstand="1">0</cwmp:HoldRequests> </soap:Header> <soap:Body> <cwmp:Download> <CommandKey>M Download</CommandKey> <!-- 檔案類型 設定檔--> <FileType>3 Vendor Configuration File</FileType> <!-- 設定檔的URL地址,裝置端從該地址擷取設定檔並自動載入裝置 --> <URL>http://183.62.12.23:8012/Config.aspx?ID=00100400RJ0100100000001AA9800003</URL> <Description></Description> <Username></Username> <Password></Password> <FileSize>0</FileSize> <TargetFileName>ConfigFile.xml</TargetFileName> <DelaySeconds>0</DelaySeconds> <SuccessURL></SuccessURL> <FailureURL></FailureURL> </cwmp:Download> </soap:Body></soap:Envelope>
(9) 裝置接收到該訊息之後,並根據訊息中的URL地址下載設定檔並自動設定,同時給ACS伺服器一個下載成功的響應訊息
Host: 183.62.12.23:8012User-Agent: cwmpContent-Type: text/xml; charset=utf-8Connection: keep-aliveCookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/Content-Length: 484SOAPAction: ""<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <SOAP-ENV:Header> <cwmp:ID SOAP-ENV:mustUnderstand="1">1</cwmp:ID> </SOAP-ENV:Header> <SOAP-ENV:Body> <!-- 通過該訊息告知ACS伺服器裝置成功擷取設定檔 --> <cwmp:DownloadResponse> <!-- 成功下載的狀態代碼 --> <Status>1</Status> </cwmp:DownloadResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>
(10) ACS伺服器發送訊息,要求裝置從特定的URL下載升級檔案(是否升級可由使用者自行決定)
HTTP/1.1 200 OKDate: Tue, 02 Aug 2011 03:21:04 GMTServer: Microsoft-IIS/6.0X-Powered-By: ASP.NETX-AspNet-Version: 2.0.50727Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/Cache-Control: private