CN104125119B - A kind of test method and test macro of server - Google Patents

A kind of test method and test macro of server Download PDF

Info

Publication number
CN104125119B
CN104125119B CN201410394540.2A CN201410394540A CN104125119B CN 104125119 B CN104125119 B CN 104125119B CN 201410394540 A CN201410394540 A CN 201410394540A CN 104125119 B CN104125119 B CN 104125119B
Authority
CN
China
Prior art keywords
data packet
address
computer
server
gateway
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410394540.2A
Other languages
Chinese (zh)
Other versions
CN104125119A (en
Inventor
李小龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Changjiang Computing Technology Co., Ltd
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201410394540.2A priority Critical patent/CN104125119B/en
Publication of CN104125119A publication Critical patent/CN104125119A/en
Application granted granted Critical
Publication of CN104125119B publication Critical patent/CN104125119B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention relates to a kind of test method of server and test macro, computer is edited by data packet simulation tool and sends the first data packet of the message containing Address requests to home gateway;Computer also passes through packet capture tool, obtain the second data packet of the message containing address offer that server is returned to it, the address information provided after address section distribution is carried out by server to parse in second data packet, and judges whether the address information is in the address section for meeting allocation rule requirement.This invention simplifies test process, solve the problems, such as that device type covering is incomplete.

Description

A kind of test method and test macro of server
Technical field
The present invention relates to network technique field, in particular to the test method and test macro of a kind of server.
Background technique
In DHCP protocol (dynamic host configuration protocol), defining Option(option) field extends DHCP protocol. Option60 (Vendor class identifier, vendor or type identification) is an Option Field in DHCP message, Dynamic Host Configuration Protocol server (DHCP Server) can be directed to Option60 field, judge the equipment of dhcp client (DHCP Client) Type, so as to distribute corresponding address section based on device type.
It is existing test Dynamic Host Configuration Protocol server address section distribution method, be using different types of network-termination device with Dynamic Host Configuration Protocol server docking judges that the distribution for the IP address and Dynamic Host Configuration Protocol server that network-termination device is obtained by Dynamic Host Configuration Protocol server is advised It is then whether consistent.However, existing test method is had the disadvantage in that using various true network-termination devices
It is difficult to cover the test request of each producer, each type equipment;
Starting, the switching of network-termination device expend a large amount of testing times;
If the network-termination device of reference is unsatisfactory for standard, it is difficult to judge test result.
Summary of the invention
For the deficiency of existing test method, the present invention provides the test method and test macro of a kind of server, passes through The test and verification to the address section distribution function of home gateway Dynamic Host Configuration Protocol server is realized using data packet analogue technique.
In order to achieve the above object, a technical solution of the invention is to provide a kind of test method of server, in which:
Computer passes through the data packet simulation tool of setting, to edit the first data packet of the message containing Address requests, concurrently Server of first data packet into the home gateway connecting with the computer is sent, to request the server according to configuration Allocation rule carry out address section distribution;
The computer obtains the address that contains that server is returned to it and provides message by the packet capture tool of setting The second data packet, the address information that provides after address section distribution is carried out by server to parse in second data packet, And judge whether the address information is in the address section for meeting allocation rule requirement.
Optionally, include following procedure when the first data packet of Computerized Editing message containing Address requests:
By packet capture tool, from the server for the home gateway connecting with the computer, former data are got Packet;
By data packet simulation tool, open former data packet and therefrom obtain the data packet of the request message containing initial address into After edlin and preservation, the first data packet of the message containing Address requests is obtained.
Optionally, computer is by data packet simulation tool, by Ethernet net in the data packet of initial address request message The source MAC and destination-mac address of network frame are revised as broadcast address, also by the client MAC under BOOT strapping Protocol in boot flag Address is revised as identical as the source MAC in the ethernet network frame.
Optionally, computer is by data packet simulation tool, to BOOT strapping Protocol in the data packet of initial address request message Option Field in lower boot flag is edited or is added, make include in the Option Field:
The length value for indicating the code value of the Option Field type, indicating the Option Field content, and according to address area Between allocation for test require to identify content the vendor or type that defines.
Optionally, the Option Field is Option60 field.
Optionally, computer is analyzed and is guided in the second data packet for providing message containing address by packet capture tool Client address under agreement in boot flag, and judge whether the client address meets the distribution rule configured in home gateway Then.
Optionally, the first computer obtains former data packet from First Family's gateway, to edit to obtain report containing Address requests First data packet of text;First data packet is sent to First Family's gateway with first computer or the second home gateway is surveyed Examination;First Family's gateway and the second home gateway are different equipment.
Optionally, the first computer obtains former data packet from First Family's gateway, to edit to obtain report containing Address requests First data packet of text;Second computer obtains the first data packet obtained by the first Computerized Editing, is used to First Family Gateway or the second home gateway are tested;First computer and second computer are different equipment;The first hand Front yard gateway and the second home gateway are different equipment.
Another technical solution of the invention is to provide a kind of test method of server, wherein including following procedure:
Computer edits the first data packet by data packet simulation tool, carrys out simulant-client to server and sends request The data packet of content;
After server receives the first data packet that computer is sent, matched according to setting rule execution with request content Operation, and the second data packet for indicating operating result is returned to computer;
Computer parses by packet capture tool and judges whether the operating result in the second data packet meets service The setting rule of device.
Another technical solution of the invention is to provide a kind of test macro of server, wherein including:
Computer and the home gateway being attached thereto;The computer is further provided with:
Data packet simulation tool, to edit the first data packet of the message containing Address requests, to request in the home gateway Server according to the allocation rule of configuration carry out address section distribution;
Packet capture tool, to obtain the second data packet of the message containing address offer that server is returned to computer, And it is parsed in second data packet by the packet capture tool and the ground provided after address section distribution is carried out by server Location information, to judge whether the address information is in the address section for meeting allocation rule requirement.
The test method and test macro of server of the present invention use data packet simulation tool in a computer, compile The data packet under DHCP protocol is collected and sends, to simulate the data that the dhcp client of different vendor, distinct device type is sent Packet during carrying out data-bag interacting with Dynamic Host Configuration Protocol server, judges whether test result meets the technology of address section distribution It is required that.
Compared with prior art, the invention has the following advantages that
(1) solve the problems, such as that device type covering is incomplete;
(2) test process is simplified, the time of equipment starting, switching is eliminated;
(3) editor's data packet is defined according to standard, positioning problems are more clear clear;
Thus, it is different that the present invention efficiently solves insufficient existing test method covering surface, test time-consuming, the service of connection devices standard The problems such as.
Detailed description of the invention
Fig. 1 is the structural schematic diagram of test device of the present invention;
Fig. 2 is the flow diagram of test method of the present invention;
Fig. 3 is the Discover message structure schematic diagram of the first data packet in test method of the present invention;
Fig. 4 is the schematic diagram of the Offer message structure of the second data packet in test method of the present invention;
Fig. 5 is the schematic diagram of Option60 field format in test method of the present invention;
Fig. 6 is the schematic diagram that field Filed is defined in test method of the present invention.
Specific embodiment
It is found by the analysis to DHCP workflow, Dynamic Host Configuration Protocol server is the Offer message at it to client sending In (address offer message), complete to distribute the address of client.Based on the above situation, address section distribution provided by the invention Test method, comprising implementation steps shown in Fig. 2 it is as follows:
The computer of test (PC), i.e., connect by step 1, setting test macro as shown in Figure 1 with home gateway;
Data packet simulation tool and packet capture tool are provided in the computer;DHCP service in the home gateway In device, it is configured with dhcp address section allocation rule, and dhcp address pool can be divided with this.The data of section's Lay are used in this example Packet simulation tool, packet capture tool can be the functional module of operation WireShark software;It in other examples can also be with It is realized using other data packet simulation tool or data network analyzer.
Step 2 opens data packet simulation tool on computers, and editor includes Discover message (under DHCP agreement Location request message) the first data packet;
Step 3, computer use data packet simulation tool, and the message containing Discover edited is sent to Dynamic Host Configuration Protocol server The first data packet;
After step 4, Dynamic Host Configuration Protocol server receive the first data packet of the message containing Discover, generates and returned to computer It include second data packet of Offer message (address offer message) under DHCP agreement;
In second data packet of the message containing Offer, it is related to Dynamic Host Configuration Protocol server according to the allocation rule of setting and carries out address point Relevant information after matching, the IP address provided including at least Dynamic Host Configuration Protocol server;
The of step 5, the message containing Offer returned in a computer using packet capture tool capture Dynamic Host Configuration Protocol server Two data packets, and analyze the requirement whether IP address that Dynamic Host Configuration Protocol server distributes in Offer message meets allocation rule.
Thus, it only needs to simulate different vendor, distinct device by the data packet simulation tool in computer in the present invention The dhcp client (DHCP Client) of type sends Discover message to Dynamic Host Configuration Protocol server;Also, pass through crawl The Offer message that Dynamic Host Configuration Protocol server returns checks the IP address that Dynamic Host Configuration Protocol server returns in Offer message, judges DHCP service Device is directed to the IP address of this kind of dhcp client distribution whether in corresponding address section.
Specific implementation of the invention is divided into two parts, one is being reported using the production of data packet simulation tool containing Discover First data packet of text, the second is carrying out the test of dhcp address section distribution function using the first data packet edited.
The editor of S1, data packet comprising the steps of:
S11: computer being connected under any one home gateway and obtains IP address, and uses data packet on computers Capturing tools (such as WireShark) capture a DHCP original data packet of home gateway transmission;At this point, the computer is as fortune The equipment of row client obtains IP address and DHCP original data packet according to existing method from the home gateway.
S12: using data packet simulation tool on computer, opens the DHCP original data packet of capture, retains wherein containing initial The data packet of Discover message is edited.
S13: by data packet simulation tool, by ethernet network frame in the data packet containing initial Discover message (EthernetII) source MAC (address SourceMAC) and destination-mac address (address DestinationMAC) is revised as Broadcast address.
S14: by data packet simulation tool, by BOOT strapping Protocol in the data packet containing initial Discover message (BooTstrapProtocol) client mac address (ClientMACaddress) under in boot flag (Bootpflags), is repaired It is changed to identical as the source MAC in ethernet network frame.
S15: by data packet simulation tool, by boot flag under BOOT strapping Protocol in the data packet containing initial Discover message The content of interior Option60 field;If the field can be added manually without Option60 field.
S16: obtaining the first data packet of the message containing Discover, save to first data packet after having edited, It can Reusability in later period test.That is, editor the first data packet computer and it is subsequent using the first data packet into The computer of row test can be the same equipment and may not be the same equipment;And any one computer, it can be used The first data packet of its own editor or the first data packet of other Computerized Editings are tested.
It is shown in Figure 3, it is the structural schematic diagram of a Discover message, the part that wherein box is irised out is to pass through this The part of invention the method progress edit-modify.In this example, walked as S13 described in, by the source in initial Discover message MAC Address is revised as " Source:ec:a8:6b:61:14:03 (ec:a8:6b:61:14:03) ";Described in being walked as S14, according to The content of above-mentioned source MAC, client mac address is revised as " Client MAC Address:ec:a8:6b:61:14: 03 (ec:a8:6b:61:14:03) " keeps two MAC Address consistent.
The editor of Option60 field is described in detail below: showing the format of Option60 field in Fig. 4, makes first It is 60 with 1 byte representation code (Code) value, illustrates that this is an Option60 field;It is followed by this Option60 word The length (Length) of section content, this length refer to the byte for removing and occupying after Code and Length;It is made by oneself followed by user The vendor or type of justice identifies (Vendor class Identifier) content, is edited according to testing requirement, e.g.: Business code (Enterprise Code), field type (Filed Type), field length (Filed Length), field value (Filed Value).Wherein, field Filed is related defines referring to Figure 5.
The first data packet of the message containing Discover is opened using data packet simulation tool, carries out the distribution of dhcp address section The operation of functional test can be and carry out immediately after the editing process for completing step S1, is also possible to basis and has been saved The first data packet carry out.
S2, the test for carrying out dhcp address section distribution function comprising the steps of:
S21: computer is connect with home gateway to be measured, builds test topology as shown in Figure 1;
S22: the dhcp address section allocation rule in home gateway to be measured is configured;
S23: opening data packet simulation tool in a computer, sends and edits to the Dynamic Host Configuration Protocol server of home gateway to be measured First data packet of the complete message containing Discover;
S24: turn-on data Packet capturing tool in a computer captures the message containing Offer that home gateway to be measured returns The second data packet;
S25: you in boot flag is analyzed in the second data packet of the message containing Offer under BOOT strapping Protocol in a computer IP address (YourIPaddress) content, and judge whether to meet the dhcp address section point configured in home gateway to be measured With rule.
As shown in fig. 6, be the structural schematic diagram of an Offer message, the part that wherein box is irised out be in the present invention by Dynamic Host Configuration Protocol server distributes to the IP address of client.In this example, S25 step your IP address (that is, client ip address) For " Your(client) IP address:66.66.66.11(66.66.66.11) ", computer is sentenced by this item data It is disconnected whether to meet related allocation rule.
In conclusion test method of the present invention and test macro are compiled by simulating different clients by computer It collects the first data packet of the message containing Discover and is sent to server, and only need to contain Dynamic Host Configuration Protocol server return Second data packet of Offer message is captured and is analyzed, and it is accurate that test result is stablized, without using network of relation to set It is standby to carry out whole process test.
In addition, the present invention is not limited solely to the test of dhcp address section distribution function, under other DHCP protocols Available effective utilization when the test of Option field can not also need complete protocol interaction or interaction some yet Process is used in simply testing.
It is discussed in detail although the contents of the present invention have passed through above preferred embodiment, but it should be appreciated that above-mentioned Description is not considered as limitation of the present invention.After those skilled in the art have read above content, for of the invention A variety of modifications and substitutions all will be apparent.Therefore, protection scope of the present invention should be limited to the appended claims.

Claims (7)

1. a kind of test method of server, which is characterized in that
Computer to edit the first data packet of the message containing Address requests, and sends institute by the data packet simulation tool of setting Server of first data packet into the home gateway connecting with the computer is stated, to request the server according to point of configuration Address section distribution is carried out with rule;
For the computer by the packet capture tool of setting, obtain that server returns to it provides the of message containing address Two data packets carry out the address information provided after address section distribution by server to parse in second data packet, and sentence Whether the address information of breaking is in the address section for meeting allocation rule requirement;
Include following procedure when the first data packet of Computerized Editing message containing Address requests:
By packet capture tool, from the server for the home gateway connecting with the computer, former data packet is got;
By data packet simulation tool, opens former data packet and therefrom obtain the data packet of the request message containing initial address and compiled After collecting and saving, the first data packet of the message containing Address requests is obtained.
2. test method as described in claim 1, which is characterized in that
Computer is by data packet simulation tool, by the source MAC of ethernet network frame in the data packet of initial address request message Address and destination-mac address are revised as broadcast address and are revised as also by the client mac address under BOOT strapping Protocol in boot flag It is identical as the source MAC in the ethernet network frame.
3. test method as claimed in claim 2, which is characterized in that
Computer is by data packet simulation tool, in boot flag under BOOT strapping Protocol in the data packet of initial address request message Option Field edited or added, make include in the Option Field:
The length value for indicating the code value of the Option Field type, indicating the Option Field content, and according to address section point The vendor or type identification content defined with test request.
4. test method as claimed in claim 3, which is characterized in that
The Option Field is Option60 field.
5. test method as claimed in claim 2, which is characterized in that
Computer is analyzed to provide to guide under BOOT strapping Protocol in the second data packet of message containing address and be marked by packet capture tool Client address in will, and judge whether the client address meets the allocation rule configured in home gateway.
6. test method as described in claim 1, which is characterized in that
First computer obtains former data packet from First Family's gateway, to edit to obtain the first data of the message containing Address requests Packet;First data packet is sent to First Family's gateway with first computer or the second home gateway is tested;The first hand Front yard gateway and the second home gateway are different equipment.
7. test method as described in claim 1, which is characterized in that
First computer obtains former data packet from First Family's gateway, to edit to obtain the first data of the message containing Address requests Packet;Second computer obtains the first data packet obtained by the first Computerized Editing, is used to First Family's gateway or second Front yard gateway is tested;First computer and second computer are different equipment;First Family's gateway and second Home gateway is different equipment.
CN201410394540.2A 2014-08-12 2014-08-12 A kind of test method and test macro of server Active CN104125119B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410394540.2A CN104125119B (en) 2014-08-12 2014-08-12 A kind of test method and test macro of server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410394540.2A CN104125119B (en) 2014-08-12 2014-08-12 A kind of test method and test macro of server

Publications (2)

Publication Number Publication Date
CN104125119A CN104125119A (en) 2014-10-29
CN104125119B true CN104125119B (en) 2019-09-13

Family

ID=51770388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410394540.2A Active CN104125119B (en) 2014-08-12 2014-08-12 A kind of test method and test macro of server

Country Status (1)

Country Link
CN (1) CN104125119B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105323120A (en) * 2015-11-26 2016-02-10 上海斐讯数据通信技术有限公司 Test method, test device and test terminal for DHCP service side
CN108667953A (en) * 2018-04-27 2018-10-16 四川斐讯信息技术有限公司 A kind of the lease function test method and system, test device of DHCP service
CN115118625B (en) * 2018-05-11 2023-06-27 创新先进技术有限公司 Data verification method and device
CN109525462B (en) * 2018-12-14 2020-09-25 奇安信科技集团股份有限公司 Gateway testing method and device
CN110430184B (en) * 2019-07-31 2022-01-21 腾讯科技(深圳)有限公司 Data simulation method, data simulation device, computer-readable storage medium and computer equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1434382A (en) * 2002-04-01 2003-08-06 北京港湾网络有限公司 Test method and system for IEEE 802.1x network insertion equipment
CN1581816A (en) * 2003-08-05 2005-02-16 华为技术有限公司 Device and method for dynamically measuring VLAN users
CN101335654A (en) * 2007-06-28 2008-12-31 中兴通讯股份有限公司 Interface positioning test method and system
CN101425938A (en) * 2008-12-17 2009-05-06 福建星网锐捷网络有限公司 Method and apparatus for network apparatus test

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1434382A (en) * 2002-04-01 2003-08-06 北京港湾网络有限公司 Test method and system for IEEE 802.1x network insertion equipment
CN1581816A (en) * 2003-08-05 2005-02-16 华为技术有限公司 Device and method for dynamically measuring VLAN users
CN101335654A (en) * 2007-06-28 2008-12-31 中兴通讯股份有限公司 Interface positioning test method and system
CN101425938A (en) * 2008-12-17 2009-05-06 福建星网锐捷网络有限公司 Method and apparatus for network apparatus test

Also Published As

Publication number Publication date
CN104125119A (en) 2014-10-29

Similar Documents

Publication Publication Date Title
CN104125119B (en) A kind of test method and test macro of server
CN111045952B (en) Software testing method, flow playback device, terminal equipment and readable storage medium
CN109672583A (en) Method for monitoring network, equipment, storage medium and device
CN105099811A (en) Interface testing method and device
US20090156314A1 (en) System and method for re-generating packet load for load test
CN107480036A (en) Automatic test approach, device, storage medium and the terminal of iOS Mobile solutions
CN110798380A (en) Data acquisition method, system, device, test equipment and test server
CN113825129B (en) Industrial Internet asset mapping method in 5G network environment
CN104122871A (en) Real-time monitoring system and real-time monitoring method of semiconductor test data
CN113055408B (en) Network security test integrated device
CN110445752B (en) Implementation method for supporting various CAN devices and flexibly analyzing various CAN messages
CN105207803B (en) A kind of method and system of the trap message of the multiple network elements of simulation
KR102051580B1 (en) Integrated clinical trial apparatus based on cdisc
CN111813648A (en) Automatic testing method and device applied to App, storage medium and electronic equipment
CN100375443C (en) Method of access network element managing system for mobile communication service managing system
CN106301833A (en) A kind of transformer station schedule information method of testing
JP4680069B2 (en) Method for dealing with interconnection of applications where implementation differences exist in SIP protocol
CN109995607B (en) Method for testing flow overhead, terminal, server and computer storage medium
CN109543122B (en) Content synchronization method, device, storage medium and electronic device
CN114003484A (en) Log output method, device and equipment for interface test and storage medium
CN114443461A (en) Method, device, system and medium for determining code coverage information
Díaz-Zayas et al. Remote control and instrumentation of Android devices
CN110069400A (en) Loophole test report generation method, device, computer equipment and storage medium
CN110971644A (en) Page access monitoring method and device
CN112073258B (en) Method for identifying user, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200804

Address after: 430000 part of the third floor of cable building, Guandong science and Technology Park, Wuhan East Lake New Technology Development Zone, Wuhan, Hubei Province

Patentee after: Wuhan Changjiang Computing Technology Co., Ltd

Address before: 201620 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right