Development Based on TR-069 Protocol)

Source: Internet
Author: User

TR 069 is a protocol proposed by DSL fourm, that is, the cwmp protocol, which mainly manages user terminal devices.
Its functions mainly consist of ACS (auto config server) and CPE (customer expression compliance ). Its specific functions please refer to the TR-069 protocol, the network also has an introduction, here no longer said.
Recently, the company received a project to monitor and manage the performance of the AP (Access Point) device of China Telecom. I am also a project team developer, mainly responsible for building ACS.
According to the protocol description, CPE calls ACs at a scheduled time. ACS can also call CPE. When ACS calls CPE, it is actually
Send a connectionrequest to the CPE. After authorization and authentication, the CPE sends an inform to the ACs,
This includes eventcode. According to the enventcode, we can know whether the connection is established only after the CPE actively calls or the ACS calls. The TR-069 requires that the inform Event code after a call to respond to ACS is 6 connection requests.
I am also the first time in communication development, something I have never touched before. First of all to the next protocol, here I have a feeling, is to the next original TR-069 protocol, to slowly understand themselves, do not understand the word to query, although it is all English, but it is also the most authoritative and original.
Yes
After reading the agreement, I will feel very blind and will not understand many synonyms. Soap and RPC. Soap and PRC feel a bit like WebService. In fact, I have not enabled WebService either.
Experience, but I think in the TR-069 protocol, ACS uses the SOAP Protocol to specify which methods to call CPE and the required parameters. Then, the specified party is executed on the CPE through rpc.
Method. Then, the execution result is returned to CPE through the SOAP protocol.
If system A has a function to query the locations of mobile phone numbers, then system B
To achieve this function in the system, the two systems can communicate with each other. System B uses the SOAP Protocol to specify the functions (methods) and parameters (mobile phone numbers) to be executed, and then sends
To system. System A accepts the xml contained in the soap protocol, starts parsing, calls its own method, and encapsulates the executed result into XML
Format data is sent to system B, and system B parses the data to obtain the execution result. In short, the most important thing is communication.

Both ACS and CPE support the HTTP protocol,
All ACS services only need an HTTP container. So naturally, we thought of servlet. I don't know what the XML format is, but the company is so busy that all of them are starting to work.
. Since you don't know how to implement it, but the CPE will call it regularly, all the things that come after the call will be received to see what it is.

The CPE currently tested is the AP of H3C.
First, create an acsservlet to prepare for receiving messages.
The Code is as follows:

Import java. Io. bufferedreader;
Import java. Io. ioexception;
Import java. Io. inputstream;
Import java. Io. inputstreamreader;
Import java. Io. outputstream;
Import java. util. hashmap;

Import javax. servlet. servletexception;
Import javax. servlet. http. httpservlet;
Import javax. servlet. http. httpservletrequest;
Import javax. servlet. http. httpservletresponse;
Import javax. servlet. http. httpsession;

Import com. seahigh. tyt. ACS. util. acsutil;

/**
* ACS serverimp
*
* @ Author Wang Xinli
* @ Create time 04:34:42 (c) copy right seahigh 2009
*/
Public class acsservlet extends httpservlet {

Private Static final long serialversionuid = 1l;

Public void doget (httpservletrequest request, httpservletresponse response)
Throws servletexception {

}

Public void dopost (httpservletrequest request, httpservletresponse response)
Throws servletexception, ioexception {
// The session remembers the method that has been executed.

Inputstream in = request. getinputstream ();
String IP = request. getremoteaddr ();
Inputstreamreader IR = new inputstreamreader (request. getinputstream ());
Bufferedreader input = new bufferedreader (IR );
String line;
String xml = "";
While (line = input. Readline ())! = NULL ){
If (line. Trim (). Length () <= 0)
Continue;
XML + = line;
}
In. Close ();
Input. Close ();
System. Out. println (IP + "post:" + XML );

}
}

Then configure the servlet in Web. xml.

<Soap: envelope 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"
Xmlns: Soap = "http://schemas.xmlsoap.org/soap/envelope"
Xmlns: soapenc = "http://schemas.xmlsoap.org/soap/encoding/">
<Soap: Header>
<Cwmp: Id soap: mustunderstand = "1"> 1 </cwmp: Id>
</Soap: Header>
<Soap: Body>
<Cwmp: Inform>
<DeviceID>
<Manufacturer> H3C </manufacturer>
<Oui> 000fe2 </OUI>
<Productclass> gateway </productclass>
<Serialnumber> 210235a32mc085003208 </serialnumber>
</DeviceID>
<Event soapenc: arraytype = "cwmp: eventstruct [1]">
<Eventstruct>
<Eventcode> 0 Bootstrap </eventcode>
<Commandkey> </commandkey>
</Eventstruct>
</Event>
<Maxenvelopes> 1 </maxenvelopes>
<Currenttime> 2000-05-10t09: 55: 50 </currenttime>
<Retrycount> 0 </retrycount>
<Parameterlist soapenc: arraytype = "cwmp: parametervaluestruct [8]">
<Parametervaluestruct>
<Name> internetgatewaydevice. devicesummary </Name>
<Value soap: TYPE = "Soap: string"> internetgatewaydevice: 1.0 [] (baseline: 1) </value>
</Parametervaluestruct>
<Parametervaluestruct>
<Name> internetgatewaydevice. deviceinfo. specversion </Name>
<Value soap: TYPE = "Soap: string"> 1.0 </value>
</Parametervaluestruct>
<Parametervaluestruct>
<Name> internetgatewaydevice. deviceinfo. hardwareversion </Name>
<Value soap: TYPE = "Soap: string"> ver. A </value>
</Parametervaluestruct>
<Parametervaluestruct>
<Name> internetgatewaydevice. deviceinfo. softwareversion </Name>
<Value soap: TYPE = "Soap: string"> v100r001b47d011sp01 </value>
</Parametervaluestruct>
<Parametervaluestruct>
<Name> internetgatewaydevice. deviceinfo. provisioningcode </Name>
<Value soap: TYPE = "Soap: string"> provisioningcode </value>
</Parametervaluestruct>
<Parametervaluestruct>
<Name> internetgatewaydevice. managementserver. connectionrequesturl </Name>
<Value soap: TYPE = "Soap: string"> http: // 192.168.1.200: 7547/CPE
</Value>
</Parametervaluestruct>
<Parametervaluestruct>
<Name> internetgatewaydevice. managementserver. parameterkey </Name>
<Value soap: TYPE = "Soap: string"> </value>
</Parametervaluestruct>
<Parametervaluestruct>

<Name> internetgatewaydevice. wandevice.1.wanconnectiondevice. 1. wanpppconnection.1.externalipaddress </Name>
<Value soap: TYPE = "Soap: string"> 192.168.1.200 </value>
</Parametervaluestruct>
</Parameterlist>
</Cwmp: Inform>

</Soap: Body>
</Soap: envelope>

 

For more information, see: http://www.tr069bbs.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.