Background technology
The network test instrument is a kind ofly can carry out function, performance, fragility test to physical layer, data link layer, network layer, transport layer, session layer, presentation layer and the application layer of osi model definition, and portable, the visual intelligent detection equipment that can carry out protocol conformance and emulation testing, mainly be applicable to the disparate networks product test.
Utilize tester to test at present, mainly rely on tester's Artificial Control.Tester generally by special messenger's unified management, will be preengage application before the tester uses as a kind of shared resource.During real the use, check earlier whether the resource of application is idle, if occupied can only the wait or reservation again.Before the test beginning, the tester generally can be familiar with the related content of test case earlier, as testing tool, test environment, test purpose, testing procedure, test expection etc., afterwards the tested network equipment is connected with tester, builds test environment.The tester can be with reference to the requirement of test case, the parameter of manual configuration tester.After configuration finished, test brought into operation.Tester's test run process all the time, record and the result who obtains according to tester and the expection of test case if a plurality of process results are arranged, will repeat repeatedly.After test run finished, the tester stopped test, discharged tester and used for other people, so far, finished whole test process.
Mainly there are the following problems in the existing process of utilizing tester to test:
1, the test instrumentation resource utilization is low.In present test environment, the port of instrument is the use pattern of the formula of monopolizing, be that the tester needs to use in certain test instrumentation in test assignment, just instrument and networking products are placed on one independently in the test environment, remove test environment after test is finished, the instrument port could discharge and be used by other test assignments.Because the instrument port is very limited; and test often needs to take a plurality of ports; and the time is uncertain; several testers occur through regular meeting and wait in line the use test instrument; and the inconsistency of the unmanned use of instrument sometimes; this occupation mode influences tester's operating efficiency, causes the test instrumentation resource utilization lower.
2, test instrumentation configuration management complexity.In present test environment, the measuring executing process of instrument is finished automatically, but instrument configuration management and test data collection process are manual finishing.The tester need be according to the requirement of test assignment, and various test result data are collected and put in order to the various parameters in the configuration instrument.Because the function of test instrumentation from strength to strength, configuration also becomes increasingly complex, and the configuration of test instrumentation and use need considerable background knowledge; And the configuration of the instrument of different vendor, different model and the method used have very big difference, tester's study and to be familiar with process longer.
3, the manual configuration test instrumentation is unfavorable for that the parallel of a plurality of test assignments carry out.Manually instrument is configured that operation always might make a mistake, particularly under the situation that instrument becomes increasingly complex.Lift a common example, each test assignment is all used different ports, if the tester has obscured the instrument port of two tasks in layoutprocedure, interfere with each other with regard to producing between two tasks so, this situation is recurrent when human configuration.
Summary of the invention
In view of above-mentioned analysis, the present invention aims to provide a kind of network test instrument adaptive system and method automatically of realizing, the utilization of resources of existing network test instrumentation is insufficient, testing efficiency low in order to solve, the problem of testing reliability difference.
Purpose of the present invention mainly is achieved through the following technical solutions:
The invention provides a kind of network test instrument adaptive system automatically that realizes, comprising:
Adaptive resource parsing module is used to resolve the adaptive resource file that current test script defines, and obtains adaptive resource characteristic bit string;
The virtual instrument describing module is used in advance with the abstract virtual instrument file for having standard attribute, operation and method of test instrumentation;
The virtual instrument parsing module is used to resolve the virtual instrument description document of virtual instrument describing module, and application obtains the virtual instrument example;
The virtual instrument Registering modules is used for the virtual instrument example that the adaptive resource characteristic bit string that obtains according to adaptive resource parsing module and virtual instrument parsing module obtain, the virtual instrument example that registration obtains specializing;
Physics instrument describing module comprises physics instrument description document and physics instrument adapter, the corresponding physics instrument of each physics instrument adapter;
Physics instrument parsing module is used to resolve physics instrument description document, obtains the index mapping table of physics instrument adapter;
Physical vlan instrument binding module is used for the index mapping table of virtual instrument example and physics instrument adapter is carried out rule match, afterwards virtual instrument example and the physics instrument adapter that the match is successful is carried out dynamic binding, obtains specific physics instrument;
Test script running module is used to load the test process file that current test script defines, and drives the physics instrument after specializing, and carries out test process.
Further, described physical vlan instrument binding module also is used for, and after test is finished, virtual instrument example and physics instrument adapter is separated binding, discharges the physics instrument of specializing.
Further, described virtual instrument Registering modules also is used for, and nullifies the virtual instrument example, and output test run result.
The present invention also provides a kind of network test instrument adaptive method automatically that realizes, comprising:
Load test script, test script comprises adaptive resource file and test process file;
Adaptive resource parsing module is resolved the adaptive resource file of current test script definition, obtains adaptive resource characteristic bit string;
The virtual instrument parsing module is resolved the predefined virtual instrument of virtual instrument describing module, and application obtains the virtual instrument example;
The virtual instrument Registering modules is used for the virtual instrument example that the adaptive resource characteristic bit string that obtains according to adaptive resource parsing module and virtual instrument parsing module obtain, the virtual instrument example that registration obtains specializing;
Physics instrument parsing module is used to resolve physics instrument description document, obtains the index mapping table of physics instrument adapter;
The index mapping table of virtual instrument example and physics instrument adapter is carried out rule match, afterwards virtual instrument example and the physics instrument adapter that the match is successful are carried out dynamic binding, obtain specific physics instrument;
Test script running module loads the test process file of current test script definition, drives the physics instrument after specializing, and carries out test process.
Further, also comprise:
After test was finished, described physical vlan instrument binding module was separated binding with virtual instrument example and physics instrument adapter, discharged the physics instrument of specializing.
Further, also comprise:
Described virtual instrument Registering modules is nullified the virtual instrument example, and output test run result.
Beneficial effect of the present invention is as follows:
System and method provided by the invention, the abstract essential characteristic of test instrumentation, the user can call the feature interface of virtual instrument and handle specific test instrumentation, and can add corresponding test instrumentation adapter as required, the assurance autgmentability is strong, and ease for use is good, and does not need to consider the details of operation of concrete test instrumentation in system framework and the scripting process, processing mode is simple, the efficient height.
Other features and advantages of the present invention will be set forth in the following description, and becoming apparent from specification of part perhaps understood by implementing the present invention.Purpose of the present invention and other advantages can realize and obtain by specifically noted structure in the specification of being write, claims and accompanying drawing.
Embodiment
Specifically describe the preferred embodiments of the present invention below in conjunction with accompanying drawing, wherein, accompanying drawing constitutes the application's part, and is used from explaination principle of the present invention with embodiments of the invention one.For clear and simplification purpose, when it may make theme of the present invention smudgy, with specifying in detail of known function and structure in the omission device described herein.
1 pair of described system of the embodiment of the invention is elaborated at first, in conjunction with the accompanying drawings.
As shown in Figure 1, Fig. 1 is the structural representation of the described system of the embodiment of the invention, specifically can comprise: adaptive resource parsing module 101, virtual instrument describing module 102, virtual instrument parsing module 103, virtual instrument Registering modules 104, physics instrument describing module 105, physics instrument parsing module 106, physical vlan instrument binding module 107 and test script running module 108, wherein
Adaptive resource parsing module 101, this module are used for resolving the adaptive resource file of test script definition, obtain adaptive resource characteristic bit string.Adaptive resource characteristic bit string adopts the form of JSON string, i.e. unordered " ' name/value ' a to " set.Use ", " (comma) to separate between " ' name/value ' to ", ": " (colon) front is " title ", and ": " (colon) back is " value ".Be exactly specifically, characteristic informations such as the test-types that adaptive resource parsing module defines according to adaptive resource file, test event, test time, test instrumentation model, test instrumentation management address, the protocol type of surveying, required port quantity, required port speed, required port address, wherein characteristic information is as title, the value of characteristic information is as value, successively above-mentioned information is formed some " ' name/value ' to ", at last with these characteristic informations to being assembled into adaptive resource characteristic bit string.
Below by a concrete example form of adaptive resource characteristic bit string is described, as follows:
Virtual instrument describing module 102, this module is the virtual instrument description document, be used for all kinds of test instrumentations abstract be general " virtual instrument " with standard attribute, operation and method.Standard attribute is the internal data set of virtual instrument, is used to write down the various software and hardware information of test instrumentation, and calls for standard operation and standard method; Standard operation is that virtual instrument offers outside interface, carries out various test processs so that handle test instrumentation; Standard method is that virtual instrument offers outside interface, so that the running status and the software and hardware information of real-time control and measuring instrument.
Wherein, the standard attribute of virtual instrument comprises title, type, model, hardware description information, software description information, integrated circuit board quantity, integrated circuit board port number, port model, port speed, port communication rate; The standard operation of virtual instrument comprises initialization virtual instrument, the adaptive resource characteristic bit string of loading, operation common protocol flow, operation benchmark protocol traffic, operation attack traffic, operation simulation protocol flow, moves combination protocol flow, operation playback protocol traffic, port switching state, adds up error message, obtains the real-time testing result, obtains final testing result; The standard method of virtual instrument comprise check the virtual instrument title, check the virtual instrument type, check the virtual instrument model, check virtual instrument hardware description information, check virtual instrument software description information, check virtual instrument integrated circuit board quantity, check the virtual instrument integrated circuit board port number, check virtual instrument port model, check the virtual instrument port speed, check virtual instrument port communication rate, check the virtual instrument CPU usage, check the virtual instrument memory usage.
Virtual instrument parsing module 103, this module are used for resolving the virtual instrument description document of virtual instrument describing module, application and initialization virtual instrument example.The virtual instrument parsing module dynamically generates the virtual instrument example that comprises all standard attributes, operation and method according to the content of virtual instrument description document, is followed successively by standard attribute afterwards and gives default value, thereby finish the initialization of virtual instrument example.
Virtual instrument Registering modules 104, this module are used for the virtual instrument example that the adaptive resource characteristic bit string that obtains according to the virtual instrument parsing module and virtual instrument parsing module obtain, the virtual instrument example that registration obtains specializing; After test run finishes, generate before the test result, this module also is used to nullify the virtual instrument example.
The process of registration virtual instrument comprises the adaptive resource characteristic bit string of verification, and adaptive resource characteristic bit string dynamic load is arrived the virtual instrument example.At first, the virtual instrument Registering modules is according to the syntactic structure of JSON string, adaptive resource characteristic bit string is carried out the grammer verification, afterwards, the characteristic information string is split into a set that comprises some " ' name/value ' to ", then, obtain the title and the value of each " ' name/value ' to " successively, and carry out the verification of span, so far finish the checking procedure of characteristic information string, standard attribute with characteristic information value and virtual instrument example carries out rule match at last, when characteristic information and a certain standard attribute mate fully, with the standard attribute assignment is this characteristic information value, until all characteristic informations are loaded into the virtual instrument example, thereby finishes whole registration process.
Physics instrument describing module 105, this module are to describe the set of the adapter of physics instrument attribute and control operation.Physics instrument describing module comprises a plurality of physics instrument description document and a plurality of physics instrument adapter.According to the model difference of physics instrument, has different types of physics instrument adapter.The general-purpose attribute of physics instrument adapter comprises test-types, test event and test instrumentation model.The general controls operation of physics instrument adapter comprises the initialization of physics instrument, loading configuration file, operation test, outputs test result and stops test.
Physics instrument description document adopts the XML file format, below by a concrete example form of physics instrument description document is described, and is as follows:
Physics instrument parsing module 106, this module are used for resolving physics instrument description document, obtain the index mapping table of physics instrument adapter.At first, physics instrument describing module is resolved the adapter element of description document, obtains the content of element.In the example, promptly obtain three file daughter elements of adapter element in the above, this shows that this description document comprises three adapters.And then, resolve the content of adapter element more successively, obtain adapter title, descriptor and memory location.In the example, promptly resolve each file attribute of an element in the above, the corresponding adapter title of name attribute, the corresponding adapter stores of path attribute position, the corresponding adapter descriptor of desc attribute.At last, the above-mentioned Adapter Information that obtains is saved in the index mapping table.This index mapping table is called index with physics instrument adapter name, is used to write down the descriptor and the memory location of adapter, wherein the corresponding call number of each physics instrument adapter title.
Physical vlan instrument binding module 107, this module is used for the index mapping table of virtual instrument example and physics instrument adapter is carried out rule match, when a certain index of the index mapping table of the test instrumentation model of virtual instrument example and physics instrument adapter mates fully, show that then the match is successful, otherwise it fails to match.Afterwards virtual instrument example and the physics instrument adapter that the match is successful are carried out dynamic binding, obtain specific physics instrument.This module also is used for, and after test run finishes, generates before the test result, and virtual instrument example and physics instrument adapter are separated binding, discharges the physics instrument of specializing.
Test script running module 108, this module are used for loading the test process file of current test script definition, drive the physics instrument after specializing, and carry out test process.
Next, 2 pairs of described methods of the embodiment of the invention are elaborated in conjunction with the accompanying drawings.
As shown in Figure 2, Fig. 2 is the schematic flow sheet of the described method of the embodiment of the invention, and this method has been utilized said apparatus, specifically can comprise the steps:
Step 201: load test script, test script comprises adaptive resource file and test process file;
Step 202: the adaptive resource file of resolving current test script definition; Promptly, according to characteristic informations such as the test-types of adaptive resource file definition, test event, test time, test instrumentation model, test instrumentation management address, the protocol type of surveying, required port quantity, required port speed, required port addresses, generate adaptive resource characteristic bit string;
Step 203: the virtual instrument parsing module is resolved the predefined virtual instrument of virtual instrument describing module, and application obtains the virtual instrument example;
Step 204: registration virtual instrument example comprises three steps: initialization virtual instrument example, and the adaptive resource characteristic bit string of verification arrives the virtual instrument example with adaptive resource characteristic bit string dynamic load;
Step 205: the virtual instrument example that adaptive resource characteristic bit string that the virtual instrument Registering modules obtains according to the virtual instrument parsing module and virtual instrument parsing module obtain, the virtual instrument example that registration obtains specializing;
Step 206: physics instrument parsing module is resolved physics instrument description document, obtains the index mapping table of physics instrument adapter;
Step 207: the index mapping table of virtual instrument example and physics instrument adapter is carried out rule match, afterwards virtual instrument example and the physics instrument adapter that the match is successful are carried out dynamic binding, obtain specific physics instrument;
Step 208: test script running module loads the test process file of current test script definition, drives the physics instrument after specializing, and carries out test process;
Step 209: stop test instrumentation, finish test;
Step 210: after test was finished, physical vlan instrument binding module was separated binding with virtual instrument example and physics instrument adapter, discharged the physics instrument of specializing;
Step 211: the virtual instrument Registering modules is nullified the virtual instrument example;
Step 212: output test run result.
In sum, the embodiment of the invention provides a kind of network test instrument adaptive system and method automatically of realizing, test script is quoted and is handled respectively by adaptive resource file and virtual instrument test instrumentation, and the process of obtaining test instrumentation is the dynamic binding by virtual instrument and physics instrument, is finished automatically by system.
The beneficial effect of the embodiment of the invention is as follows:
(1) the test instrumentation resource dynamic is distributed and is discharged.Improve the utilization ratio of instrument, improve the concurrency of test assignment.
(2) provide unified configuration file, reduce requirement, reduce the probability of misoperation the tester.The tester does not need to learn the method for operation of every kind of instrument, and can only dispose the pairing instrument resource of this task as long as be familiar with a kind of configuration file format, disturbs between the elimination task, reduces the manual errors probability.
(3) test instrumentation Typical Disposition caseization, automation improve testing efficiency.Native system can be worked under unattended situation automatically, even also can automatically perform test assignment in the quitting time.
(4) test process can repeat.Test script file all is stored in server, in the time of need testing again, only need access corresponding file and just can test automatically, does not need manual repeated configuration instrument.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claims.