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/grandstream HTTP/1.1
Host: acs.avsystem.com:10301
User-Agent: GRANDSTREAM CPE-0.21.3.31 (3.6.13)
Authorization: Digest username="", realm="ACSRealm", algorithm=MD5, nonce="JVwsZqxc3qEyTday/kL6C0H+BhQLbZCu", uri="/acs/grandstream", qop=auth, nc=0000000a, cnonce="65da02d074fa0db3", response="a4dfe2ee1670802d4f1e12f330724fc7"
Content-Type: text/xml; charset=utf-8
SOAPAction: cwmp:Inform
Content-Length: 2970
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
<soap:Header>
<cwmp:ID soap:mustUnderstand="1">haU761yJla</cwmp:ID>
</soap:Header>
<soap:Body>
<cwmp:Inform>
<DeviceId>
<Manufacturer>Grandstream</Manufacturer>
<OUI>C074AD</OUI>
<ProductClass>XXXX</ProductClass>
<SerialNumber>XXXXXXX</SerialNumber>
</DeviceId>
<Event soap-enc:arrayType="cwmp:EventStruct[1]">
<EventStruct>
<EventCode>6 CONNECTION REQUEST</EventCode>
<CommandKey></CommandKey>
</EventStruct>
</Event>
<MaxEnvelopes>1</MaxEnvelopes>
<CurrentTime>2021-04-06T17:05:44</CurrentTime>
<RetryCount>0</RetryCount>
<ParameterList soap-enc:arrayType="cwmp:ParameterValueStruct[11]">
<ParameterValueStruct>
<Name>Device.GatewayInfo.ManufacturerOUI</Name>
<Value xsi:type="xsd:string"></Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.GatewayInfo.ProductClass</Name>
<Value xsi:type="xsd:string"></Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.GatewayInfo.SerialNumber</Name>
<Value xsi:type="xsd:string"></Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.DeviceInfo.HardwareVersion</Name>
<Value xsi:type="xsd:string">1.3A</Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.DeviceInfo.SoftwareVersion</Name>
<Value xsi:type="xsd:string">0.0.0.0</Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.DeviceInfo.ProvisioningCode</Name>
<Value xsi:type="xsd:string"></Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.ManagementServer.ConnectionRequestURL</Name>
<Value xsi:type="xsd:string">http:
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.ManagementServer.ParameterKey</Name>
<Value xsi:type="xsd:string">n/a</Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.LAN.IPAddress</Name>
<Value xsi:type="xsd:string">192.168.131.X</Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.LAN.MACAddress</Name>
<Value xsi:type="xsd:string">00:00:00:00:00</Value>
</ParameterValueStruct>
<ParameterValueStruct>
<Name>Device.DeviceSummary</Name>
<Value xsi:type="xsd:string">Device: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 request)
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2021 09:05:44 GMT
Set-Cookie: AVSSESSIONID=8FbL3sKSb9CFE4BrPp6WmmL_jZb81lXKOmCByV0ja-wILFtvXN_Zgg;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/xml; charset="UTF-8"
Content-Length: 459
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><cwmp:ID soap:mustUnderstand="1">haU761yJla</cwmp:ID></soap:Header><soap:Body><cwmp:InformResponse><MaxEnvelopes>1</MaxEnvelopes></cwmp:InformResponse></soap:Body></soap:Envelope>POST /acs/grandstream HTTP/1.1
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><cwmp:ID soap:mustUnderstand="1">haU761yJla</cwmp:ID></soap:Header><soap:Body><cwmp:InformResponse><MaxEnvelopes>1</MaxEnvelopes></cwmp:InformResponse></soap:Body></soap:Envelope>POST /acs/grandstream HTTP/1.1
Host: acs.avsystem.com:10301
User-Agent: GRANDSTREAM CPE-0.21.3.31 (3.6.13)
Cookie: AVSSESSIONID=8FbL3sKSb9CFE4BrPp6WmmL_jZb81lXKOmCByV0ja-wILFtvXN_Zgg
Authorization: Digest username="", realm="ACSRealm", algorithm=MD5, nonce="JVwsZqxc3qEyTday/kL6C0H+BhQLbZCu", uri="/acs/grandstream", qop=auth, nc=0000000b, cnonce="65da02d074fa0db3", response="1a89bfd8e8d89377bc9a961769644ef5"
Content-Type: text/xml; charset=utf-8
Content-Length: 0
- CPE发送空报文无别的请求,满足HTTP报文的请求/响应的交互规则。
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2021 09:05:45 GMT
Content-Type: text/xml; charset="UTF-8"
Content-Length: 406
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><cwmp:ID soap:mustUnderstand="1">47ed9304</cwmp:ID></soap:Header><soap:Body><cwmp:GetRPCMethods /></soap:Body></soap:Envelope>POST /acs/grandstream HTTP/1.1
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
<soap:Header>
<cwmp:ID soap:mustUnderstand="1">47ed9304</cwmp:ID>
</soap:Header>
<soap:Body>
<cwmp:GetRPCMethodsResponse><MethodList soap-enc:arrayType="xsd:string[18]"><string>GetRPCMethods</string><string>GetParameterNames</string><string>GetParameterValues</string><string>SetParameterValues</string><string>SetParameterAttributes</string><string>GetParameterAttributes</string><string>AddObject</string><string>DeleteObject</string><string>Reboot</string><string>FactoryReset</string><string>Download</string><string>Upload</string><string>ScheduleInform</string><string>GetQueuedTransfers</string><string>GetAllQueuedTransfers</string><string>ScheduleDownload</string><string>CancelTransfer</string><string>ChangeDUState</string></MethodList></cwmp:GetRPCMethodsResponse></soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2021 09:05:45 GMT
Content-Type: text/xml; charset="UTF-8"
Content-Length: 566
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><cwmp:ID soap:mustUnderstand="1">72518d29</cwmp:ID></soap:Header><soap:Body><cwmp:GetParameterValues><ParameterNames soap-enc:arrayType="xsd:string[1]"><string>Device.ManagementServer.PeriodicInformInterval</string></ParameterNames></cwmp:GetParameterValues></soap:Body></soap:Envelope>POST /acs/grandstream HTTP/1.1
Host: acs.avsystem.com:10301
User-Agent: GRANDSTREAM CPE-0.21.3.31 (3.6.13)
Cookie: AVSSESSIONID=8FbL3sKSb9CFE4BrPp6WmmL_jZb81lXKOmCByV0ja-wILFtvXN_Zgg
Authorization: Digest username="", realm="ACSRealm", algorithm=MD5, nonce="JVwsZqxc3qEyTday/kL6C0H+BhQLbZCu", uri="/acs/grandstream", qop=auth, nc=0000000d, cnonce="428822b01d33404d", response="7598a61391e704feb7973476224382ce"
Content-Type: text/xml; charset=utf-8
SOAPAction:
Content-Length: 737
- ACS响应,发送getParameterValues的值。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
<soap:Header>
<cwmp:ID soap:mustUnderstand="1">72518d29</cwmp:ID>
</soap:Header>
<soap:Body>
<cwmp:GetParameterValuesResponse>
<ParameterList soap-enc:arrayType="cwmp:ParameterValueStruct[1]">
<ParameterValueStruct>
<Name>Device.ManagementServer.PeriodicInformInterval</Name>
<Value xsi:type="xsd:unsignedInt">86400</Value>
</ParameterValueStruct>
</ParameterList>
</cwmp:GetParameterValuesResponse></soap:Body>
</soap:Envelope>
HTTP/1.1 204 No Content
Date: Tue, 06 Apr 2021 09:05:45 GMT