[go: up one dir, main page]

CN107566098B - Method and system for generating software-defined network application test sequences - Google Patents

Method and system for generating software-defined network application test sequences Download PDF

Info

Publication number
CN107566098B
CN107566098B CN201710606520.0A CN201710606520A CN107566098B CN 107566098 B CN107566098 B CN 107566098B CN 201710606520 A CN201710606520 A CN 201710606520A CN 107566098 B CN107566098 B CN 107566098B
Authority
CN
China
Prior art keywords
message
sequence
state machine
extended
finite state
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
CN201710606520.0A
Other languages
Chinese (zh)
Other versions
CN107566098A (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.)
Tsinghua University
Original Assignee
Tsinghua University
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 Tsinghua University filed Critical Tsinghua University
Priority to CN201710606520.0A priority Critical patent/CN107566098B/en
Publication of CN107566098A publication Critical patent/CN107566098A/en
Application granted granted Critical
Publication of CN107566098B publication Critical patent/CN107566098B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种软件定义网络应用测试序列的生成方法与生成系统,该生成方法包括针对待测试软件定义网络应用构建信息表扩展有限状态机模型,信息表扩展有限状态机模型包括用于描述软件定义网络应用的行为的多个组件状态机;基于多个组件状态机,形成仅针对网络拓扑中一个指定的交换机的组合的有限状态机;采用有限状态机模型的测试生成方法,基于组合的有限状态机生成针对指定的交换机的单结点测试序列;在网络拓扑中模拟执行单结点测试序列,以将单结点测试序列扩展成多结点测试序列。该方法消除了现有技术中在对软件定义网络应用进行测试时,仅能测试单一网络实体,而脱离其所在网络的网络拓扑,不利于测试的缺陷。

The invention discloses a method and system for generating a software-defined network application test sequence. The generation method includes constructing an information table extended finite state machine model for the software-defined network application to be tested, and the information table extended finite state machine model includes a Multiple component state machines for the behavior of software-defined network applications; based on multiple component state machines, form a combined finite state machine for only one specified switch in the network topology; test generation methods using finite state machine models, based on combined The finite state machine generates a single-node test sequence for a specified switch; the single-node test sequence is simulated in the network topology to expand the single-node test sequence into a multi-node test sequence. The method eliminates the defect in the prior art that when testing a software-defined network application, only a single network entity can be tested, and it is separated from the network topology of the network where it is located, which is not conducive to testing.

Description

软件定义网络应用测试序列的生成方法与生成系统Method and system for generating software-defined network application test sequences

技术领域technical field

本发明属于网络协议测试技术领域,尤其涉及一种软件定义网络应用测试序列的生成方法与生成系统。The invention belongs to the technical field of network protocol testing, and in particular relates to a method and system for generating a software-defined network application test sequence.

背景技术Background technique

协议测试技术是保证网络通信协议能够正确实现,以及不同的网络设备之间实现正确互连的重要手段。一致性测试是基本的协议测试方法,其主要用于检测协议的实现是否与协议的规范相一致。Protocol testing technology is an important means to ensure the correct implementation of network communication protocols and the correct interconnection between different network devices. Conformance testing is a basic protocol testing method, which is mainly used to detect whether the implementation of the protocol is consistent with the specification of the protocol.

基于形式化方法的测试用例生成是协议测试技术领域中的重要问题。该测试用例的生成方法从协议规范的形式化模型出发,生成用于测试活动的测试集(或测试序列)。在大多数已提出的测试生成技术中,其基本思想是将被测系统(System Under Test,简称SUT)模型化为一个有限状态机或扩展有限状态机的系统,进而生成测试序列。Formal method-based test case generation is an important issue in the field of protocol testing technology. The test case generation method starts from the formalized model of the protocol specification to generate a test set (or test sequence) for testing activities. In most of the proposed test generation techniques, the basic idea is to model the system under test (SUT) as a finite state machine or a system extending the finite state machine, and then generate test sequences.

软件定义网络应用是一种与其所在的网络拓扑关系密切应用协议。一般的,软件定义网络应用具有其所在网络的全局视图,而且在其工作过程中会网络的配置进行修改,进而动态影响网络的功能和行为。由于现有技术中基于形式化方法的测试序列的生成仅考虑以单一的网络实体作为被测系统的情形,对于网络中多个网络实体关联的情形并没有涉及,因此,难以有效地对软件定义网络应用进行测试。A software-defined network application is an application protocol closely related to the network topology in which it resides. Generally, a software-defined network application has a global view of the network where it is located, and modifies the configuration of the network during its working process, thereby dynamically affecting the functions and behaviors of the network. Since the generation of test sequences based on formal methods in the prior art only considers a single network entity as the system under test, and does not involve the association of multiple network entities in the network, it is difficult to effectively define Web applications are tested.

发明内容Contents of the invention

本发明所要解决的技术问题之一是需要提供一种能够对软件定义网络应用所在的网络拓扑关系进行考虑,以对软件定义网络应用进行有效测试的方法。One of the technical problems to be solved by the present invention is to provide a method that can effectively test the software-defined network application by considering the network topology relationship where the software-defined network application is located.

为了解决上述技术问题,本申请的实施例首先提供了一种软件定义网络应用测试序列的生成方法,包括:针对待测试软件定义网络应用构建信息表扩展有限状态机模型,所述信息表扩展有限状态机模型包括用于描述所述软件定义网络应用的行为的多个组件状态机、描述各组件状态机之间的连接的信道以及描述所述软件定义网络应用所针对的网络的网络拓扑;In order to solve the above technical problems, the embodiments of the present application firstly provide a method for generating a test sequence of a software-defined network application, including: constructing an information table extension finite state machine model for the software-defined network application to be tested, the information table extension is limited The state machine model includes a plurality of component state machines for describing the behavior of the software-defined networking application, channels describing connections between the component state machines, and describing the network topology of the network for which the software-defined networking application is directed;

基于所述多个组件状态机,形成仅针对所述网络拓扑中一个指定的交换机的组合的有限状态机;forming a combined finite state machine for only one specified switch in the network topology based on the plurality of component state machines;

采用有限状态机模型的测试生成方法,基于所述组合的有限状态机生成针对所述指定的交换机的单结点测试序列,所述单结点测试序列包括该指定的交换机对所述待测试软件定义网络应用的输入消息与输出消息;A test generation method using a finite state machine model generates a single-node test sequence for the specified switch based on the combined finite state machine, and the single-node test sequence includes the specified switch for the software to be tested Define the input and output messages of the network application;

在所述网络拓扑中模拟执行所述单结点测试序列,以将所述单结点测试序列扩展成多结点测试序列。The single-node test sequence is simulated in the network topology to expand the single-node test sequence into a multi-node test sequence.

优选地,所述多个组件状态机包括用于描述与所述软件定义网络应用中保存的多个信息表项一一对应的多个并行进程的多个扩展有限状态机,所述扩展有限状态机包括初始状态、状态集合、变量集合、输入符号集合、输出符号集合与变迁集合。Preferably, the plurality of component state machines include a plurality of extended finite state machines for describing a plurality of parallel processes that correspond one-to-one to a plurality of information entries stored in the software-defined network application, and the extended finite state machines The machine includes initial state, state set, variable set, input symbol set, output symbol set and transition set.

优选地,所述描述所述软件定义网络应用所针对的网络的网络拓扑,包括用于描述所述网络中各网络实体的数组,所述数组中的各个元素分别对应于所述网络中的主机的集合、交换机的集合、控制器的集合与用于连接主机、交换机以及控制器的链路的集合。Preferably, the description of the network topology of the network targeted by the software-defined network application includes an array for describing each network entity in the network, and each element in the array corresponds to a host in the network A collection of switches, a collection of controllers, and a collection of links connecting hosts, switches, and controllers.

优选地,所述基于所述多个组件状态机,形成仅针对所述网络拓扑中一个指定的交换机的组合的有限状态机,包括:Preferably, based on the plurality of component state machines, forming a combined finite state machine for only one specified switch in the network topology includes:

在所述网络拓扑中指定一个交换机;specifying a switch in said network topology;

从所述网络拓扑中选取至少两个相互通信的主机,并在所述多个组件状态机中找到与所述相互通信的主机分别对应的,且针对指定的所述交换机的至少两个组件状态机;Select at least two hosts that communicate with each other from the network topology, and find at least two component states corresponding to the hosts that communicate with each other and for the specified switch in the plurality of component state machines machine;

组合所述至少两个组件状态机以形成组合的有限状态机,所述组合的有限状态机的每一个状态是所述至少两个组件状态机的状态集合及变量集合的组合。The at least two component state machines are combined to form a combined finite state machine, each state of the combined finite state machine being a combination of a set of states and a set of variables of the at least two component state machines.

优选地,所述在所述网络拓扑中模拟执行所述单结点测试序列,以将所述单结点测试序列扩展成多结点测试序列,包括:Preferably, the simulated execution of the single-node test sequence in the network topology to expand the single-node test sequence into a multi-node test sequence includes:

依次取出所述单结点测试序列中的每一个输入消息,并分别针对取出的输入消息生成扩展序列;Taking out each input message in the single-node test sequence in turn, and generating an extended sequence for the taken-out input message;

连接与所述单结点测试序列中的每一个输入消息对应的各扩展序列,以形成多结点测试序列。Spreading sequences corresponding to each input message in the single-node test sequence are concatenated to form a multi-node test sequence.

优选地,所述针对取出的输入消息生成扩展序列,包括:Preferably, said generating an extension sequence for the fetched input message includes:

步骤1、为待生成的所述扩展序列初始化存储空间;Step 1. Initialize storage space for the extended sequence to be generated;

步骤2、从所述输入消息中提取主机的数据报文和端口信息,并将所述数据报文和端口信息加入所述扩展序列中;Step 2, extracting the data packet and port information of the host from the input message, and adding the data packet and port information to the extended sequence;

步骤3、按照存储的顺序,依次从所述扩展序列中获取数据报文或控制报文以及对应的端口信息;Step 3, according to the order of storage, sequentially obtain data packets or control packets and corresponding port information from the extended sequence;

步骤4、基于所述数据报文或控制报文将到达的端口的类型与其自身的类型,确定对所述数据报文或控制报文的处理,以得到新的数据报文或控制报文以及对应的端口信息,并将得到的新的数据报文或控制报文以及对应的端口信息加入所述扩展序列中;Step 4, based on the type of the port where the data message or control message will arrive and its own type, determine the processing of the data message or control message to obtain a new data message or control message and Corresponding port information, and adding the obtained new data message or control message and corresponding port information into the extended sequence;

步骤5、重复执行步骤3与步骤4,直至完成对所述扩展序列中所存储的数据报文或控制报文的处理,并以最终存储在所述扩展序列中的全部内容作为一个扩展序列。Step 5. Repeat step 3 and step 4 until the processing of the data packets or control packets stored in the spreading sequence is completed, and all the content finally stored in the spreading sequence is used as a spreading sequence.

优选地,所述步骤4具体包括:Preferably, said step 4 specifically includes:

如果所述数据报文或控制报文将到达交换机的端口,则判断所述数据报文或控制报文的类型:If the data packet or the control packet will arrive at the port of the switch, then judge the type of the data packet or the control packet:

如果是洪泛指令类型的控制报文,则从所述控制报文中提取数据报文,并在所述扩展序列中加入所述数据报文和所述交换机的每一个数据端口;If it is a flood instruction type control message, extracting a data message from the control message, and adding the data message and each data port of the switch to the extended sequence;

如果是安装规则类型的控制报文,则记录所述安装规则,同时从所述控制报文中提取数据报文,并在所述扩展序列中加入所述数据报文和由所述安装规则指定的交换机的数据端口;If it is a control message of the installation rule type, record the installation rule, and extract the data message from the control message at the same time, and add the data message and the data message specified by the installation rule to the extended sequence The data port of the switch;

如果是与已记录的规则相匹配的数据报文,则在所述扩展序列中加入所述数据报文和由已记录的规则指定的交换机的数据端口;If it is a data packet matching the recorded rule, adding the data packet and the data port of the switch specified by the recorded rule to the extended sequence;

如果是与已记录的规则不相匹配的数据报文,则基于所述数据报文构造上报类型的控制报文,并在所述扩展序列中加入构造的控制报文和交换机的控制端口;If it is a data message that does not match the recorded rule, construct a control message of the reporting type based on the data message, and add the constructed control message and the control port of the switch to the extended sequence;

如果所述数据报文或控制报文将到达控制器的端口,则根据所述信息表扩展有限状态机模型中的组件状态机找到对应的控制报文,并在所述扩展序列中加入该控制报文和对应的控制器端口。If the data message or control message will arrive at the port of the controller, the component state machine in the finite state machine model is expanded according to the information table to find the corresponding control message, and the control message is added to the extended sequence Messages and corresponding controller ports.

优选地,所述步骤4还包括:如果所述数据报文或控制报文将到达主机的端口,则不对该数据报文或控制报文进行处理,直接按照存储的顺序,从所述扩展序列中获取下一条数据报文或控制报文以及对应的端口信息。Preferably, the step 4 further includes: if the data message or the control message will arrive at the port of the host, then do not process the data message or the control message, and directly follow the stored sequence from the extended sequence Obtain the next data packet or control packet and the corresponding port information.

优选地,在所述步骤3中,采用先进先出队列对所述扩展序列进行同步备份,并从所述先进先出队列中依次获取数据报文或控制报文以及对应的端口信息。Preferably, in the step 3, a first-in-first-out queue is used to synchronously back up the extended sequence, and data packets or control packets and corresponding port information are sequentially obtained from the first-in-first-out queue.

本申请的实施例还提供了一种软件定义网络应用测试序列的生成系统,包括模型生成模块,其设置为针对待测试软件定义网络应用构建信息表扩展有限状态机模型,所述信息表扩展有限状态机模型包括用于描述所述软件定义网络应用的行为的多个组件状态机、描述各组件状态机之间的连接的信道以及描述所述软件定义网络应用所针对的网络的网络拓扑;The embodiment of the present application also provides a generation system of a software-defined network application test sequence, including a model generation module, which is configured to build an information table extension finite state machine model for the software-defined network application to be tested, and the information table extension is limited The state machine model includes a plurality of component state machines for describing the behavior of the software-defined networking application, channels describing connections between the component state machines, and describing the network topology of the network for which the software-defined networking application is directed;

组合模块,其设置为基于所述多个组件状态机形成,仅针对所述网络拓扑中一个指定的交换机的组合的有限状态机;A combined module, configured to form a combined finite state machine for only one specified switch in the network topology based on the plurality of component state machines;

单结点测试序列生成模块,其设置为采用有限状态机模型的测试生成方法,基于所述组合的有限状态机生成针对所述指定的交换机的单结点测试序列,所述单结点测试序列包括该指定的交换机对所述待测试软件定义网络应用的输入消息与输出消息;A single-node test sequence generation module, which is configured to adopt a test generation method of a finite state machine model, generates a single-node test sequence for the specified switch based on the combined finite state machine, and the single-node test sequence Including the input message and output message of the designated switch to the software-defined network application to be tested;

多结点测试序列生成模块,其设置为在所述网络拓扑中模拟执行所述单结点测试序列,以将所述单结点测试序列扩展成多结点测试序列。A multi-node test sequence generation module is configured to simulate and execute the single-node test sequence in the network topology, so as to expand the single-node test sequence into a multi-node test sequence.

