CN107222363A - One kind storage protocol conformance test method and system - Google Patents
One kind storage protocol conformance test method and system Download PDFInfo
- Publication number
- CN107222363A CN107222363A CN201710385435.6A CN201710385435A CN107222363A CN 107222363 A CN107222363 A CN 107222363A CN 201710385435 A CN201710385435 A CN 201710385435A CN 107222363 A CN107222363 A CN 107222363A
- Authority
- CN
- China
- Prior art keywords
- protocol
- model
- test
- storage
- protocol model
- 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.)
- Granted
Links
- 238000010998 test method Methods 0.000 title description 2
- 238000012360 testing method Methods 0.000 claims abstract description 93
- 238000000034 method Methods 0.000 claims abstract description 25
- 238000006243 chemical reaction Methods 0.000 claims description 6
- 238000012795 verification Methods 0.000 claims description 5
- 230000001915 proofreading effect Effects 0.000 claims 1
- 230000006870 function Effects 0.000 description 11
- 230000006399 behavior Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000006978 adaptation Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000013507 mapping Methods 0.000 description 4
- 230000008521 reorganization Effects 0.000 description 4
- 238000012546 transfer Methods 0.000 description 4
- 238000003491 array Methods 0.000 description 2
- 235000000332 black box Nutrition 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000005669 field effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/18—Protocol analysers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/06—Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/30—Definitions, standards or architectural aspects of layered protocol stacks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
- Communication Control (AREA)
Abstract
本发明提供了一种存储协议一致性测试方法,当需要对存储协议的一致性进行测试时,首先基于通用协议包结构层构建协议模型,然后将协议模型转化为具体协议,然后对存储协议的一致性进行测试,本发明通过构建协议模型,将协议模型转化为具体协议,能够有效提高存储协议一致性的测试效率。
The invention provides a method for testing the consistency of the storage protocol. When the consistency of the storage protocol needs to be tested, the protocol model is first constructed based on the general protocol packet structure layer, then the protocol model is converted into a specific protocol, and then the storage protocol is tested. Consistency is tested, and the present invention converts the protocol model into a specific protocol by constructing a protocol model, which can effectively improve the test efficiency of storage protocol consistency.
Description
技术领域technical field
本发明涉及存储系统技术领域,更具体地说,涉及一种存储协议一致性 测试方法及系统。The present invention relates to the technical field of storage systems, and more specifically, to a storage protocol consistency testing method and system.
背景技术Background technique
存储的协议有多种,如接口层协议SATA(Serial Advanced TechnologyAttachment,串行高级技术附件)、SCSI(Small Computer System Interface, 小型计算机系统接口)、SAS(Statistical Analysis System,系统分析软件)等, 管理类协议有SNMP(Simple Network Management Protocol,简单网络管理协 议)、SMI-S(StorageManagement Initiative specification,前沿存储管理接口 标准)、RestAPI(Representational State Transfer Application Programming Interface,表述性状态传递应用程序编程接口),文件共享类协议有NFS (Network File System,网络文件系统)、CIFS(Common Internet File System, 通用网络文件系统)、FTP(File TransferProtocol,文件传输协议)等。虽然 协议定义各有不同,但相似协议在核心语义方面有极大的相似性,如SMI-S和 RestAPI。在测试角度看有两个大的困难,一个是同一个协议要测试不同厂商 的支持程度;另一个是为相似协议要编写独立的测试用例,工作量大,执行 测试时也有很多重复动作。因此,如何提高存储协议一致性的测试效率是一 项亟待解决的问题。There are many storage protocols, such as interface layer protocols SATA (Serial Advanced Technology Attachment, Serial Advanced Technology Attachment), SCSI (Small Computer System Interface, small computer system interface), SAS (Statistical Analysis System, system analysis software), etc., management Such protocols include SNMP (Simple Network Management Protocol, Simple Network Management Protocol), SMI-S (Storage Management Initiative specification, cutting-edge storage management interface standard), RestAPI (Representational State Transfer Application Programming Interface, representational state transfer application programming interface), File sharing protocols include NFS (Network File System, network file system), CIFS (Common Internet File System, common network file system), FTP (File Transfer Protocol, file transfer protocol) and the like. Although the protocol definitions are different, similar protocols have great similarity in core semantics, such as SMI-S and RestAPI. From the perspective of testing, there are two major difficulties. One is to test the support of different manufacturers for the same protocol; the other is to write independent test cases for similar protocols, which requires a lot of work and many repetitive actions during test execution. Therefore, how to improve the test efficiency of storage protocol consistency is an urgent problem to be solved.
发明内容Contents of the invention
有鉴于此,本发明的目的在于提供一种存储协议一致性测试方法,能够 有效提高存储协议一致性的测试效率。In view of this, the object of the present invention is to provide a storage protocol conformance testing method, which can effectively improve the testing efficiency of storage protocol conformance.
为实现上述目的,本发明提供如下技术方案:To achieve the above object, the present invention provides the following technical solutions:
一种存储协议一致性测试方法,包括:A storage protocol conformance testing method, comprising:
基于通用协议包结构层构建协议模型;Build a protocol model based on the general protocol packet structure layer;
将所述协议模型转化为具体协议;Converting the protocol model into a specific protocol;
对存储协议的一致性进行测试。Test the conformance of the storage protocol.
优选地,所述基于通用协议包结构层构建协议模型包括:Preferably, the construction of the protocol model based on the general protocol packet structure layer includes:
对所述协议模型进行初始化;Initializing the protocol model;
对所述协议模型进行结构化定义;Structurally defining the protocol model;
对所述协议模型进行帧格式定义。Define the frame format of the protocol model.
优选地,所述对所述协议模型进行初始化具体为:Preferably, the initialization of the protocol model is specifically:
在测试用例被执行前,完成与设备的认证、握手和数据初始化。Before the test case is executed, complete the authentication, handshake and data initialization with the device.
优选地,所述对所述协议模型进行结构化定义具体为:Preferably, the structural definition of the protocol model is specifically:
对协议分层定义和协议报文格式定义。Define the layered protocol and protocol message format.
优选地,所述对所述协议模型进行帧格式定义具体为:Preferably, the definition of the frame format of the protocol model is specifically:
将协议模型中的结构化定义内容封装成在硬件平台上传输的格式,完成 对协议内容的校验。Encapsulate the structured definition content in the protocol model into a format transmitted on the hardware platform to complete the verification of the protocol content.
一种存储协议一致性测试系统,包括:A storage protocol conformance testing system, comprising:
构建模块,用于基于通用协议包结构层构建协议模型;A building block for building a protocol model based on a general protocol packet structure layer;
转化模块,用于将所述协议模型转化为具体协议;A conversion module, configured to convert the protocol model into a specific protocol;
测试模块,用于对存储协议的一致性进行测试。The test module is used to test the consistency of the storage protocol.
优选地,所述构建模块包括:Preferably, the building blocks include:
初始化单元,用于对所述协议模型进行初始化;an initialization unit, configured to initialize the protocol model;
结构化定义单元,用于对所述协议模型进行结构化定义;a structural definition unit, configured to structurally define the protocol model;
帧格式定义单元,用于对所述协议模型进行帧格式定义。The frame format definition unit is configured to define the frame format of the protocol model.
优选地,所述初始化单元具体用于:在测试用例被执行前,完成与设备 的认证、握手和数据初始化。Preferably, the initialization unit is specifically configured to: complete authentication with the device, handshake and data initialization before the test case is executed.
优选地,所述结构化定义单元具体用于:对协议分层定义和协议报文格 式定义。Preferably, the structural definition unit is specifically used for: defining protocol layers and protocol message formats.
优选地,所述帧格式定义单元具体用于:将协议模型中的结构化定义内 容封装成在硬件平台上传输的格式,完成对协议内容的校验。Preferably, the frame format definition unit is specifically configured to: encapsulate the structured definition content in the protocol model into a format transmitted on the hardware platform, and complete the verification of the protocol content.
由上述技术方案可知,本发明提供了存储协议一致性测试方法,当需要 对存储协议的一致性进行测试时,首先基于通用协议包结构层构建协议模型, 然后将协议模型转化为具体协议,然后对存储协议的一致性进行测试,本发 明通过构建协议模型,将协议模型转化为具体协议,能够有效提高存储协议 一致性的测试效率。It can be seen from the above technical solution that the present invention provides a storage protocol consistency test method. When the consistency of the storage protocol needs to be tested, the protocol model is first constructed based on the general protocol packet structure layer, and then the protocol model is converted into a specific protocol, and then To test the consistency of the storage protocol, the present invention can effectively improve the test efficiency of the storage protocol consistency by constructing the protocol model and transforming the protocol model into a specific protocol.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面 描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明公开的一种存储协议一致性测试方法实施例1的方法流程 图;Fig. 1 is the method flowchart of embodiment 1 of a kind of storage protocol conformance testing method disclosed by the present invention;
图2为本发明公开的一种存储协议一致性测试方法方法实施例2的方法流 程图;Fig. 2 is a method flow chart of embodiment 2 of a storage protocol consistency testing method method disclosed by the present invention;
图3为本发明公开的一种存储协议一致性测试系统实施例1的结构示意 图;Fig. 3 is a schematic structural diagram of Embodiment 1 of a storage protocol conformance testing system disclosed by the present invention;
图4为本发明公开的一种存储协议一致性测试系统实施例2的结构示意 图。Fig. 4 is a schematic structural diagram of Embodiment 2 of a storage protocol conformance testing system disclosed in the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行 清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而 不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative work all belong to the protection scope of the present invention.
为了更加特定地强调实施的独立性,本说明书涉及许多模块或单元。举 例而言,模块或单元可由硬件电路实现,该硬件电路包括特制VLSI电路或门 阵列,比如逻辑芯片、晶体管,或其它组件。模块或单元也可在可编程的硬 设备中实现,比如场效可编程门阵列、可编程阵列逻辑、可编程逻辑设备等 等。To more particularly emphasize implementation independence, the description refers to a number of modules or units. For example, a module or unit may be implemented by a hardware circuit comprising purpose-built VLSI circuits or gate arrays such as logic chips, transistors, or other components. Modules or units may also be implemented in programmable hardware devices, such as Field Effect Programmable Gate Arrays, Programmable Array Logic, Programmable Logic Devices, and the like.
模块或单元也可在藉由各种形式的处理器所执行的软件中实现。比如说, 一可执行码模块可包括一个或多个实体的或逻辑的计算机指令区块,该区块 可能形成为,比如说,对象、程序或函数。然而,鉴别模块或单元的可执行 部分不需要物理上放置在一起,但可由存于不同位置的不同指令所组成,当 逻辑上组合在一起时,形成模块或单元且达到该模块或单元所要求的目的。Modules or units may also be implemented in software executed by various forms of processors. For example, a module of executable code may comprise one or more physical or logical blocks of computer instructions which may be formed, for example, as objects, procedures, or functions. However, the executable parts of an authentication module or unit need not be physically located together, but may consist of different instructions stored in different locations which, when logically grouped together, form the module or unit and achieve the requirements of that module or unit. the goal of.
实际上,可执行码模块或单元可以是一单一指令或多个指令,甚至可以 分布在位于不同的程序的数个不同的码区段,并且横跨数个存储设备。同样 地,操作数据可被辨识及显示于此模块或单元中,并且可以以任何合适的形 式实施且在任何合适的数据结构形式内组织。操作数据可以集合成单一数据 集,或可分布在具有不同的存储设备的不同的位置,且至少部分地只以电子 信号方式存在于一系统或网络。Indeed, a module or unit of executable code may be a single instruction, or many instructions, and may even be distributed over several different code segments, in different programs, and across several memory devices. Likewise, operational data may be identified and displayed within this module or unit, and may be implemented in any suitable form and organized within any suitable data structure form. Operational data may be aggregated into a single data set, or may be distributed in different locations with different storage devices, and exist at least in part only in the form of electronic signals in a system or network.
本说明书所提及的“实施例”或类似用语表示与实施例有关的特性、结 构或特征,包括在本发明的至少一实施例中。因此,本说明书所出现的用语 “在一实施例中”、“在实施例中”以及类似用语可能但不必然都指向相同 实施例。The "embodiment" or similar terms mentioned in this specification indicate that the characteristics, structures or characteristics related to the embodiment are included in at least one embodiment of the present invention. Thus, appearances of the terms "in one embodiment," "in an embodiment," and similar terms throughout this specification may, but do not necessarily, all refer to the same embodiment.
再者,本发明所述特性、结构或特征可以以任何方式结合在一个或多个 实施例中。以下说明将提供许多特定的细节,比如编程序、软件模块、用户 选择、网络交易、数据库查询、数据库结构、硬件模块、硬件电路、硬件芯 片等例子,以提供对本发明实施例的了解。然而相关领域的普通技术人员将 看出本发明,即使没有利用其中一个或多个特定细节,或利用其它方法、组 件、材料等亦可实施。另一方面,为避免混淆本发明,公知的结构、材料或操作并没有详细描述。Furthermore, the described properties, structures or characteristics of the invention may be combined in any manner in one or more embodiments. The following description will provide many specific details, such as examples of programming, software modules, user selections, network transactions, database queries, database structures, hardware modules, hardware circuits, hardware chips, etc., to provide an understanding of the embodiments of the present invention. One of ordinary skill in the relevant art will recognize, however, that the invention may be practiced without one or more of these specific details, or with other methods, components, materials, and the like. In other instances, well-known structures, materials or operations are not described in detail to avoid obscuring the invention.
如图1所示,为本发明公开的一种存储协议一致性测试方法实施例1的流 程图,本方法包括以下步骤:As shown in Figure 1, it is a flow chart of a kind of storage protocol conformance testing method embodiment 1 disclosed by the present invention, and the method comprises the following steps:
S101、基于通用协议包结构层构建协议模型;S101. Construct a protocol model based on the general protocol packet structure layer;
S102、将协议模型转化为具体协议;S102. Transform the protocol model into a specific protocol;
S103、对存储协议的一致性进行测试。S103. Test the consistency of the storage protocol.
一般的协议栈结构包括:硬件接口、协议编码规则、协议包格式定义、 协议语义、协议内部分层结构和协议状态机和行为。其中,硬件接口:处 理硬件接口的相关内容,对于网口来说,这是传输层;协议编码规则:一般 是文本或者二进制的编码格式,这里仅仅处理基础的编码格式,比如bencode 编码、base64编码等,与具体协议无关;协议包格式定义:基于某种特定编码 规则形成的协议包格式定义,经过软件解码后,一般形成一棵协议格式树, 存在于内存中。这个协议树对于协议处理以及协议相似性判定十分重要。协 议语义:协议规范的,各个字段的具体含义;协议内部分层结构:有些协议 内部也是分层的,比如传输层、会话层、事务层等;协议状态机和行为:协 议状态机是任何协议都具有的,协议行为主要是协议的高层交互,也是协议 必不可少的组成部分。The general protocol stack structure includes: hardware interface, protocol coding rules, protocol packet format definition, protocol semantics, protocol internal layered structure, protocol state machine and behavior. Among them, hardware interface: deal with the relevant content of the hardware interface, for the network port, this is the transport layer; protocol encoding rules: generally text or binary encoding format, here only deal with the basic encoding format, such as bencode encoding, base64 encoding etc., has nothing to do with the specific protocol; protocol packet format definition: the protocol packet format definition based on a specific encoding rule, after software decoding, generally forms a protocol format tree, which exists in the memory. This protocol tree is very important for protocol processing and protocol similarity determination. Protocol semantics: protocol specifications, the specific meaning of each field; protocol internal layered structure: some protocols are also layered internally, such as transport layer, session layer, transaction layer, etc.; protocol state machine and behavior: protocol state machine is any protocol Both have, the protocol behavior is mainly the high-level interaction of the protocol, and it is also an indispensable part of the protocol.
当需要进行存储协议的一致性测试时,在通用协议包结构层进行的相似 模型定义,一个协议包在结构上就是一棵树,在该层上规范出了详细的包结 构,每一个新协议的到来都需要适配到通用协议包结构上(主要逐个协议包 做映射),映射的具体方法就是树的操作:新节点的添加、节点的删除、节 点的合并。其中,新节点的添加:主要是协议能力扩展,或者协议版本升级 带来的新功能。如RestAPI协议1.1比1.0在createSnapShot报文上增加了 targetVolume字段,就在createSnapShot报文结构树上增加一个targetVolume字段。When the consistency test of the storage protocol is required, the similar model definition is carried out at the general protocol packet structure layer. A protocol packet is a tree in structure, and the detailed packet structure is standardized on this layer. Each new protocol The arrival of all needs to be adapted to the general protocol packet structure (mainly mapping protocol packets one by one). The specific method of mapping is the operation of the tree: adding new nodes, deleting nodes, and merging nodes. Among them, the addition of new nodes: mainly the expansion of protocol capabilities, or new functions brought about by protocol version upgrades. If the RestAPI protocol 1.1 adds a targetVolume field to the createSnapShot message compared to 1.0, a targetVolume field is added to the structure tree of the createSnapShot message.
节点的删除:有些协议在扩展时会废弃某些字段,反应在协议包结构树 上就是删除节点的操作。Deletion of nodes: Some protocols discard certain fields when they are extended, and the operation of deleting nodes is reflected in the protocol packet structure tree.
节点的合并:有些协议在废弃某些字段时,不会改变原二进制包的结构。 如协议1.0,字段1,长度是4字节,字段2长度是2字节。在协议1.1中,字段2 被删除,但为了保证协议的兼容性,字段1的长度变为6字节。在此种情况下 我们就进行节点的合并操作。Merging of nodes: some protocols will not change the structure of the original binary package when some fields are discarded. For example, in protocol 1.0, the length of field 1 is 4 bytes, and the length of field 2 is 2 bytes. In protocol 1.1, field 2 is deleted, but in order to ensure the compatibility of the protocol, the length of field 1 becomes 6 bytes. In this case we perform the merge operation of the nodes.
然后将相似协议模型转化为具体协议,具体的,采用适配器完成适配的 过程,适配器可以是独立的节点或者是软件模块,在协议包生成后,发送前 按照规则进行修改,最终发送给被测存储设备。该种方式类似于黑盒测试方 式,通过修改输出结果来实现新的测试用例生成。如果协议间存在继承关系, 那么就存在一个适配的协议栈,需要协议1到协议1.1,再到协议1.1.1层层适配。Then convert the similar protocol model into a specific protocol. Specifically, the adapter is used to complete the adaptation process. The adapter can be an independent node or a software module. After the protocol package is generated, it is modified according to the rules before sending, and finally sent to the tested storage device. This method is similar to the black-box testing method, which realizes the generation of new test cases by modifying the output results. If there is an inheritance relationship between the protocols, then there is an adapted protocol stack, which requires layer-by-layer adaptation from protocol 1 to protocol 1.1, and then to protocol 1.1.1.
综上所述,在上述实施例中,当需要对存储协议的一致性进行测试时, 首先基于通用协议包结构层构建协议模型,然后将协议模型转化为具体协议, 然后对存储协议的一致性进行测试,本发明通过构建协议模型,将协议模型 转化为具体协议,能够有效提高存储协议一致性的测试效率。To sum up, in the above embodiment, when the consistency of the storage protocol needs to be tested, the protocol model is first constructed based on the general protocol packet structure layer, and then the protocol model is converted into a specific protocol, and then the consistency of the storage protocol is tested. For testing, the present invention converts the protocol model into a specific protocol by constructing the protocol model, and can effectively improve the test efficiency of the consistency of the storage protocol.
如图2所示,为本发明公开的一种存储协议一致性测试方法实施例2的流 程图,本方法包括以下步骤:As shown in Figure 2, it is a flow chart of a kind of storage protocol conformance testing method embodiment 2 disclosed by the present invention, and the method comprises the following steps:
S201、对协议模型进行初始化;S201. Initialize the protocol model;
S202、对协议模型进行结构化定义;S202. Structurally defining the protocol model;
S203、对协议模型进行帧格式定义;S203. Define the frame format of the protocol model;
当需要对存储协议进行一致性测试时,首先进行协议模型的设计,在设 计协议模型时,具体包括:模型初始化、结构化定义和帧格式定义。其中, 协议模型初始化:在测试用例被执行前,完成与设备的认证、握手、数据初 始化等基础性工作,其目的是使设备达到一个稳定状态,以保证协议测试状 态的稳定性和协议测试结果的准确性。When it is necessary to conduct a consistency test on the storage protocol, the protocol model should be designed first. When designing the protocol model, it includes: model initialization, structural definition and frame format definition. Among them, protocol model initialization: before the test case is executed, complete basic work such as authentication with the device, handshake, data initialization, etc. The purpose is to make the device reach a stable state to ensure the stability of the protocol test state and protocol test results accuracy.
结构化定义:用于描述协议的通用化特征,完成对同类协议的抽象定义。 协议模型的结构化定义内容主要包括:协议分层定义和协议报文格式定义。Structural definition: It is used to describe the generalized characteristics of the protocol and complete the abstract definition of similar protocols. The structural definition of the protocol model mainly includes: protocol layer definition and protocol message format definition.
帧格式定义:用于把协议模型的中的结构化定义内容封装成可以在硬件 平台上可以传输的格式,同时完成对协议内容的校验。Frame format definition: It is used to encapsulate the structured definition content in the protocol model into a format that can be transmitted on the hardware platform, and at the same time complete the verification of the protocol content.
S204、将协议模型转化为具体协议;S204. Transform the protocol model into a specific protocol;
协议的实例化功能负责把协议模型转化为具体协议。具体功能包括:协 议格式重组和编码。协议格式重组功能负责删除不支持的字段,增加协议模 型没有的字段,协议编码功能负责根据具体协议的要求,把协议包编码为二 进制或者文本格式,只有实例化的测试协议才能运行测试用例。The instantiation function of the protocol is responsible for converting the protocol model into a specific protocol. Specific functions include: protocol format reorganization and encoding. The protocol format reorganization function is responsible for deleting unsupported fields and adding fields that are not in the protocol model. The protocol encoding function is responsible for encoding the protocol packet into binary or text format according to the requirements of the specific protocol. Only the instantiated test protocol can run the test case.
S205、对存储协议的一致性进行测试。S205. Test the consistency of the storage protocol.
系统的输入是测试用例,一个测试用例一般是一个测试过程,最小应包 含一个请求和一个响应,两条报文。经过系统转换,一个测试用例可以被自 动转换为存储协议1.0和1.1两套测试用例,用以测试两套不同的测试设备。过 程如下:(1)输入是一个测试用例;(2)系统执行测试用例,从测试用例 中发现被测被测设备的协议包,初始是最低版本1.0;(3)采用实例化方法, 把协议包转换成一个内存中的协议树;(4)根据不同的目标设备来决定接下 来是否转化为1.1版本的协议包,还是就是测试1.0;(5)根据协议模型1.1中 的定义,修改步骤(4)中的协议树结构,使之转化为协议包1.1;(6)生成 1.1的包结构;(7)通过底层接口(IP或者FC)把1.1包或1.0包发送给正确的 存储设备。The input of the system is a test case, and a test case is generally a test process, which should at least include a request, a response, and two messages. After system conversion, one test case can be automatically converted into two sets of test cases for storage protocol 1.0 and 1.1, which are used to test two sets of different test equipment. The process is as follows: (1) The input is a test case; (2) The system executes the test case, and finds the protocol package of the device under test from the test case, the initial minimum version is 1.0; (3) Using the instantiation method, the protocol Packets are converted into a protocol tree in memory; (4) decide whether to convert into protocol packets of version 1.1 or test 1.0 according to different target devices; (5) modify the steps ( 4) convert the protocol tree structure into protocol packet 1.1; (6) generate the packet structure of 1.1; (7) send the 1.1 packet or 1.0 packet to the correct storage device through the bottom interface (IP or FC).
综上所述,本发明通过对相近协议或者同一协议的不同版本只需要编写 一套测试套,实现了测试套的高度复用,节约了人力成本,实现了存储协议 测试的自动化。To sum up, the present invention only needs to write a set of test suites for similar protocols or different versions of the same protocol, which realizes the high degree of reuse of test suites, saves labor costs, and realizes the automation of storage protocol testing.
如图3所示,为本发明公开的一种存储协议一致性测试系统实施例1的结 构示意图,本系统包括:As shown in Figure 3, it is a schematic structural diagram of Embodiment 1 of a storage protocol conformance testing system disclosed by the present invention. This system includes:
构建模块301,用于基于通用协议包结构层构建协议模型;A construction module 301, configured to construct a protocol model based on a general protocol packet structure layer;
转化模块302,用于将协议模型转化为具体协议;A conversion module 302, configured to convert the protocol model into a specific protocol;
测试模块303,用于对存储协议的一致性进行测试。The testing module 303 is configured to test the consistency of the storage protocol.
一般的协议栈结构包括:硬件接口、协议编码规则、协议包格式定义、 协议语义、协议内部分层结构和协议状态机和行为。其中,硬件接口:处 理硬件接口的相关内容,对于网口来说,这是传输层;协议编码规则:一般 是文本或者二进制的编码格式,这里仅仅处理基础的编码格式,比如bencode 编码、base64编码等,与具体协议无关;协议包格式定义:基于某种特定编码 规则形成的协议包格式定义,经过软件解码后,一般形成一棵协议格式树, 存在于内存中。这个协议树对于协议处理以及协议相似性判定十分重要。协 议语义:协议规范的,各个字段的具体含义;协议内部分层结构:有些协议 内部也是分层的,比如传输层、会话层、事务层等;协议状态机和行为:协 议状态机是任何协议都具有的,协议行为主要是协议的高层交互,也是协议 必不可少的组成部分。The general protocol stack structure includes: hardware interface, protocol coding rules, protocol packet format definition, protocol semantics, protocol internal layered structure, protocol state machine and behavior. Among them, hardware interface: deal with the relevant content of the hardware interface, for the network port, this is the transport layer; protocol encoding rules: generally text or binary encoding format, here only deal with the basic encoding format, such as bencode encoding, base64 encoding etc., has nothing to do with the specific protocol; protocol packet format definition: the protocol packet format definition based on a specific encoding rule, after software decoding, generally forms a protocol format tree, which exists in the memory. This protocol tree is very important for protocol processing and protocol similarity determination. Protocol semantics: protocol specifications, the specific meaning of each field; protocol internal layered structure: some protocols are also layered internally, such as transport layer, session layer, transaction layer, etc.; protocol state machine and behavior: protocol state machine is any protocol Both have, the protocol behavior is mainly the high-level interaction of the protocol, and it is also an indispensable part of the protocol.
当需要进行存储协议的一致性测试时,在通用协议包结构层进行的相似 模型定义,一个协议包在结构上就是一棵树,在该层上规范出了详细的包结 构,每一个新协议的到来都需要适配到通用协议包结构上(主要逐个协议包 做映射),映射的具体方法就是树的操作:新节点的添加、节点的删除、节 点的合并。其中,新节点的添加:主要是协议能力扩展,或者协议版本升级 带来的新功能。如RestAPI协议1.1比1.0在createSnapShot报文上增加了 targetVolume字段,就在createSnapShot报文结构树上增加一个targetVolume字段。When the consistency test of the storage protocol is required, the similar model definition is carried out at the general protocol packet structure layer. A protocol packet is a tree in structure, and the detailed packet structure is standardized on this layer. Each new protocol The arrival of all needs to be adapted to the general protocol packet structure (mainly mapping protocol packets one by one). The specific method of mapping is the operation of the tree: adding new nodes, deleting nodes, and merging nodes. Among them, the addition of new nodes: mainly the expansion of protocol capabilities, or new functions brought about by protocol version upgrades. If the RestAPI protocol 1.1 adds a targetVolume field to the createSnapShot message compared to 1.0, a targetVolume field is added to the structure tree of the createSnapShot message.
节点的删除:有些协议在扩展时会废弃某些字段,反应在协议包结构树 上就是删除节点的操作。Deletion of nodes: Some protocols discard certain fields when they are extended, and the operation of deleting nodes is reflected in the protocol packet structure tree.
节点的合并:有些协议在废弃某些字段时,不会改变原二进制包的结构。 如协议1.0,字段1,长度是4字节,字段2长度是2字节。在协议1.1中,字段2 被删除,但为了保证协议的兼容性,字段1的长度变为6字节。在此种情况下 我们就进行节点的合并操作。Merging of nodes: some protocols will not change the structure of the original binary package when some fields are discarded. For example, in protocol 1.0, the length of field 1 is 4 bytes, and the length of field 2 is 2 bytes. In protocol 1.1, field 2 is deleted, but in order to ensure the compatibility of the protocol, the length of field 1 becomes 6 bytes. In this case we perform the merge operation of the nodes.
然后将相似协议模型转化为具体协议,具体的,采用适配器完成适配的 过程,适配器可以是独立的节点或者是软件模块,在协议包生成后,发送前 按照规则进行修改,最终发送给被测存储设备。该种方式类似于黑盒测试方 式,通过修改输出结果来实现新的测试用例生成。如果协议间存在继承关系, 那么就存在一个适配的协议栈,需要协议1到协议1.1,再到协议1.1.1层层适配。Then convert the similar protocol model into a specific protocol. Specifically, the adapter is used to complete the adaptation process. The adapter can be an independent node or a software module. After the protocol package is generated, it is modified according to the rules before sending, and finally sent to the tested storage device. This method is similar to the black-box testing method, which realizes the generation of new test cases by modifying the output results. If there is an inheritance relationship between the protocols, then there is an adapted protocol stack, which requires layer-by-layer adaptation from protocol 1 to protocol 1.1, and then to protocol 1.1.1.
综上所述,在上述实施例中,当需要对存储协议的一致性进行测试时, 首先基于通用协议包结构层构建协议模型,然后将协议模型转化为具体协议, 然后对存储协议的一致性进行测试,本发明通过构建协议模型,将协议模型 转化为具体协议,能够有效提高存储协议一致性的测试效率。To sum up, in the above embodiment, when the consistency of the storage protocol needs to be tested, the protocol model is first constructed based on the general protocol packet structure layer, and then the protocol model is converted into a specific protocol, and then the consistency of the storage protocol is tested. For testing, the present invention converts the protocol model into a specific protocol by constructing the protocol model, and can effectively improve the test efficiency of the consistency of the storage protocol.
如图4所示,为本发明公开的一种存储协议一致性测试系统实施例2的结 构示意图,本系统包括:As shown in Figure 4, it is a schematic structural diagram of Embodiment 2 of a storage protocol conformance testing system disclosed by the present invention, and the system includes:
初始化单元401,用于对协议模型进行初始化;an initialization unit 401, configured to initialize the protocol model;
结构化定义单元402,用于对协议模型进行结构化定义;A structured definition unit 402, configured to define the protocol model in a structured manner;
帧格式定义单元403,用于对协议模型进行帧格式定义;A frame format definition unit 403, configured to define the frame format of the protocol model;
当需要对存储协议进行一致性测试时,首先进行协议模型的设计,在设 计协议模型时,具体包括:模型初始化、结构化定义和帧格式定义。其中, 协议模型初始化:在测试用例被执行前,完成与设备的认证、握手、数据初 始化等基础性工作,其目的是使设备达到一个稳定状态,以保证协议测试状 态的稳定性和协议测试结果的准确性。When it is necessary to conduct a consistency test on the storage protocol, the protocol model should be designed first. When designing the protocol model, it includes: model initialization, structural definition and frame format definition. Among them, protocol model initialization: before the test case is executed, complete basic work such as authentication with the device, handshake, data initialization, etc. The purpose is to make the device reach a stable state to ensure the stability of the protocol test state and protocol test results accuracy.
结构化定义:用于描述协议的通用化特征,完成对同类协议的抽象定义。 协议模型的结构化定义内容主要包括:协议分层定义和协议报文格式定义。Structural definition: It is used to describe the generalized characteristics of the protocol and complete the abstract definition of similar protocols. The structural definition of the protocol model mainly includes: protocol layer definition and protocol message format definition.
帧格式定义:用于把协议模型的中的结构化定义内容封装成可以在硬件 平台上可以传输的格式,同时完成对协议内容的校验。Frame format definition: It is used to encapsulate the structured definition content in the protocol model into a format that can be transmitted on the hardware platform, and at the same time complete the verification of the protocol content.
转化模块404,用于将协议模型转化为具体协议;A conversion module 404, configured to convert the protocol model into a specific protocol;
协议的实例化功能负责把协议模型转化为具体协议。具体功能包括:协 议格式重组和编码。协议格式重组功能负责删除不支持的字段,增加协议模 型没有的字段,协议编码功能负责根据具体协议的要求,把协议包编码为二 进制或者文本格式,只有实例化的测试协议才能运行测试用例。The instantiation function of the protocol is responsible for converting the protocol model into a specific protocol. Specific functions include: protocol format reorganization and encoding. The protocol format reorganization function is responsible for deleting unsupported fields and adding fields that are not in the protocol model. The protocol encoding function is responsible for encoding the protocol packet into binary or text format according to the requirements of the specific protocol. Only the instantiated test protocol can run the test case.
测试模块405,用于对存储协议的一致性进行测试。The testing module 405 is configured to test the consistency of the storage protocol.
系统的输入是测试用例,一个测试用例一般是一个测试过程,最小应包 含一个请求和一个响应,两条报文。经过系统转换,一个测试用例可以被自 动转换为存储协议1.0和1.1两套测试用例,用以测试两套不同的测试设备。过 程如下:(1)输入是一个测试用例;(2)系统执行测试用例,从测试用例 中发现被测被测设备的协议包,初始是最低版本1.0;(3)采用实例化方法, 把协议包转换成一个内存中的协议树;(4)根据不同的目标设备来决定接下 来是否转化为1.1版本的协议包,还是就是测试1.0;(5)根据协议模型1.1中 的定义,修改步骤(4)中的协议树结构,使之转化为协议包1.1;(6)生成 1.1的包结构;(7)通过底层接口(IP或者FC)把1.1包或1.0包发送给正确的 存储设备。The input of the system is a test case, and a test case is generally a test process, which should at least include a request, a response, and two messages. After system conversion, one test case can be automatically converted into two sets of test cases for storage protocol 1.0 and 1.1, which are used to test two sets of different test equipment. The process is as follows: (1) The input is a test case; (2) The system executes the test case, and finds the protocol package of the device under test from the test case, the initial minimum version is 1.0; (3) Using the instantiation method, the protocol Packets are converted into a protocol tree in memory; (4) decide whether to convert into protocol packets of version 1.1 or test 1.0 according to different target devices; (5) modify the steps ( 4) convert the protocol tree structure into protocol packet 1.1; (6) generate the packet structure of 1.1; (7) send the 1.1 packet or 1.0 packet to the correct storage device through the bottom interface (IP or FC).
综上所述,本发明通过对相近协议或者同一协议的不同版本只需要编写 一套测试套,实现了测试套的高度复用,节约了人力成本,实现了存储协议 测试的自动化。To sum up, the present invention only needs to write a set of test suites for similar protocols or different versions of the same protocol, which realizes the high degree of reuse of test suites, saves labor costs, and realizes the automation of storage protocol testing.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都 是与其它实施例的不同之处,各个实施例之间相同相似部分互相参见即可。Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same and similar parts between the various embodiments can be referred to each other.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用 本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易 见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下, 在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例, 而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710385435.6A CN107222363B (en) | 2017-05-26 | 2017-05-26 | A storage protocol conformance testing method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710385435.6A CN107222363B (en) | 2017-05-26 | 2017-05-26 | A storage protocol conformance testing method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107222363A true CN107222363A (en) | 2017-09-29 |
CN107222363B CN107222363B (en) | 2021-01-08 |
Family
ID=59946826
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710385435.6A Active CN107222363B (en) | 2017-05-26 | 2017-05-26 | A storage protocol conformance testing method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107222363B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109324958A (en) * | 2018-06-27 | 2019-02-12 | 郑州云海信息技术有限公司 | A REST unified verification method, device, device and readable storage medium |
CN109818955A (en) * | 2019-01-22 | 2019-05-28 | 上海鹰信智能技术有限公司 | A kind of control coding method of transmitted in both directions and its system |
CN111835724A (en) * | 2020-06-11 | 2020-10-27 | 广州天源信息科技股份有限公司 | A protocol conflict matching method, system, storage medium and computer device |
CN111884776A (en) * | 2020-07-02 | 2020-11-03 | 深圳市赛特新能科技有限公司 | Charging pile protocol consistency testing method |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1357981A (en) * | 2000-12-04 | 2002-07-10 | 深圳黎明电脑网络有限公司 | Method of testing several kinds of application protocol |
US20060168477A1 (en) * | 2005-01-24 | 2006-07-27 | International Business Machines Corporation | Multilayered architecture for storage protocol conformance testing of storage devices |
CN102542110A (en) * | 2011-12-29 | 2012-07-04 | 北京时代民芯科技有限公司 | Emulation verification method applied to mobile storage SOC (system on chip) chip |
CN103150264A (en) * | 2013-01-18 | 2013-06-12 | 浪潮电子信息产业股份有限公司 | Extension Cache Coherence protocol-based multi-level consistency simulation domain verification and test method |
CN103198009A (en) * | 2012-01-04 | 2013-07-10 | 中国移动通信集团公司 | Universal testing method, system and corresponding device |
US8788685B1 (en) * | 2006-04-27 | 2014-07-22 | Netapp, Inc. | System and method for testing multi-protocol storage systems |
CN104125235A (en) * | 2014-08-11 | 2014-10-29 | 浪潮电子信息产业股份有限公司 | Integrated multi-protocol storage method |
CN105262644A (en) * | 2015-11-03 | 2016-01-20 | 株洲南车时代电气股份有限公司 | General test system based on protocol configuration and method |
CN105718344A (en) * | 2016-01-19 | 2016-06-29 | 中国电子科技集团公司第三十八研究所 | Verification method of FPGA universal configurable UART protocol based on UVM |
-
2017
- 2017-05-26 CN CN201710385435.6A patent/CN107222363B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1357981A (en) * | 2000-12-04 | 2002-07-10 | 深圳黎明电脑网络有限公司 | Method of testing several kinds of application protocol |
US20060168477A1 (en) * | 2005-01-24 | 2006-07-27 | International Business Machines Corporation | Multilayered architecture for storage protocol conformance testing of storage devices |
US8788685B1 (en) * | 2006-04-27 | 2014-07-22 | Netapp, Inc. | System and method for testing multi-protocol storage systems |
CN102542110A (en) * | 2011-12-29 | 2012-07-04 | 北京时代民芯科技有限公司 | Emulation verification method applied to mobile storage SOC (system on chip) chip |
CN103198009A (en) * | 2012-01-04 | 2013-07-10 | 中国移动通信集团公司 | Universal testing method, system and corresponding device |
CN103150264A (en) * | 2013-01-18 | 2013-06-12 | 浪潮电子信息产业股份有限公司 | Extension Cache Coherence protocol-based multi-level consistency simulation domain verification and test method |
CN104125235A (en) * | 2014-08-11 | 2014-10-29 | 浪潮电子信息产业股份有限公司 | Integrated multi-protocol storage method |
CN105262644A (en) * | 2015-11-03 | 2016-01-20 | 株洲南车时代电气股份有限公司 | General test system based on protocol configuration and method |
CN105718344A (en) * | 2016-01-19 | 2016-06-29 | 中国电子科技集团公司第三十八研究所 | Verification method of FPGA universal configurable UART protocol based on UVM |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109324958A (en) * | 2018-06-27 | 2019-02-12 | 郑州云海信息技术有限公司 | A REST unified verification method, device, device and readable storage medium |
CN109324958B (en) * | 2018-06-27 | 2021-10-29 | 郑州云海信息技术有限公司 | A REST unified verification method, device, device and readable storage medium |
CN109818955A (en) * | 2019-01-22 | 2019-05-28 | 上海鹰信智能技术有限公司 | A kind of control coding method of transmitted in both directions and its system |
CN111835724A (en) * | 2020-06-11 | 2020-10-27 | 广州天源信息科技股份有限公司 | A protocol conflict matching method, system, storage medium and computer device |
CN111835724B (en) * | 2020-06-11 | 2022-08-26 | 广州天源信息科技股份有限公司 | Protocol conflict matching method, system, storage medium and computer equipment |
CN111884776A (en) * | 2020-07-02 | 2020-11-03 | 深圳市赛特新能科技有限公司 | Charging pile protocol consistency testing method |
Also Published As
Publication number | Publication date |
---|---|
CN107222363B (en) | 2021-01-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10437712B1 (en) | API functional-test generation | |
CN109508177B (en) | A real-time computing method, device, server and storage medium | |
JP2010531481A (en) | Transfer of tabular parameters via tabular data stream protocol | |
US11822470B2 (en) | Platform agnostic library-less intelligent test automation by reverse engineering product REST API specification | |
CN111949693B (en) | Data processing device, data processing method, storage medium and electronic equipment | |
CN107222363A (en) | One kind storage protocol conformance test method and system | |
CN109815141B (en) | A test method and device | |
CN112912870B (en) | Conversion of tenant identifiers | |
CN111694572A (en) | Code format conversion method, device, computer equipment and storage medium | |
US11385905B2 (en) | Managing boot device orders for computing devices | |
US10019185B2 (en) | System and method for copying directory structures | |
CN113590348B (en) | Parameter transmission method, device, equipment and medium based on tree structure | |
CN111597020B (en) | Application programming interface API debugging method and debugging terminal | |
CN114579085A (en) | Gateway API development method and device | |
CN113220237B (en) | Distributed storage method, device, equipment and storage medium | |
CN116112579A (en) | Message middleware ecological compatibility method, device and system and readable storage medium | |
CN115145473A (en) | Data processing method, device and equipment between heterogeneous storage media | |
CN111475291A (en) | Data processing method, system, server and medium | |
CN111913737B (en) | A method, device, equipment and storage medium for constructing a data service interface | |
CN117609629A (en) | A differentiated docking and distribution method and device for multi-platform data models | |
CN118075114A (en) | Method, device, model converter and storage medium for creating a proprietary network | |
CN114385159A (en) | File processing method, apparatus, electronic device, and computer-readable storage medium | |
CN114528353A (en) | Method and apparatus for providing blockchain service | |
CN114968939A (en) | A file merging method, device and computer-readable storage medium | |
CN114398074A (en) | Method and device for automatic interface development |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20201202 Address after: 215100 No. 1 Guanpu Road, Guoxiang Street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province Applicant after: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Address before: 450018 Henan province Zheng Dong New District of Zhengzhou City Xinyi Road No. 278 16 floor room 1601 Applicant before: ZHENGZHOU YUNHAI INFORMATION TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |