A kind of method and system of test router cloud service interfaceTechnical field
The present invention relates to a kind of method of network communication technology field more particularly to test router cloud service interface and it isSystem.
Background technology
Router is also known as gateway device, is for connecting multiple logically separate networks, so-called logical network is to representOne individual network or a subnet.When data is transferred from one subnet to another subnet, router can be passed throughRouting function is completed.
Currently, router is widely used as gateway device in cloud service.
For example, the patent of Publication No. CN104811460A disclose it is a kind of utilize wireless router realize cloud service it is mutualNetworked system.In that patent, described to realize that the internet communication method of cloud service includes using wireless router:Step 101,The client is connected to the wireless routing;Step 102, the wireless routing is drawn the client by access controllerEnter to the server-side, realizes and access world-wide web.Wherein, client accesses Internet by wireless routing Connection Service endNetwork, client access world-wide web by wireless routing Connection Service end, and client includes subscription client and merchant client,The server-side is equipped with client service module and merchant module.The invention provides a kind of routers in cloud serviceUsing.
Authorization Notice No. discloses a kind of based on the portable of Cloud Server for the utility model patent of CN203520873UNetwork hard disc, including:Hard disk ontology, main control module and it is connected to the cache module of the main control module, WIFI module, wiredNetwork module, power module, USB interface and hard-disk interface, the hard disk ontology are connected to the hard-disk interface, the WIFIModule is connected to network Cloud Server by router.The patent provides a kind of portable network based on Cloud Server is hardDisk connects Cloud Server by router in that patent.
Above-mentioned two patent provides application of the router in cloud service, passes through router access cloud service.
Current router needs many interbehaviors with cloud service, for example router establishes length firstly the need of with cloud serviceConnection, in this way could be reported to big data on server.
Currently, the method for the interface of test router cloud service in the prior art is more original, expends more resource, effectRate is not high.
Invention content
Technical problem to be solved by the present invention lies in, in the cloud service interface of test router, occupy resource it is more,Cost is higher, testing efficiency is not high.
For the above-mentioned deficiency of the prior art, a kind of method and system of test router cloud service interface are proposed.
The method of the test router cloud service interface includes:
Router sends the request of parsing cloud service domain name to first terminal;
First terminal is according to the request of the router, by the cloud service domain name mapping at the IP of second terminalLocation, and the IP address is returned into the router;
The IP address that router is returned according to first terminal initiates interface requests to second terminal;
Second terminal judges whether the interface requests information in the interface requests is correct;If incorrect, illustrate instituteIt is problematic to state router cloud service interface, and returns to error message to router.
Further, it after whether the interface requests information during second terminal judges the interface requests is correct, also wrapsIt includes:
When the interface requests information is correct, customized response message is returned to the router by second terminal;
Router establishes long connection after the response message for receiving second terminal return, with second terminal;
In the second terminal, judge whether the long connection is successfully established;If it succeeds, illustrating the routerCloud service interface is normal.
Further, before router sends the request of parsing cloud service domain name to first terminal, further include:
Router is by restarting or changing wan mouthfuls of network accesses, to trigger interface requests.
Further, the second terminal judge the interface requests information in the interface requests whether include correctly:
Second terminal judges whether the interface requests information in the interface requests is correct according to the configuration of router.
Further, customized response message is returned to the router and includes by the second terminal:
Configuration information and the cloud service interface message of the second terminal according to the router generate response message;
The response message is returned to the router by second terminal.
The system of the test router cloud service interface includes:
Router, the request for sending parsing cloud service domain name to first terminal;
First terminal, for the request according to the router, by the cloud service domain name mapping at second terminalIP address, and the IP address is returned into the router;
The router is additionally operable to the IP address returned according to first terminal, and interface requests are initiated to second terminal;
Second terminal, for judging whether the interface requests information in the interface requests is correct;If incorrect, sayThe bright router cloud service interface is problematic, and returns to error message to router.
Further, second terminal is additionally operable to, when the interface requests information is correct, customized response message be returnedBack to the router;
Router is additionally operable to after the response message for receiving second terminal return, and long connect is established with second terminalIt connects;
Second terminal is additionally operable to judge whether the long connection is successfully established;If it succeeds, illustrating the router cloudService interface is normal.
Further, router is additionally operable to by restarting or changing wan mouthfuls of network accesses, to trigger interface requests.
Further, second terminal is additionally operable to the configuration according to router, judges the interface requests in the interface requestsWhether information is correct.
Further, second terminal is additionally operable to the configuration information according to the router and the cloud service interface message,Response message is generated, and the response message is returned into the router.
The method of test router cloud service interface provided by the invention by two test terminal simulation dns servers andCloud Server saves the resource needed for test, improves testing efficiency, simplicity implementation method.
Description of the drawings
Fig. 1 is a kind of flow chart of the method for test router cloud service interface that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow chart of the method for test router cloud service interface provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of flow chart of the method for test router cloud service interface that the embodiment of the present invention three provides;
Fig. 4 is a kind of structure diagram of the system for test router cloud service interface that the embodiment of the present invention four provides.
Specific implementation mode
Following is a specific embodiment of the present invention in conjunction with the accompanying drawings, technical scheme of the present invention will be further described,However, the present invention is not limited to these examples.
It is also understood that specific embodiment described herein is used only for understanding the present invention, it is not used to limit this hairIt is bright.
In the present invention, the system of the test router cloud service interface includes:First terminal, second terminal, routingDevice.
The first terminal simulates dns server, for carrying out the conversion between domain name and corresponding IP address.Specifically in the present invention, the first terminal is by cloud service domain name mapping at the IP address of second terminal.
The second terminal simulates Cloud Server, for being communicated with router to be tested, with test router cloudThe purpose of service interface.Fiddler tools are installed in the second terminal, pass through the AutoResponder works of fiddlerTool, can be communicated with simulating Cloud Server with router with the response contents of self defined interface.
On the router to be measured, setting dns server is first terminal.The first terminal is by cloud service domain nameThe IP address of second terminal is resolved to, and then the router is communicated with the Cloud Server that the second terminal is simulated.
Embodiment one
The present embodiment provides a kind of method of test router cloud service interface, flow chart is as shown in Figure 1, be described in detail such asUnder:
Step S101, router send the request of parsing cloud service domain name to first terminal.
In router to be tested, the dns server of router is set as first terminal.With the Cloud Server intoBefore row communication, the IP address of the Cloud Server is obtained by dns server first.
The first terminal is by the IP address that cloud service domain name mapping is second terminal, and then the router and described theThe Cloud Server of two terminal simulations is communicated.
Step S102, first terminal is according to the request of the router, by the cloud service domain name mapping at secondThe IP address of terminal, and the IP address is returned into the router.
First terminal receives the inquiry of the domain name request of router transmission, corresponding domain name is inquired, to obtain domain nameCorresponding IP address.
After by the domain name mapping of the cloud service at corresponding IP address, the IP address is sent to router.
Step S103, the IP address that router is returned according to first terminal initiate interface requests to second terminal.
The second terminal is considered as Cloud Server by router, and interface requests are initiated to the second terminal.
Step S104, second terminal judge whether the interface requests information in the interface requests is correct;If incorrect,Then illustrate that the router cloud service interface is problematic, and returns to error message to router.
Second terminal asks the interface for including in the interface requests after the interface requests for receiving router transmissionThe correctness of information is asked to be judged.
Further, second terminal judges that the interface requests information in the interface requests is according to the configuration of routerIt is no correct.
Include the configuration information of router, such as WAN port address in the interface requests information.
Further, the configuration information of the router is obtained.The interface requests information and router are matched into confidenceBreath is compared, to judge whether the interface requests that router is sent are correct.
In addition it is also necessary to judge whether each field is correct in the interface requests information.
When the interface requests information is incorrect, illustrate that the router cloud service interface is problematic.Return to mistake letterIt ceases to router.
The error message is 404 mistakes of HTTP.
Further, fiddler tools are installed in the second terminal, pass through the fiddler tools generation errorInformation, and it is sent to the router to be measured.
The dns server of router is simulated by first terminal, second terminal simulates Cloud Server, simplifies test wrapperBorder need not use true dns server and Cloud Server to be tested, save the resource needed for test.
Embodiment two
The present embodiment provides a kind of method of test router cloud service interface, flow chart is as shown in Fig. 2, be described in detail such asUnder:
Step S201, router send the request of parsing cloud service domain name to first terminal.
Step S202, first terminal is according to the request of the router, by the cloud service domain name mapping at secondThe IP address of terminal, and the IP address is returned into the router.
Step S203, the IP address that router is returned according to first terminal initiate interface requests to second terminal.
Step S204, second terminal judge whether the interface requests information in the interface requests is correct.
Step S205 ', if incorrect, second terminal simultaneously returns to error message to router.
Above-mentioned steps detail in embodiment one, referring to embodiment one.
Step S205, when the interface requests information is correct, customized response message is returned to institute by second terminalState router.
Specifically, when the accordant configuration information of the interface requests information and router, and in the interface requests informationField it is correct, can determine that the interface requests information is correct.
When the interface requests information is correct, customized response message is returned to the router by second terminal.
Customized response message is returned to the router by the second terminal:
Configuration information and the cloud service interface message of the second terminal according to the router generate response message;
The response message is returned to the router by second terminal.
The cloud service interface message can be obtained from the document of Cloud Server interface.
Further, in second terminal, by the AutoResponder in fiddler tools, it can customize and generate instituteState the response message of interface requests.
Step S206, router are established with second terminal and are grown after the response message for receiving second terminal returnConnection.
When router and Cloud Server need to establish long connection, needs router WAN port address reporting interface, that is, send outSend interface requests.
In router after the response message for receiving second terminal return, long connection is enabled.
Step S207 judges whether the long connection is successfully established in the second terminal;If it succeeds, explanationThe router cloud service interface is normal.
It can determine whether the long connection is successfully established in second terminal.
Specifically, judged by the fiddler tools in second terminal and check whether the long connection is created asWork(.
The present embodiment establishes the process of long connection by router and second terminal, further tests the router cloudService interface.
It should be appreciated that there is no the stringent sequence that executes, all realities being contemplated that and do not influence function for above-mentioned stepExisting variation all should be within the scope of the present invention.
Embodiment three
The present embodiment provides a kind of method of test router cloud service interface, flow chart is as shown in figure 3, be described in detail such asUnder:
Step S301, router is by restarting or changing wan mouthfuls of network accesses, to trigger interface requests.
By restarting or changing WAN mouthfuls of network access, interface, i.e. interface requests are reported to trigger WAN port address.
The network access for changing WAN mouthfuls is to change WAN mouthfuls of address.
WAN mouthfuls of the network access includes:Dynamic IP, static IP, PPPOE.
Step S302, router send the request of parsing cloud service domain name to first terminal;
Step S303, first terminal is according to the request of the router, by the cloud service domain name mapping at secondThe IP address of terminal, and the IP address is returned into the router;
Step S304, the IP address that router is returned according to first terminal initiate interface requests to second terminal;
Step S305, second terminal judge whether the interface requests information in the interface requests is correct;If incorrect,Then illustrate that the router cloud service interface is problematic, and returns to error message to router.
Step S302 to step S305 has been detailed in the foregoing embodiments, and which is not described herein again.
The present embodiment is used for the triggering mode of specification interface request.Wan mouthfuls of network accesses are restarted or changed by routerThe case where to simulate interface requests triggering under normal circumstances.
Example IV
The present embodiment provides a kind of system of test router cloud service interface, flow chart is as shown in figure 4, be described in detail such asUnder:
The system of the test router cloud service interface includes:
Router 42, the request for sending parsing cloud service domain name to first terminal;
First terminal 41, for the request according to the router, eventually at second by the cloud service domain name mappingThe IP address at end, and the IP address is returned into the router;
The router 42 is additionally operable to the IP address returned according to first terminal, initiates interface to second terminal and asksIt asks;
Second terminal 43, for judging whether the interface requests information in the interface requests is correct;If incorrect,Illustrate that the router cloud service interface is problematic, and returns to error message to router.
Further, second terminal 43 is additionally operable to when the interface requests information is correct, by customized response messageReturn to the router;
Router 42 is additionally operable to after the response message for receiving second terminal return, and long connect is established with second terminalIt connects;
Second terminal 43 is additionally operable to judge whether the long connection is successfully established;If it succeeds, illustrating the routerCloud service interface is normal.
Further, router 42 is additionally operable to by restarting or changing wan mouthfuls of network accesses, to trigger interface requests.
Further, second terminal 43 is additionally operable to the configuration according to router, judges that the interface in the interface requests is askedAsk information whether correct.
Further, second terminal 43 is additionally operable to be believed according to the configuration information of the router and the cloud service interfaceBreath generates response message, and the response message is returned to the router.
The system of test router cloud service interface provided in this embodiment is applied to corresponding embodiment of the method, relevantContent is referring to embodiment of the method above-mentioned, and which is not described herein again.
In embodiment provided herein, it should be appreciated that described method and system is all schematical, in realityBy adjusting can difference in the implementation process of border.
In addition, the specific name of each functional unit or module is also only to facilitate mutually differentiation, is not used to the present inventionProtection domain.
Specific embodiment described herein is only an example for the spirit of the invention.Technology belonging to the present invention is ledThe technical staff in domain can make various modifications or additions to the described embodiments or replace by a similar methodIn generation, however, it does not deviate from the spirit of the invention or beyond the scope of the appended claims.