与现有技术相比,上述方案中的一个或多个实施例可以具有如下优点或有益效果:Compared with the prior art, one or more embodiments in the above solutions may have the following advantages or beneficial effects:

通过基于针对软件定义网络应用所生成的单结点测试序列与应用所在的网络的网络拓扑,对单结点测试序列进行模拟执行,得到针对软件定义网络应用的多结点测试序列,消除了现有技术中在对软件定义网络应用进行测试时,仅能测试单一网络实体,而脱离其所在网络的网络拓扑,不利于测试的缺陷。Based on the single-node test sequence generated for software-defined network applications and the network topology of the network where the application is located, the single-node test sequence is simulated and executed to obtain a multi-node test sequence for software-defined network applications, which eliminates the existing In the existing technology, when testing software-defined network applications, only a single network entity can be tested, and it is separated from the network topology of the network where it is located, which is not conducive to testing.

本发明的其他优点、目标,和特征在某种程度上将在随后的说明书中进行阐述,并且在某种程度上,基于对下文的考察研究对本领域技术人员而言将是显而易见的,或者可以从本发明的实践中得到教导。本发明的目标和其他优点可以通过下面的说明书,权利要求书,以及附图中所特别指出的结构来实现和获得。Other advantages, objects, and features of the present invention will be set forth in the ensuing description to some extent, and to some extent, will be obvious to those skilled in the art based on the investigation and research below, or can be Learn from the practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

附图说明Description of drawings

附图用来提供对本申请的技术方案或现有技术的进一步理解,并且构成说明书的一部分。其中,表达本申请实施例的附图与本申请的实施例一起用于解释本申请的技术方案,但并不构成对本申请技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solutions of the present application or the prior art, and constitute a part of the description. Wherein, the drawings expressing the embodiments of the present application are used together with the embodiments of the present application to explain the technical solutions of the present application, but do not constitute limitations on the technical solutions of the present application.

图1为根据本发明一实施例的软件定义网络应用测试序列的生成方法的流程示意图;FIG. 1 is a schematic flow diagram of a method for generating a software-defined network application test sequence according to an embodiment of the present invention;

图2为根据本发明一实施例的软件定义网络应用所在网络的结构示意图;FIG. 2 is a schematic structural diagram of a network where a software-defined network application is located according to an embodiment of the present invention;

图3为根据本发明一实施例的信息表扩展有限状态机模型的结构示意图;3 is a schematic structural diagram of an information table extended finite state machine model according to an embodiment of the present invention;

图4为根据本发明一实施例的对单结点测试序列中一输入消息进行模拟执行的流程示意图;FIG. 4 is a schematic flow diagram of simulating and executing an input message in a single-node test sequence according to an embodiment of the present invention;

图5为根据本发明另一实施例的软件定义网络应用测试序列的生成系统的结构示意图。FIG. 5 is a schematic structural diagram of a system for generating a software-defined network application test sequence according to another embodiment of the present invention.

具体实施方式Detailed ways

以下将结合附图及实施例来详细说明本发明的实施方式,借此对本发明如何应用技术手段来解决技术问题,并达成相应技术效果的实现过程能充分理解并据以实施。本申请实施例以及实施例中的各个特征,在不相冲突前提下可以相互结合,所形成的技术方案均在本发明的保护范围之内。The implementation of the present invention will be described in detail below in conjunction with the accompanying drawings and examples, so as to fully understand and implement the implementation process of how to apply technical means to solve technical problems and achieve corresponding technical effects in the present invention. The embodiments of the present application and the various features in the embodiments can be combined with each other under the premise of no conflict, and the formed technical solutions are all within the protection scope of the present invention.

图1为根据本发明一实施例的软件定义网络应用测试序列的生成方法的流程示意图,如图所示,该生成方法包括以下步骤:FIG. 1 is a schematic flow diagram of a method for generating a software-defined network application test sequence according to an embodiment of the present invention. As shown in the figure, the method for generating includes the following steps:

步骤S110、针对待测试软件定义网络应用构建信息表扩展有限状态机模型。Step S110, constructing an information table extended finite state machine model for the SDN application to be tested.

步骤S120、基于得到的信息表扩展有限状态机模型中的多个组件状态机,形成仅针对应用所在网络拓扑中一个指定的交换机的组合的有限状态机。Step S120, based on the obtained information table, expand multiple component state machines in the finite state machine model to form a combined finite state machine for only one specified switch in the network topology where the application is located.

步骤S130、采用有限状态机模型的测试生成方法,基于组合的有限状态机生成针对该指定的交换机的单结点测试序列。Step S130, using the test generation method of the finite state machine model to generate a single-node test sequence for the specified switch based on the combined finite state machine.

步骤S140、在应用所在网络拓扑中模拟执行单结点测试序列,以将单结点测试序列扩展成多结点测试序列。Step S140, simulating and executing a single-node test sequence in the network topology where the application is located, so as to expand the single-node test sequence into a multi-node test sequence.

在现有技术中,扩展有限状态机(Extended Finite State Machine,简称EFSM)广泛用于描述网络协议。但是,软件定义网络应用与其所在网络的拓扑结构关系密切,其具有网络的全局视图,而且工作过程中会修改网络的配置,影响网络的功能和行为,因此,在本发明的实施例中,提出一种结合扩展有限状态机和网络拓扑来描述软件定义网络应用的信息表扩展有限状态机模型。In the prior art, an extended finite state machine (Extended Finite State Machine, EFSM for short) is widely used to describe network protocols. However, a software-defined network application is closely related to the topology of the network where it is located. It has a global view of the network, and it will modify the configuration of the network during its work, which will affect the functions and behaviors of the network. Therefore, in the embodiments of the present invention, it is proposed An information-table extended finite state machine model that combines extended finite state machines and network topologies to describe software-defined network applications.

该信息表扩展有限状态机模型包括用于描述软件定义网络应用的行为的多个组件状态机、描述各组件状态机之间的连接的信道以及描述软件定义网络应用所针对的网络的网络拓扑。The information table extended finite state machine model includes a plurality of component state machines for describing the behavior of the software defined network application, channels describing the connection between the various component state machines, and describing the network topology of the network targeted by the software defined network application.

该信息表扩展有限状态机模型用IT表示。IT是一个三元组,IT=(M,Ch,To)。其中,M表示由n个组件状态机组成的集合,M={M0,M1,M2,...,Mn},其中,包括一个用于描述对软件定义网络应用输入消息进行信息提取和分发的状态机(记为M0),以及用于描述与软件定义网络应用中保存的信息表项一一对应的多个并行进程的多个扩展有限状态机。软件定义网络应用中的信息表项接收其内部分发器发来的信息,输出报文转发消息和安装规则消息到与交换机连接的端口。Ch表示用于连接各组件状态机的信道的有限集合。To表示M所在网络的网络拓扑。The information table extends the finite state machine model with IT. IT is a triplet, IT=(M, Ch, To). Wherein, M represents a set composed of n component state machines, M={M 0 , M 1 ,M 2 ,...,M n }, which includes an information used to describe the input message of the software-defined network application A state machine for extraction and distribution (denoted as M 0 ), and multiple extended finite state machines for describing multiple parallel processes that correspond one-to-one to information entries stored in the software-defined network application. The information entry in the software-defined network application receives the information sent by its internal distributor, and outputs the message forwarding message and the installation rule message to the port connected to the switch. Ch represents a finite set of channels used to connect the state machines of each component. To represents the network topology of the network where M resides.

每个扩展有限状态机Mi,i=1,...,n,与软件定义网络应用中保存的多个信息表项一一对应。Mi是一个六元数组,Mi={S,s0,V,I,O,T}。Each extended finite state machine M i , where i=1,...,n, corresponds to a plurality of information entries stored in the software-defined network application. M i is a six-element array, M i ={S,s 0 ,V,I,O,T}.

