TR-069 协议通信过程

最近需要通过网络管理公司产品,使用的协议正是TR069,于是看了下协议过程,还有很有意义的。

通信过程图

tr069.png

图中主要步骤包括:

  • 建立连接时必须用Inform请求
  • 没有后续请求则发送空请求
  • ACS要求上报设备信息并验证
  • ACS下发设备的操作命令

解析步骤说明

  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.1
Host: 183.62.12.23:8012
User-Agent: cwmp
Content-Type: text/xml; charset=utf-8
Connection: keep-alive
Content-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>
  1. ACS服务器接受到设备端(CPE端)发出的inform消息之后,会给予一个 informresponse响应机cwmp连接创建成功
HTTP/1.1 200 OK
Date: Tue, 02 Aug 2011 03:20:53 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/
Cache-Control: private
Content-Type: text/xml;charset=UTF-8
Content-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>
  1. 设备端发送空消息,表示没有后续的请求
POST /service.tr069 HTTP/1.1
Host: 183.62.12.23:8012  
User-Agent: cwmp
Content-Type: text/xml; charset=utf-8
Connection: keep-alive
Cookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/
Content-Length: 0

<!-- Host: ACS(自动配置服务器)地址 -->
<!-- Cookie: 设置在设备的序列号-->
<!-- Content-Length: 消息内容长度为0代表空消息-->
  1. ACS服务器收到空消息后,根据空消息中携带的序列号对设备进行合法性验证,若验证通过则进行后续操作,若不通过则下发消息提示设备非法。序列号的判断在ACS内部判断,未体现在报文中
  2. ACS验证设备序列号合法,发送消息要求设备端上报网管的账号信息
HTTP/1.1 200 OK
Date: Tue, 02 Aug 2011 03:20:53 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/
Cache-Control: private
Content-Type: text/xml;charset=UTF-8
Content-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>
  1. 设备端接收该ACS服务器请求上报账号的消息后,将发送设备上配置的账号信息作为请求的响应
HTTP/1.1
Host: 183.62.12.23:8012
User-Agent: cwmp
Content-Type: text/xml; charset=utf-8
Connection: keep-alive
Cookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/
Content-Length: 828
SOAPAction: ""

<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>
  1. ACS服务器收到消息后,根据消息中携带的账号信息进行合法性验证,若验证通过则进行后续操作,若不通过则下发消息提示账号非法。序列号的判断在ACS内部判断,未体现在报文中
  2. ACS验证账号合法,发送消息要求设备从特定URL上下载配置文件
HTTP/1.1 200 OK
Date: Tue, 02 Aug 2011 03:21:04 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/
Cache-Control: private
Content-Type: text/xml;charset=UTF-8
Content-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>
  1. 设备接收到该消息之后,并根据消息中的URL地址下载配置文件并自动配置,同时给ACS服务器一个下载成功的响应消息
Host: 183.62.12.23:8012
User-Agent: cwmp
Content-Type: text/xml; charset=utf-8
Connection: keep-alive
Cookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/
Content-Length: 484
SOAPAction: ""

<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>
  1. ACS服务器发送消息,要求设备从特定的URL下载升级文件(是否升级可由用户自行决定)
HTTP/1.1 200 OK
Date: Tue, 02 Aug 2011 03:21:04 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/
Cache-Control: private
Content-Type: text/xml;charset=UTF-8
Content-Length: 889

<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>1 Firmware Upgrade Image</FileType>
      <!-- 升级文件的URL地址,设备端从该地址获取配置文件并自动载入设备 -->
      <URL>http://183.62.12.23:8010/DeviceSoftWareVersion/20110714/svp3000.update</URL>
      <Description></Description> 
      <Username></Username> 
      <Password></Password> 
      <FileSize>3493888</FileSize>
      <TargetFileName>/DeviceSoftWareVersion/20110714/svp3000.update</TargetFileName> 
      <DelaySeconds>0</DelaySeconds> 
      <SuccessURL></SuccessURL> 
      <FailureURL></FailureURL> 
    </cwmp:Download>  
  </soap:Body>
</soap:Envelope>
  1. 设备接收到该消息之后,并根据消息中的URL地址获取升级文件,同时给予ACS服务器一个响应
POST /service.tr069 HTTP/1.1
Host: 183.62.12.23:8012
User-Agent: cwmp
Content-Type: text/xml; charset=utf-8
Connection: keep-alive
Cookie: SerialNumber=00100400RJ0100100000001AA9800003;path=/
Content-Length: 484
SOAPAction: ""

<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>
  1. ACS服务器发送空消息结束流程
HTTP/1.1 200 OK
Date: Tue, 02 Aug 2011 03:21:05 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: SerialNumber=00100400RJ0100100000001AA9800003; path=/
Cache-Control: private
Content-Length: 0 

<!-- Content-Length: 消息内容长度为0代表空消息 -->

TR069协议簇的其他规范

TR069协议不仅仅包括TR-069子协议,还包括其他一些的协议,构成了一个完整的网管协议簇。与之配套的TR-098协议和TR-104协议分别定义了CPE的数据业务的管理参数和VoIP业务的管理参数,WT-135协议用于定义数字机顶盒的管理参数,TR-111协议定义了在家庭内部数字设备上实施TR069网管的机制,WT-121协议则是各个厂家在实现和部署TR069过程中对协议的修订。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,015评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,262评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,727评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,986评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,363评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,610评论 1 219
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,871评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,582评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,297评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,551评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,053评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,385评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,035评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,079评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,841评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,648评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,550评论 2 270

推荐阅读更多精彩内容

  • DUState应该是指的download&upload state,下载和上传状态。RPC方法中有一个是ACS的“...
    落笔心晴阅读 11,059评论 0 4
  • 国家电网公司企业标准(Q/GDW)- 面向对象的用电信息数据交换协议 - 报批稿:20170802 前言: 排版 ...
    庭说阅读 10,507评论 6 13
  • 点击查看原文 Web SDK 开发手册 SDK 概述 网易云信 SDK 为 Web 应用提供一个完善的 IM 系统...
    layjoy阅读 13,340评论 0 15
  • 上了一天的班,晚上同事一起聊天,聊着聊着不知道怎么突然就聊到了大学有些学生拿奖学金的事。 办公室的曹老师说:大学里...
    li简荐阅读 112评论 0 0
  • 你会不会有,“我再做什么也没有用了”。“我再怎么努力也是一样”这样的想法呢?让我们来看看这是出现了什么问题吧。 学...
    贤莉lvy阅读 935评论 0 2