One kind test whether normal method and system of online pattern automatic detection function
Technical field
The present invention relates to network communication technology field, more particularly to just whether a kind of test online pattern automatic detection function
Normal method and system.
Background technology
With the development of society, product function is perfect, it is more and more friendly to user;So that many unprofessional users also can
Well using the function of specialty.The management of the SOHO products such as grown up now, these new occupation modes and product, it is right
Product has higher requirement.
For needing the product for connecting network even more so;Router can automatically select network mode.
The function of product it is powerful, method of testing is also required to timely follow up, how test equipment online pattern it is automatic
Whether detection function is normally the problem of present invention needs solution.
The network mode of test is generally comprised:Based on DHCP (Dynamic Host Confi
Guration Protocol, DHCP) connect the pattern of the webserver, based on PPPOE (point-to-point protocol
Over ethernet) agreement connection the webserver pattern and based on static IP connect the webserver pattern.
Equipment only has the correct correspondingly online pattern that is configured with just to can connect to network.Many products have automatic detection net
The function of network pattern, the method that these functions are tested at present is more original, inefficient.
A kind of apparatus and method of test DHCP characteristics of Publication No. CN105281982A disclosure of the invention, pass through and exchange
Machine equipment is connected to Dynamic Host Configuration Protocol server, and the device includes:Message generation module, for generating at least 2 groups DHCP protocol messages, extremely
Few 2 groups of DHCP protocol messages are made a distinction by the hardware address field wherein included, and one is represented with each hardware address field
Dhcp client;Sending module, for sending the DHCP protocol message of generation to Dynamic Host Configuration Protocol server to carry out message interaction;Receive
Module, the DHCP result messages corresponding to each DHCP protocol message for receiving Dynamic Host Configuration Protocol server reply;Contrast module, is used
In the dhcp address that each dhcp client is distributed to according to result packet parsing Dynamic Host Configuration Protocol server, and with the dhcp address of binding
Contrasted, when the dhcp address being resolved to all is contained in the dhcp address of binding, determine what Dynamic Host Configuration Protocol server was replied
Dhcp address is effective.The method can only test the network mode based on Dynamic Host Configuration Protocol server, it is impossible to applied to a variety of networks
The identification of pattern.
Existing technology tend not to it is enough provide it is a kind of efficiently, comprehensive method of testing, it is necessary to tester's manual configuration,
The complexity of test is larger, and the requirement to tester is higher, and tester needs to be grasped the method for building server, and ripe
Know the message interaction process of the online pattern such as DHCP, PPPOE and understand message detail.
The content of the invention
The technical problems to be solved by the invention are, for the above-mentioned deficiency of prior art, propose a kind of by detecting
The mode of message realizes whether the automatic detection function of Devices to test is normally tested.
The present invention solves its technical problem, propose a kind of test whether normal method of online pattern automatic detection function and
System.
Described method includes:
Start Devices to test online pattern automatic detection function;
Crawl Devices to test is sent to the request message of interchanger;
Judge whether to include the message request of online pattern in the request message;If not including, automatic detection function is different
Often.
Further, if including the message request of online pattern in the request message, step is performed:
Configure the network mode for the switch ports themselves being connected with Devices to test;
Start Devices to test online pattern automatic detection function;
Crawl interchanger is sent to the message of Devices to test;
Judge whether include the information corresponding with the network mode in the message;
If comprising the online pattern of acquisition Devices to test;
Whether the automatic detection function of the online mode decision Devices to test based on the message and Devices to test is normal.
Further, described network mode includes connecting the pattern of the webserver, based on PPPOE based on DHCP protocol
The pattern of the agreement connection webserver and the pattern that the webserver is connected based on static IP.
Further, crawl Devices to test sends to the request message of interchanger and included:
Obtain the MAC Address for the Devices to test port being connected with interchanger;
Sent according to the MAC Address and PPPoE messages or BOOTP messages crawl Devices to test to the request report of interchanger
Text.
Further, the Devices to test is router.
The system includes:
First automatic detection opening unit, for starting Devices to test online pattern automatic detection function;
Request message placement unit, sends to the request message of interchanger for capturing Devices to test;
First judging unit, judges the message request of online pattern whether is included in the request message;If not including, from
Dynamic detection dysfunction.
Further, the system also includes:
Network mode dispensing unit, the network mode for configuring the switch ports themselves being connected with Devices to test;
Second automatic detection opening unit, for starting Devices to test online pattern automatic detection function;
Message placement unit is received, is sent for capturing interchanger to the message of Devices to test;
Second judging unit, for judging whether include the information corresponding with the network mode in the message;
Online pattern acquiring unit, the online pattern for obtaining Devices to test;
3rd judging unit, the automatic detection of the online mode decision Devices to test based on described message and Devices to test
Whether function is normal.
Further, described network mode includes connecting the pattern of the webserver, based on PPPOE based on DHCP protocol
The pattern of the agreement connection webserver and the pattern that the webserver is connected based on static IP.
Further, the request message placement unit includes:
MAC Address obtains subelement, the MAC Address for obtaining the Devices to test port being connected with interchanger;
Request message captures subelement, and Devices to test is captured according to the MAC Address and PPPoE messages or BOOTP messages
Send to the request message of interchanger.
Further, the Devices to test is router.
The present invention realizes the test of Devices to test automatic detection function by way of detecting message, passes through change and road
The network mode of the switch ports themselves connected by device, the situation that detection Devices to test is automatically configured, realizes the checking to this function
Test.
The present invention is conducive to simplifying difficulty of test, improves testing efficiency, mitigate tester's work difficulty, shorten test week
Phase, reduction product cost.
Brief description of the drawings
Fig. 1 is a kind of test online whether normal method of pattern automatic detection function that the embodiment of the present invention one is provided
Flow chart;
Fig. 2 is a kind of test online whether normal method of pattern automatic detection function that the embodiment of the present invention two is provided
Flow chart;
Fig. 3 is a kind of test online whether normal system of pattern automatic detection function that the embodiment of the present invention three is provided
Structured flowchart.
Embodiment
The following is specific embodiment of the invention and with reference to accompanying drawing, technical scheme is further described,
But the present invention is not limited to these embodiments.
It is also understood that specific embodiment described herein is used only for understanding the present invention, it is not used to limit this hair
It is bright.
Embodiment one
Present embodiments provide a kind of test whether normal method of online pattern automatic detection function, the flow chart of method
As shown in Figure 1.
The present embodiment includes step:
In step S101, start Devices to test online pattern automatic detection function;
Specifically, set up with Devices to test after being connected, call corresponding function module to start the online pattern of Devices to test
Automatic detection function.
In step s 102, crawl Devices to test is sent to the request message of interchanger;
Specifically, after Devices to test online automatic detection function is opened, if function is normal, it should to sending DHCP
Discover DHCP message request and PADI PPPoE message request.
In step s 103, judge whether to include the message request of online pattern in the request message;If not including, from
Dynamic detection dysfunction.
Described online pattern is included connects the pattern of the webserver, based on the connection of PPPOE agreements based on DHCP protocol
The pattern of the webserver and the pattern that the webserver is connected based on static IP.
Capture the message that is sent in Devices to test, detect whether the DHCP message request comprising DHCP discover and
PADI PPPoE message request.
Moreover, it will be appreciated that above-mentioned step does not have strict execution sequence, it is all to be contemplated that and do not influence function
The change of realization all should be within the scope of the present invention.
Embodiment two
Present embodiments provide a kind of test whether normal method of online pattern automatic detection function, the flow chart of method
As shown in Figure 2.Details are as follows:
In step s 201, Devices to test online pattern automatic detection function is started;
Call function starts the online pattern automatic detection function of Devices to test.
In step S202, the MAC Address for the Devices to test port being connected with interchanger is obtained;
By the MAC Address for calling the correspondingly Devices to test port that function module acquisition is connected with interchanger.
In step S203, according to the MAC Address and PPPoE messages or BOOTP messages crawl Devices to test send to
The request message of interchanger.
Sent according to the MAC Address of Devices to test and PPPOE messages or BOOTP messages crawl Devices to test to interchanger
Request message.
In the present embodiment, the efficiency that filtering is conducive to lifting to capture is carried out according to MAC Address.
In step S204, judge the message request of online pattern whether is included in the request message;If not including, from
Dynamic detection dysfunction.
Specifically, after Devices to test online pattern automatic detection function starts, Devices to test can be sent to interchanger
DHCP Discover messages and PADI messages, are asked correspondingly connected.
In step S205, the network mode for the switch ports themselves being connected with Devices to test is configured;
Specifically, test system, Devices to test, the connection of interchanger building topology;
Further, Devices to test is connected to interchanger, the state that pattern is usually surfed the Net.The connection of test system one end is to be measured
Equipment, one end connection interchanger;The port being connected on interchanger with Devices to test is mirror image source port, is connected with test system
Port is mirror port, and mirror port is used to monitor mirror image source port;Test system in mirror port by capturing source port
Message data, realizes the monitoring analysis of device under test.
Described network mode includes:The pattern of the webserver is connected, based on the connection of PPPOE agreements based on DHCP protocol
The pattern of the webserver and the pattern that the webserver is connected based on static IP.
Further, source port VLAN is configured to Dynamic Host Configuration Protocol server or PPPoE servers.
Alternatively, source port VLAN is configured to Dynamic Host Configuration Protocol server and PPPoE servers, is available for Devices to test in VLAN
Obtain dhcp address and PPPoE addresses;
Alternatively, source port VLAN is configured to PPPoE servers, is available for Devices to test PPPoE is obtained in VLAN
Location;
Alternatively, source port VLAN is configured to Dynamic Host Configuration Protocol server, is available for Devices to test to obtain dhcp address in VLAN;
Alternatively, source port VLAN is not configured.
Further, described interchanger is three-tier switch, and test wrapper is simplified using the functional characteristic of three-tier switch
Border and the complexity of test.
In the present embodiment, described network mode includes connecting the pattern of the webserver based on DHCP protocol, is based on
The pattern of the PPPOE agreements connection webserver and the pattern that the webserver is connected based on static IP.
In step S206, start Devices to test online pattern automatic detection function.
Test system starts the online pattern automatic detection function of Devices to test by calling correspondingly function module.
Specifically, the automatic detection function of Devices to test just detects the network mode of the network connection residing for Devices to test,
I.e. above-mentioned several modes, connect the pattern of the webserver based on DHCP protocol, connect the webserver based on PPPOE agreements
Pattern and based on static IP connect the webserver pattern.By detecting correspondingly network mode, carry out correspondingly
Configuration.
Usually, Devices to test can correctly be configured according to the network mode of interchanger.It is contemplated that testing this
Item function.
Corresponding function module is called to start Devices to test online pattern automatic detection function.
In step S207, crawl interchanger is sent to the message of Devices to test;
In the present embodiment, test system crawl interchanger is sent to the message of Devices to test, and the message is used to respond
Start in step S206 after Devices to test online pattern automatic detection function, the request message that Devices to test is sent.
Alternatively, if the source port VLAN of interchanger is configured to Dynamic Host Configuration Protocol server, described Dynamic Host Configuration Protocol server is received
After DHCP Discover messages, the described message of response, and send a DHCP Offer message to Devices to test.
Alternatively, if the source port VLAN of interchanger is configured to PPPoE servers, described PPPoE servers are being received
To after PADI messages, the message is responded, and a PADO message is sent to Devices to test.
Alternatively, if the source port VLAN of interchanger is configured to PPPoE servers and Dynamic Host Configuration Protocol server, the server
After DHCP Discover messages and PADI messages is received, the message is responded, and DHCP Offer are sent to Devices to test
Message and PADO messages.
Alternatively, in the absence of configuration, what the source port VLAN of interchanger will not respond that Devices to test sends please
Seek message.
In the present embodiment, this step is used to capture the DHCP that the Dynamic Host Configuration Protocol server or PPPoE servers are sent
Offer messages and PADO messages.
In step S208, judge whether include the information corresponding with the network mode in the message;
Judge whether the message captured in step S207 contains described DHCP Offer messages and PADO messages.
In step S209, if including the online pattern of acquisition Devices to test;
Test system calls correspondingly function, obtains the online pattern of Devices to test, DHCP patterns, pppoe mode, static state
IP patterns.
In step S210, the automatic detection of the online mode decision Devices to test based on described message and Devices to test
Whether function is normal.
Alternatively, in step S205, source port VLAN is configured to Dynamic Host Configuration Protocol server and PPPoE servers, the clothes
Business device is after the DHCP Discover messages and PADI messages that Devices to test sends is received, and test system detects described
Dynamic Host Configuration Protocol server and PPPoE servers send DHCPOffer messages and PADO messages to Devices to test, if Devices to test is upper
Net pattern is DHCP patterns or static IP pattern, then the automatic detection function of Devices to test is abnormal.If the online of Devices to test
Pattern is pppoe mode, then automatic detection function is normal.
Alternatively, in step S205, by source port VLAN configure PPPoE servers, the server receive it is to be measured
After the PADI messages that equipment is sent, test system detects the PADO messages that the PPPoE servers are sent to Devices to test,
If the online pattern of Devices to test is DHCP patterns or static IP pattern, the automatic detection function of Devices to test is abnormal.Such as
The online pattern of fruit Devices to test is pppoe mode, then automatic detection function is normal.
Alternatively, in step S205, source port VLAN is configured to Dynamic Host Configuration Protocol server, the server receive it is to be measured
After the DHCP Discover messages that equipment is sent, test system detects the Dynamic Host Configuration Protocol server and sent to Devices to test
DHCP Offer messages, if the online pattern of Devices to test be pppoe mode or static IP pattern, Devices to test it is automatic
Detect dysfunction.If the online pattern of Devices to test is DHCP patterns, automatic detection function is normal.
Alternatively, in step S205, source port VLAN is not configured, source port VLAN is receiving Devices to test hair
After the DHCP Discover messages and PADI messages that go out, test system does not detect response message, if Devices to test
Online pattern is DHCP patterns or pppoe mode, then the automatic detection function of Devices to test is abnormal.If the online of Devices to test
Pattern is static IP pattern, then automatic detection function is normal.
In a word, the response message that measurement equipment is sent according to switch ports themselves is correspondingly configured, and test system is based on response
The species of message and the configuring condition of Devices to test, judge whether Devices to test test online pattern automatic detection function is normal.
Likewise, above-mentioned step does not have strict execution sequence, it is all to be contemplated that and do not influence the realization of function
Change all should be within the scope of the present invention.
Embodiment three
Present embodiments provide a kind of test whether normal system of online pattern automatic detection function, the knot of the system
Structure flow chart is for example as shown in Figure 3.
The system includes:
First automatic detection opening unit 310, for starting Devices to test online pattern automatic detection function;
Request message placement unit 320, sends to the request message of interchanger for capturing Devices to test;
First judging unit 330, judges the message request of online pattern whether is included in the request message;If not wrapping
Contain, automatic detection function is abnormal.
Further, the system also includes:
Network mode dispensing unit 340, the network mode for configuring the switch ports themselves being connected with Devices to test;
Second automatic detection opening unit 350, for starting Devices to test online pattern automatic detection function;
Message placement unit 360 is received, is sent for capturing interchanger to the message of Devices to test;
Second judging unit 370, for judging whether include the information corresponding with the network mode in the message;
Online pattern acquiring unit 380, the online pattern for obtaining Devices to test;
3rd judging unit 390, the automatic of mode decision Devices to test of surfing the Net based on described message and Devices to test
Detect whether function is normal.
Further, described network mode includes connecting the pattern of the webserver, based on PPPOE based on DHCP protocol
The pattern of the agreement connection webserver and the pattern that the webserver is connected based on static IP.
Further, the request message placement unit includes:
MAC Address obtains subelement 321, the MAC Address for obtaining the Devices to test port being connected with interchanger;
Request message captures subelement 322, and to be measured set is captured with PPPoE messages or BOOTP messages according to the MAC Address
Preparation delivers to the request message of interchanger.
Further, the Devices to test is router.
The whether normal system of a kind of test online pattern automatic detection function provided in the present embodiment is applied to implement
Method in example one and embodiment two, related content is detailed in embodiment one and embodiment two, here just no longer
Repeat.
Those of ordinary skill in the art can be apparent from above-mentioned case study on implementation, and above-mentioned unit is
Divided according to function logic, but be not limited to above-mentioned division, as long as can realize that correspondingly function is also in this patent
In protection domain.
Specific embodiment described herein is only to spirit explanation for example of the invention.Technology neck belonging to of the invention
The technical staff in domain can be made various modifications or supplement to described specific embodiment or be replaced using similar mode
Generation, but without departing from the spiritual of the present invention or surmount scope defined in appended claims.