在六元组Mi中,S是Mi的有限状态集合;In the six-tuple M i , S is the finite state set of M i ;

s0∈S,是Mi的初始状态;s 0 ∈ S, is the initial state of Mi ;

V=(V1,V2,…Vk,…,Vn),其中Vk是Mi的变量,k=1,2,…,n,n为正整数,V是Mi所有变量的集合;V=(V 1 ,V 2 ,...V k ,...,V n ), where V k is the variable of M i , k=1,2,...,n, n is a positive integer, and V is the variable of all the variables of M i gather;

I=(I1,I2,…Ik,…,In),其中Ik是Mi的一个输入符号,k=1,2,…,n,n为正整数,I是Mi所有输入符号的集合,I为非空集合;I=(I 1 ,I 2 ,...I k ,...,In ), where I k is an input symbol of Mi , k=1,2,..., n , n is a positive integer, and I is all A set of input symbols, I is a non-empty set;

O=(O1,O2,…Ok,…,On),其中Ok是Mi的一个输出符号,k=1,2,…,n,n为正整数,O是Mi所有输出符号的集合,O为非空集合;O=(O 1 ,O 2 ,...O k ,...,On ), where O k is an output symbol of Mi , k=1,2,..., n , n is a positive integer, O is all A set of output symbols, O is a non-empty set;

T=(T1,T2,…Tk,…,Tn)是Mi所有变迁的集合,T为非空集合,其中Tk是Mi的一个变迁,k=1,2,…,n,n为正整数,Tk是一个六元组,Tk=(sstart,send,Ik,Ok,P,A);T=(T 1 ,T 2 ,...T k ,...,T n ) is the set of all transitions of Mi , T is a non-empty set, where T k is a transition of Mi , k=1,2,..., n, n is a positive integer, T k is a six-tuple, T k = (s start , s end , I k , O k , P, A);

在Tk的六元组中,sstart∈S,是Tk执行前的初始状态;send∈S,是Tk执行后的末状态;Ik∈I,是Tk执行所需要的输入参数;Ok∈O,是Tk执行所产生的输出结果;P是关于VI中的内部变量、VE中的外部变量、输入Ik和一些常量的谓词表达式,P说明了Tk执行的条件;A是Tk执行时的行为序列,A包括变量赋值行为和输出行为中的一项或多项,A中的多项行为按顺序执行。In the six-tuple of T k , s start S is the initial state before the execution of T k ; send ∈ S is the final state after the execution of T k ; I k ∈ I is the input required for the execution of T k Parameters; O k ∈ O, is the output result produced by the execution of T k ; P is the predicate expression about the internal variables in V I , the external variables in V E , the input I k and some constants, P explains T k Execution conditions; A is the behavior sequence when T k is executed, A includes one or more of the variable assignment behavior and output behavior, and multiple behaviors in A are executed in sequence.

信道的有限集合Ch中的每个信道将一个组件状态机与外部环境或其他状态机相连接。Each channel in the finite set Ch of channels connects a component state machine with the external environment or other state machines.

To是一个四元数组,其中的每个元素分别与网络中的各网络实体相对应,To=(H,SW,C,LK)。To is a quaternion array, each element of which corresponds to each network entity in the network, To=(H, SW, C, LK).

在四元组To中,H是主机的集合,每一个主机具有唯一的地址,与交换机连接,发送或接收数据报文。In the quadruple To, H is a collection of hosts, each host has a unique address, is connected to the switch, and sends or receives data packets.

SW是交换机的集合,每个交换机具有若干端口,分别连接主机、控制器和其他交换机。交换机记录控制器下发的安装规则,按照规则转发数据报文,如果收到规则无法匹配的数据报文,则发送给控制器。SW is a collection of switches, and each switch has several ports, which are respectively connected to hosts, controllers and other switches. The switch records the installation rules issued by the controller, forwards the data packets according to the rules, and sends the data packets to the controller if it receives a data packet that cannot be matched by the rules.

C是控制器的集合,控制器与交换机连接,两者之间进行控制报文的交互。控制器处理与交换机间的控制报文交互,包括发送安装规则给交换机,以及接收交换机无法匹配规则的数据报文。C is a collection of controllers, the controllers are connected to the switch, and control packets are exchanged between the two. The controller handles the interaction of control packets with the switch, including sending installation rules to the switch and receiving data packets that the switch cannot match the rules.

LK是链路集合,每一条链路可以用来连接同类或不同类的两个拓扑结点,如主机、交换机或控制器。LK is a collection of links, and each link can be used to connect two topological nodes of the same or different types, such as hosts, switches or controllers.

图2示出软件定义网络应用所在网络的结构示意图,该拓扑是示例性的拓扑结构,实际拓扑可能是包含软件定义网络应用、控制器、交换机、主机和连接它们的链路的多种不同组合之一。如图所示,图中21表示主机,22表示交换机,每个主机21都对应连接到一个交换机22。23表示控制器,其上运行有软件定义网络应用。实际中,软件定义网络应用可以工作在一个或多个控制器上,图2中仅以一个控制器作为示例性说明,但这并不构成对本发明的限定。Figure 2 shows a schematic diagram of the structure of the network where the software-defined network application is located. This topology is an exemplary topology structure. The actual topology may include various combinations of software-defined network applications, controllers, switches, hosts, and links connecting them. one. As shown in the figure, 21 in the figure represents a host, 22 represents a switch, and each host 21 is correspondingly connected to a switch 22. 23 represents a controller on which a software-defined network application runs. In practice, a software-defined network application may work on one or more controllers, and only one controller is used as an example for illustration in FIG. 2 , but this does not constitute a limitation of the present invention.

在图2中,主机21与交换机22之间、各交换机22之间的实线,以及控制器23与各交换机22之间的虚线均用于表示链路。其中,控制器23与各交换机22之间的链路用于传送控制报文,主要是控制消息的交互。而主机21与交换机22之间以及各交换机22之间的链路用于传送数据报文,主要是数据消息的交互。In FIG. 2 , the solid lines between the host 21 and the switches 22 and between the switches 22 , and the dotted lines between the controller 23 and the switches 22 are all used to represent links. Wherein, the links between the controller 23 and each switch 22 are used to transmit control messages, mainly for the interaction of control messages. The links between the host 21 and the switch 22 and between the switches 22 are used to transmit data packets, mainly for the interaction of data messages.

图3示出本发明一实施例的信息表扩展有限状态机模型的结构示意图,如图所示,分发器被建模为状态机M0,其主要用于处理交换机发往控制器的报文上交消息。各信息表项被分别建模为扩展有限状态机Mi,i=1,...,n。从图中还可以看出,每个信息表项实际上对应着不同的标号,标号的含义是,第一位数字表示的是所属网络中的交换机的编号,第二数字表示的是所属网络中的主机的编号。当各信息表项被分别建模为扩展有限状态机后,上述标号信息也会分别对应于不同的扩展有限状态机。Fig. 3 shows a schematic structural diagram of an information table extended finite state machine model according to an embodiment of the present invention. As shown in the figure, the distributor is modeled as a state machine M 0 , which is mainly used to process messages sent by the switch to the controller Turn in the message. Each information entry is modeled as an extended finite state machine M i , i=1,...,n. It can also be seen from the figure that each information table item actually corresponds to a different label. The meaning of the label is that the first number indicates the number of the switch in the network to which it belongs, and the second number indicates the number of the switch in the network to which it belongs. The number of the host. When each information entry is modeled as an extended finite state machine, the above label information will also correspond to different extended finite state machines.

分发器首先经由输入端口(逻辑端口)接收交换机的上报消息,并从中提取信息分发给一个或多个信息表项。由分发器指向各信息表项的实线表示的是信道,实线端部的箭头表示信息数据的传送方向。由信息表项指向输出端口(逻辑端口)的实线也表示信道,即组件状态机与外部环境之间相连接的信道,实线端部的箭头表示报文转发和安装规则等信息数据的传送方向。上述两类信道的全体构成信道的有限集合Ch。The distributor first receives the report message of the switch through an input port (logical port), extracts information from it, and distributes it to one or more information table items. The solid line pointing to each information entry from the distributor indicates the channel, and the arrow at the end of the solid line indicates the transmission direction of the information data. The solid line from the information table item to the output port (logical port) also represents the channel, that is, the channel connecting the component state machine with the external environment, and the arrow at the end of the solid line represents the transmission of information data such as message forwarding and installation rules direction. All of the above two types of channels constitute a finite set Ch of channels.

本发明实施例的信息表扩展有限状态机模型中,包括了软件定义网络应用所在网络的拓扑,能够更加准确地描述待测试的软件定义网络应用,有利于测试的进行。The extended finite state machine model of the information table in the embodiment of the present invention includes the topology of the network where the software-defined network application is located, which can more accurately describe the software-defined network application to be tested, and facilitates the testing.

接下来,在步骤S120中,首先在网络拓扑中任意指定一个交换机,并从网络拓扑中选取至少两个相互通信的主机。然后,在信息表扩展有限状态机模型中找到与所选取的相互通信的主机分别对应的,且针对指定的交换机的至少两个组件状态机。再将找到的至少两个组件状态机进行组合,以形成组合的有限状态机。具体的,可以通过与扩展有限状态机对应的标号进行寻找。Next, in step S120, first a switch is arbitrarily designated in the network topology, and at least two hosts communicating with each other are selected from the network topology. Then, in the extended finite state machine model of the information table, at least two component state machines respectively corresponding to the selected hosts communicating with each other and aimed at the designated switch are found. The found at least two component state machines are then combined to form a combined finite state machine. Specifically, it can be searched through the label corresponding to the extended finite state machine.

举例而言,从图2所示的网络拓扑中指定交换机1,并从其中选取相互通信的主机1与主机4,则从信息表扩展有限状态机模型中找到两个组件状态机分别为,与交换机(1,1)信息表项对应的组件状态机以及与交换机(1,4)信息表项对应的组件状态机,再将两个找到的组件状态机进行组合,以得到组合的有限状态机。组合的有限状态机的每一个状态是上述两个组件状态机的状态集合及变量集合的组合。For example, if switch 1 is specified from the network topology shown in Figure 2, and host 1 and host 4 that communicate with each other are selected from it, then two component state machines are found from the extended finite state machine model of the information table, and The component state machine corresponding to the switch (1,1) information table item and the component state machine corresponding to the switch (1,4) information table item, and then combine the two found component state machines to obtain the combined finite state machine . Each state of the combined finite state machine is a combination of the state sets and variable sets of the above two component state machines.

需要说明的是,在选取相互通信的主机时,为减缓状态空间的爆炸问题,优选为选取两个相互通信的主机。It should be noted that when selecting hosts that communicate with each other, in order to alleviate the problem of state space explosion, it is preferable to select two hosts that communicate with each other.

生成的组合的有限状态机是仅针对一个指定的交换机的模型,在步骤S130中,采用有限状态机模型的测试生成方法,生成覆盖组合的有限状态机的单结点测试序列。单结点测试序列由同一个交换机对待测的软件定义网络应用的输入消息与输出消息组成。其中,所采用的有限状态机测试生成方法,可以是任意一种现在已有或未来可能提出的能够基于有限状态机模型生成测试序列的方法,本发明实施例中对此不作限定。The generated combined finite state machine is a model for only one designated switch. In step S130, a test generation method for the finite state machine model is used to generate a single-node test sequence covering the combined finite state machine. A single-node test sequence consists of incoming and outgoing messages from the same switch for the SDN application under test. Wherein, the finite state machine test generation method used may be any existing or future method capable of generating a test sequence based on a finite state machine model, which is not limited in this embodiment of the present invention.

在步骤S140中,由单结点测试序列扩展得到多结点测试序列进一步包括,依次取出单结点测试序列中的每一个输入消息,并分别针对取出的输入消息生成扩展序列。连接与单结点测试序列中的每一个输入消息对应的各扩展序列,以形成多结点测试序列。对单结点测试序列中一输入消息进行模拟执行的过程如图4所示,下面结合图4进行详细说明。In step S140 , extending the single-node test sequence to obtain the multi-node test sequence further includes sequentially extracting each input message in the single-node test sequence, and generating extended sequences for the extracted input messages respectively. The spreading sequences corresponding to each input message in the single-node test sequence are concatenated to form a multi-node test sequence. The process of simulating and executing an input message in a single-node test sequence is shown in FIG. 4 , and will be described in detail below in conjunction with FIG. 4 .

首先,为单结点测试序列中的一个输入消息初始化一个扩展输入序列的存储空间,以及从该输入消息中提取主机的数据报文和端口信息,并将数据报文和端口信息加入扩展序列中,如图4中步骤S410所示。然后,按照存储的顺序,依次从扩展序列中获取数据报文或控制报文以及对应的端口信息,并通过对数据报文或控制报文以及对应的端口信息的判断,来对扩展序列进行更新。First, initialize an extended input sequence storage space for an input message in the single-node test sequence, and extract the data packet and port information of the host from the input message, and add the data packet and port information to the extended sequence , as shown in step S410 in FIG. 4 . Then, according to the order of storage, the data message or control message and the corresponding port information are sequentially obtained from the extended sequence, and the extended sequence is updated by judging the data message or control message and the corresponding port information .

具体的,可以采用先进先出队列对扩展序列进行同步备份,利用其先进先出的特性,依次获取数据报文或控制报文以及对应的端口信息来实现对扩展序列的模拟。Specifically, the extended sequence can be synchronously backed up by using the first-in-first-out queue, and the extended sequence can be simulated by sequentially obtaining data packets or control packets and corresponding port information by using its first-in-first-out feature.

设先进先出队列为Q,将扩展序列中的元素放入先进先出队列Q中。接下来在步骤S420中,判断队列Q是否为空,如果队列Q为空,则结束模拟执行的过程。如果队列Q不为空,则从Q中取出一个数据报文或控制报文,并对数据报文或控制报文将到达的端口的类型与其自身的类型进行判断,如图4中步骤S430所示。通过对对数据报文或控制报文将到达的端口的类型与其自身的类型的判断,确定对数据报文或控制报文的具体处理,并将对应的处理结果(一般为新的数据报文或控制报文以及对应的端口信息)加入到扩展序列中。Let the first-in-first-out queue be Q, and put the elements in the extended sequence into the first-in-first-out queue Q. Next in step S420, it is judged whether the queue Q is empty, and if the queue Q is empty, the simulation execution process ends. If queue Q is not empty, then take out a data message or control message from Q, and the type of the port that data message or control message will arrive and its own type are judged, as shown in step S430 among Fig. 4 Show. By judging the type of the port where the data message or the control message will arrive and its own type, the specific processing of the data message or the control message is determined, and the corresponding processing result (usually a new data message) or control packets and corresponding port information) are added to the extended sequence.

先对数据报文或控制报文将到达的端口的类型进行判断,当数据报文或控制报文将到达交换机的端口时,再对数据报文或控制报文的类型进行判断:First judge the type of the port where the data packet or control packet will arrive, and then judge the type of the data packet or control packet when the data packet or control packet will arrive at the port of the switch:

当报文为洪泛指令类型的控制报文时,从该控制报文中提取数据报文,并在扩展序列中加入提取得到的数据报文和交换机的每一个数据端口,如图4中步骤S440所示。另外,对于新加入扩展序列中的各项,还需要在队列Q中进行同步备份。When the message is a control message of the flood command type, extract the data message from the control message, and add the extracted data message and each data port of the switch to the extended sequence, as shown in the steps in Figure 4 S440 shown. In addition, for items newly added to the extended sequence, a synchronous backup needs to be performed in the queue Q.

当报文为安装规则类型的控制报文时,记录安装规则,同时从该控制报文中提取数据报文,并在扩展序列中加入提取得到的数据报文和由安装规则指定的交换机的数据端口,如图4中步骤S450所示。对于新加入扩展序列中的各项,在队列Q中进行同步备份。When the message is a control message of the installation rule type, record the installation rule, extract the data message from the control message at the same time, and add the extracted data message and the data of the switch specified by the installation rule to the extended sequence port, as shown in step S450 in FIG. 4 . Synchronous backups are performed in queue Q for items newly added to the extended sequence.

当报文为与已记录的规则相匹配的数据报文时,在扩展序列中加入该数据报文和由已记录的规则指定的交换机的数据端口,如图4中步骤S460所示。对于新加入扩展序列中的各项,在队列Q中进行同步备份。When the message is a data message matching the recorded rule, add the data message and the data port of the switch specified by the recorded rule to the extended sequence, as shown in step S460 in FIG. 4 . Synchronous backups are performed in queue Q for items newly added to the extended sequence.

当报文为与已记录的规则不相匹配的数据报文时,基于该数据报文构造上报类型的控制报文,并在扩展序列中加入构造的控制报文和交换机的控制端口,如图4中步骤S470所示。对于新加入扩展序列中的各项,在队列Q中进行同步备份。When the message is a data message that does not match the recorded rules, a control message of the reported type is constructed based on the data message, and the constructed control message and the control port of the switch are added to the extended sequence, as shown in the figure 4 in step S470. Synchronous backups are performed in queue Q for items newly added to the extended sequence.

当数据报文或控制报文将到达的端口不是交换机的端口,而是控制器的端口时,根据信息表扩展有限状态机模型中的组件状态机找到对应的控制报文,并在扩展序列中加入该控制报文和对应的控制器端口,如图4中步骤S480所示。对于新加入扩展序列中的各项,在队列Q中进行同步备份。When the port where the data message or control message will arrive is not the port of the switch but the port of the controller, the component state machine in the extended finite state machine model of the information table is used to find the corresponding control message, and in the extended sequence Add the control message and the corresponding controller port, as shown in step S480 in FIG. 4 . Synchronous backups are performed in queue Q for items newly added to the extended sequence.

在对上述各步骤择一执行后,返回判断队列Q是否为空,若不为空,则重复执行上述模拟过程,直至队列Q为空。After executing one of the above steps, return to judge whether the queue Q is empty, if not, repeat the above simulation process until the queue Q is empty.

另外,当数据报文或控制报文将到达的端口不是交换机的端口,也不是控制器的端口,而是直接到达主机的端口时,不需要对数据报文或控制报文进行处理,直接按照存储的顺序,从队列Q中获取下一条数据报文或控制报文以及对应的端口信息,如图4中步骤S490所示。In addition, when the port where the data packet or control packet will arrive is not the port of the switch or the port of the controller, but directly arrives at the port of the host, there is no need to process the data packet or control packet, and the The order of storage is to obtain the next data packet or control packet and the corresponding port information from the queue Q, as shown in step S490 in FIG. 4 .

在完成对扩展序列中所存储的全部数据报文或控制报文的处理后,以最终存储在扩展序列中的全部内容作为一个输入消息对应的扩展序列。After the processing of all data packets or control packets stored in the extended sequence is completed, all the content finally stored in the extended sequence is used as an extended sequence corresponding to an input message.

在本发明的实施例中,通过引入信息表扩展有限状态机模型准确地描述了软件定义网络应用与其所针对的网络的拓扑结构,通过基于单结点测试序列使用拓扑模拟执行扩展多结点测试序列,实现了对网络拓扑结点的测试覆盖。In the embodiment of the present invention, the extended finite state machine model accurately describes the topology of the software-defined network application and its target network by introducing an information table, and performs extended multi-node testing by using topology simulation based on a single-node test sequence The sequence realizes the test coverage of the network topology nodes.

本发明实施例的用于生成针对软件定义网络应用的测试序列的方法,可以生成覆盖多个网络结点的测试序列,同时能够减缓状态空间爆炸问题。The method for generating a test sequence for a software-defined network application in the embodiment of the present invention can generate a test sequence covering multiple network nodes, and at the same time, can alleviate the state space explosion problem.

在本发明的另一个实施例中,提供了一种软件定义网络应用测试序列的生成系统,如图5所示,包括模型生成模块51,其用于执行步骤S110的动作;组合模块52,其用于执行步骤S120的动作;单结点测试序列生成模块53,其用于执行步骤S130的动作;多结点测试序列生成模块54,其用于执行步骤S140的动作。相关模块的功能可根据前述实施例得出,此处不再赘述。In another embodiment of the present invention, a system for generating a software-defined network application test sequence is provided, as shown in FIG. For performing the action of step S120; the single-node test sequence generation module 53, which is used for performing the action of step S130; the multi-node test sequence generation module 54, for performing the action of step S140. The functions of the relevant modules can be obtained according to the foregoing embodiments, and will not be repeated here.

虽然本发明所揭露的实施方式如上,但所述的内容只是为了便于理解本发明而采用的实施方式,并非用以限定本发明。任何本发明所属技术领域内的技术人员,在不脱离本发明所揭露的精神和范围的前提下,可以在实施的形式上及细节上作任何的修改与变化,但本发明的专利保护范围,仍须以所附的权利要求书所界定的范围为准。Although the embodiments disclosed in the present invention are as above, the described content is only an embodiment adopted for the convenience of understanding the present invention, and is not intended to limit the present invention. Anyone skilled in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed by the present invention, but the patent protection scope of the present invention, The scope defined by the appended claims must still prevail.

Claims (8)

1.一种软件定义网络应用测试序列的生成方法,包括:1. A method for generating a software-defined network application test sequence, comprising: 针对待测试软件定义网络应用构建信息表扩展有限状态机模型,所述信息表扩展有限状态机模型包括用于描述所述软件定义网络应用的行为的多个组件状态机、描述各组件状态机之间的连接的信道以及描述所述软件定义网络应用所针对的网络的网络拓扑;An information table extended finite state machine model is constructed for the software-defined network application to be tested, and the information table extended finite state machine model includes a plurality of component state machines for describing the behavior of the software-defined network application, and a state machine describing each component state machine and a network topology describing the network for which the software-defined network application is targeted; 基于所述多个组件状态机,形成仅针对所述网络拓扑中一个指定的交换机的组合的有限状态机;forming a combined finite state machine for only one specified switch in the network topology based on the plurality of component state machines; 采用有限状态机模型的测试生成方法,基于所述组合的有限状态机生成针对所述指定的交换机的单结点测试序列,所述单结点测试序列包括该指定的交换机对所述待测试软件定义网络应用的输入消息与输出消息;A test generation method using a finite state machine model generates a single-node test sequence for the specified switch based on the combined finite state machine, and the single-node test sequence includes the specified switch for the software to be tested Define the input and output messages of the network application; 在所述网络拓扑中模拟执行所述单结点测试序列,以将所述单结点测试序列扩展成多结点测试序列,包括:Simulating and executing the single-node test sequence in the network topology to expand the single-node test sequence into a multi-node test sequence, including: 依次取出所述单结点测试序列中的每一个输入消息,并分别针对取出的输入消息生成扩展序列;Taking out each input message in the single-node test sequence in turn, and generating an extended sequence for the taken-out input message; 连接与所述单结点测试序列中的每一个输入消息对应的各扩展序列,以形成多结点测试序列;concatenating the spreading sequences corresponding to each input message in the single-node test sequence to form a multi-node test sequence; 其中,所述针对取出的输入消息生成扩展序列,包括:Wherein, the generation of the extended sequence for the fetched input message includes: 步骤1、为待生成的所述扩展序列初始化存储空间;Step 1. Initialize storage space for the extended sequence to be generated; 步骤2、从所述输入消息中提取主机的数据报文和端口信息,并将所述数据报文和端口信息加入所述扩展序列中;Step 2, extracting the data packet and port information of the host from the input message, and adding the data packet and port information to the extended sequence; 步骤3、按照存储的顺序,依次从所述扩展序列中获取数据报文或控制报文以及对应的端口信息;Step 3, according to the order of storage, sequentially obtain data packets or control packets and corresponding port information from the extended sequence; 步骤4、基于所述数据报文或控制报文将到达的端口的类型与其自身的类型,确定对所述数据报文或控制报文的处理,以得到新的数据报文或控制报文以及对应的端口信息,并将得到的新的数据报文或控制报文以及对应的端口信息加入所述扩展序列中;Step 4, based on the type of the port where the data message or control message will arrive and its own type, determine the processing of the data message or control message to obtain a new data message or control message and Corresponding port information, and adding the obtained new data message or control message and corresponding port information into the extended sequence; 步骤5、重复执行步骤3与步骤4,直至完成对所述扩展序列中所存储的数据报文或控制报文的处理,并以最终存储在所述扩展序列中的全部内容作为一个扩展序列。Step 5. Repeat step 3 and step 4 until the processing of the data packets or control packets stored in the spreading sequence is completed, and all the content finally stored in the spreading sequence is used as a spreading sequence. 2.根据权利要求1所述的生成方法,其特征在于,所述多个组件状态机包括用于描述与所述软件定义网络应用中保存的多个信息表项一一对应的多个并行进程的多个扩展有限状态机,所述扩展有限状态机包括初始状态、状态集合、变量集合、输入符号集合、输出符号集合与变迁集合。2. The generation method according to claim 1, wherein the plurality of component state machines include a plurality of parallel processes used to describe a one-to-one correspondence with a plurality of information entries stored in the software-defined network application A plurality of extended finite state machines, the extended finite state machine includes an initial state, a state set, a variable set, an input symbol set, an output symbol set, and a transition set. 3.根据权利要求1或2所述的生成方法,其特征在于,所述描述所述软件定义网络应用所针对的网络的网络拓扑,包括用于描述所述网络中各网络实体的数组,所述数组中的各个元素分别对应于所述网络中的主机的集合、交换机的集合、控制器的集合与用于连接主机、交换机以及控制器的链路的集合。3. The generating method according to claim 1 or 2, wherein the description of the network topology of the network targeted by the software-defined network application includes an array for describing each network entity in the network, the Each element in the array respectively corresponds to a set of hosts, a set of switches, a set of controllers, and a set of links used to connect the hosts, switches, and controllers in the network. 4.根据权利要求3所述的生成方法,其特征在于,所述基于所述多个组件状态机,形成仅针对所述网络拓扑中一个指定的交换机的组合的有限状态机,包括:4. The generating method according to claim 3, wherein, based on the plurality of component state machines, forming a combined finite state machine only for a specified switch in the network topology comprises: 在所述网络拓扑中指定一个交换机;specifying a switch in said network topology; 从所述网络拓扑中选取至少两个相互通信的主机,并在所述多个组件状态机中找到与所述相互通信的主机分别对应的,且针对指定的所述交换机的至少两个组件状态机;Select at least two hosts that communicate with each other from the network topology, and find at least two component states corresponding to the hosts that communicate with each other and for the specified switch in the plurality of component state machines machine; 组合所述至少两个组件状态机以形成组合的有限状态机,所述组合的有限状态机的每一个状态是所述至少两个组件状态机的状态集合及变量集合的组合。The at least two component state machines are combined to form a combined finite state machine, each state of the combined finite state machine being a combination of a set of states and a set of variables of the at least two component state machines. 5.根据权利要求1所述的生成方法,其特征在于,所述步骤4具体包括:5. generation method according to claim 1, is characterized in that, described step 4 specifically comprises: 如果所述数据报文或控制报文将到达交换机的端口,则判断所述数据报文或控制报文的类型:If the data packet or the control packet will arrive at the port of the switch, then judge the type of the data packet or the control packet: 如果是洪泛指令类型的控制报文,则从所述控制报文中提取数据报文,并在所述扩展序列中加入所述数据报文和所述交换机的每一个数据端口;If it is a flood instruction type control message, extracting a data message from the control message, and adding the data message and each data port of the switch to the extended sequence; 如果是安装规则类型的控制报文,则记录所述安装规则,同时从所述控制报文中提取数据报文,并在所述扩展序列中加入所述数据报文和由所述安装规则指定的交换机的数据端口;If it is a control message of the installation rule type, record the installation rule, and extract the data message from the control message at the same time, and add the data message and the data message specified by the installation rule to the extended sequence The data port of the switch; 如果是与已记录的规则相匹配的数据报文,则在所述扩展序列中加入所述数据报文和由已记录的规则指定的交换机的数据端口;If it is a data packet matching the recorded rule, adding the data packet and the data port of the switch specified by the recorded rule to the extended sequence; 如果是与已记录的规则不相匹配的数据报文,则基于所述数据报文构造上报类型的控制报文,并在所述扩展序列中加入构造的控制报文和交换机的控制端口;如果所述数据报文或控制报文将到达控制器的端口,则根据所述信息表扩展有限状态机模型中的组件状态机找到对应的控制报文,并在所述扩展序列中加入该控制报文和对应的控制器端口。If it is a data message that does not match the recorded rule, construct a control message of the reporting type based on the data message, and add the constructed control message and the control port of the switch to the extended sequence; if The data message or the control message will arrive at the port of the controller, then find the corresponding control message according to the component state machine in the extended finite state machine model of the information table, and add the control message to the extended sequence file and the corresponding controller port. 6.根据权利要求5所述的生成方法,其特征在于,所述步骤4还包括:如果所述数据报文或控制报文将到达主机的端口,则不对该数据报文或控制报文进行处理,直接按照存储的顺序,从所述扩展序列中获取下一条数据报文或控制报文以及对应的端口信息。6. The generating method according to claim 5, characterized in that, said step 4 further comprises: if said data message or control message will arrive at the port of the host computer, then the data message or control message will not be processed. Processing, directly according to the order of storage, obtain the next data message or control message and corresponding port information from the extended sequence. 7.根据权利要求1所述的生成方法,其特征在于,在所述步骤3中,采用先进先出队列对所述扩展序列进行同步备份,并从所述先进先出队列中依次获取数据报文或控制报文以及对应的端口信息。7. The generating method according to claim 1, characterized in that, in said step 3, said extended sequence is synchronously backed up by using a first-in-first-out queue, and datagrams are sequentially obtained from said first-in-first-out queue text or control packets and the corresponding port information. 8.一种软件定义网络应用测试序列的生成系统,包括:8. A system for generating software-defined network application test sequences, comprising: 模型生成模块,其设置为针对待测试软件定义网络应用构建信息表扩展有限状态机模型,所述信息表扩展有限状态机模型包括用于描述所述软件定义网络应用的行为的多个组件状态机、描述各组件状态机之间的连接的信道以及描述所述软件定义网络应用所针对的网络的网络拓扑;A model generation module, which is configured to construct an information table extended finite state machine model for the software-defined network application to be tested, and the information table extended finite state machine model includes a plurality of component state machines for describing the behavior of the software-defined network application , describing the channel of the connection between the state machines of each component and describing the network topology of the network targeted by the software-defined network application; 组合模块,其设置为基于所述多个组件状态机形成,仅针对所述网络拓扑中一个指定的交换机的组合的有限状态机;A combined module, configured to form a combined finite state machine for only one specified switch in the network topology based on the plurality of component state machines; 单结点测试序列生成模块,其设置为采用有限状态机模型的测试生成方法,基于所述组合的有限状态机生成针对所述指定的交换机的单结点测试序列,所述单结点测试序列包括该指定的交换机对所述待测试软件定义网络应用的输入消息与输出消息;A single-node test sequence generation module, which is configured to adopt a test generation method of a finite state machine model, generates a single-node test sequence for the specified switch based on the combined finite state machine, and the single-node test sequence Including the input message and output message of the designated switch to the software-defined network application to be tested; 多结点测试序列生成模块,其设置为在所述网络拓扑中模拟执行所述单结点测试序列,以将所述单结点测试序列扩展成多结点测试序列,包括:A multi-node test sequence generation module, which is configured to simulate and execute the single-node test sequence in the network topology, to expand the single-node test sequence into a multi-node test sequence, including: 依次取出所述单结点测试序列中的每一个输入消息,并分别针对取出的输入消息生成扩展序列;Taking out each input message in the single-node test sequence in turn, and generating an extended sequence for the taken-out input message; 连接与所述单结点测试序列中的每一个输入消息对应的各扩展序列,以形成多结点测试序列;concatenating the spreading sequences corresponding to each input message in the single-node test sequence to form a multi-node test sequence; 其中,所述针对取出的输入消息生成扩展序列,包括:Wherein, the generation of the extended sequence for the fetched input message includes: 步骤1、为待生成的所述扩展序列初始化存储空间;Step 1. Initialize storage space for the extended sequence to be generated; 步骤2、从所述输入消息中提取主机的数据报文和端口信息,并将所述数据报文和端口信息加入所述扩展序列中;Step 2, extracting the data packet and port information of the host from the input message, and adding the data packet and port information to the extended sequence; 步骤3、按照存储的顺序,依次从所述扩展序列中获取数据报文或控制报文以及对应的端口信息;Step 3, according to the order of storage, sequentially obtain data packets or control packets and corresponding port information from the extended sequence; 步骤4、基于所述数据报文或控制报文将到达的端口的类型与其自身的类型,确定对所述数据报文或控制报文的处理,以得到新的数据报文或控制报文以及对应的端口信息,并将得到的新的数据报文或控制报文以及对应的端口信息加入所述扩展序列中;Step 4, based on the type of the port where the data message or control message will arrive and its own type, determine the processing of the data message or control message to obtain a new data message or control message and Corresponding port information, and adding the obtained new data message or control message and corresponding port information into the extended sequence; 步骤5、重复执行步骤3与步骤4,直至完成对所述扩展序列中所存储的数据报文或控制报文的处理,并以最终存储在所述扩展序列中的全部内容作为一个扩展序列。Step 5. Repeat step 3 and step 4 until the processing of the data packets or control packets stored in the extension sequence is completed, and all the content finally stored in the extension sequence is used as an extension sequence.
CN201710606520.0A 2017-07-24 2017-07-24 Method and system for generating software-defined network application test sequences Active CN107566098B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710606520.0A CN107566098B (en) 2017-07-24 2017-07-24 Method and system for generating software-defined network application test sequences

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710606520.0A CN107566098B (en) 2017-07-24 2017-07-24 Method and system for generating software-defined network application test sequences

Publications (2)

Publication Number Publication Date
CN107566098A CN107566098A (en) 2018-01-09
CN107566098B true CN107566098B (en) 2019-10-18

Family

ID=60973743

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710606520.0A Active CN107566098B (en) 2017-07-24 2017-07-24 Method and system for generating software-defined network application test sequences

Country Status (1)

Country Link
CN (1) CN107566098B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110531963B (en) * 2019-08-28 2021-05-07 上海交通大学 Industrial software system behavior model reduction method based on data
CN111382066B (en) * 2019-11-17 2023-04-14 海南大学 A method for testing security attributes of software-defined network applications under development
CN113704093B (en) * 2021-08-05 2024-07-05 卡斯柯信号(成都)有限公司 Universal interlocking software test case generation method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1578259A (en) * 1999-06-30 2005-02-09 倾向探测公司 Method and apparatus for monitoring traffic in network
CN101022374A (en) * 2007-03-06 2007-08-22 中兴通讯股份有限公司 Method and system for on-line testing data network quality
CN101094112A (en) * 2007-07-23 2007-12-26 华为技术有限公司 Method, device and system for testing performance of route protocol of network device
CN101110765A (en) * 2007-06-01 2008-01-23 清华大学 Method of Supporting Multiple Quality of Service Based on OSPF Protocol
CN101383822A (en) * 2008-07-10 2009-03-11 北京邮电大学 Aviation Telecommunications Network Router Virtual Machine
CN104243243A (en) * 2014-10-14 2014-12-24 清华大学 Method for generating protocol testing sequence

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7813292B2 (en) * 2005-08-01 2010-10-12 Lamprey Networks, Inc. Communication protocol testing system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1578259A (en) * 1999-06-30 2005-02-09 倾向探测公司 Method and apparatus for monitoring traffic in network
CN101022374A (en) * 2007-03-06 2007-08-22 中兴通讯股份有限公司 Method and system for on-line testing data network quality
CN101110765A (en) * 2007-06-01 2008-01-23 清华大学 Method of Supporting Multiple Quality of Service Based on OSPF Protocol
CN101094112A (en) * 2007-07-23 2007-12-26 华为技术有限公司 Method, device and system for testing performance of route protocol of network device
CN101383822A (en) * 2008-07-10 2009-03-11 北京邮电大学 Aviation Telecommunications Network Router Virtual Machine
CN104243243A (en) * 2014-10-14 2014-12-24 清华大学 Method for generating protocol testing sequence

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《基于802.11FHSS标准的无线CBTC系统高速漫游研究及测试》;卢晓宇;《城市轨道交通研究》;20141030;全文 *
《网络控制系统的控制器与通信协议的研究与设计》;吉顺平;《中国优秀硕士论文电子期刊》;20091201;全文 *

Also Published As

Publication number Publication date
CN107566098A (en) 2018-01-09

Similar Documents

Publication Publication Date Title
US9628339B1 (en) Network testbed creation and validation
CN108737149A (en) Network topology real machine simulation method and system
CN107566098B (en) Method and system for generating software-defined network application test sequences
CN104954166A (en) Hardware based network simulation system and method
CN107483284A (en) Method and device for testing network equipment
CN106452850A (en) SDN controller performance testing method and system
CN110838954A (en) A lightweight and large-scale autonomous network protocol functional testing method
CN114584354B (en) A method and system for constructing a network security training platform
CN113518012B (en) A method and system for constructing a distributed collaborative traffic simulation environment
CN114553752A (en) Network performance testing method, device and computer equipment based on simulation software
CN118250180A (en) Routing simulation system and method based on container
CN106130897A (en) Performance optimization method based on Router Simulation
CN107579792B (en) Multi-model in-orbit satellite engineering parameter parallel analysis method
US9329960B2 (en) Methods, systems, and computer readable media for utilizing abstracted user-defined data to conduct network protocol testing
CN101674205B (en) Method and device for generating network communication protocol test sequence based on finite-state machine
CN113162816B (en) A kind of switch OSPFv3 protocol test method and test system
CN103117880A (en) Web technology based network topological generation method
CN112217680B (en) Controller capability benchmark test method and device based on software-defined wide area network
CN109687985B (en) Automatic configuration method and system for process level network of transformer substation
CN111935767B (en) Network simulation system
CN105323109B (en) Interconnection network simulator and method for simulating interconnection network
CN106789449A (en) A kind of CAN exploitation and method of testing and system
CN111209236A (en) A communication method for multi-level cascade expanders
CN112436904B (en) Application communication test system and method
CN112437461B (en) Application communication test system and method

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
GR01 Patent grant
GR01 Patent grant