[go: up one dir, main page]

CN110990112B - Method and device for realizing interface simulation platform - Google Patents

Method and device for realizing interface simulation platform Download PDF

Info

Publication number
CN110990112B
CN110990112B CN201911052394.4A CN201911052394A CN110990112B CN 110990112 B CN110990112 B CN 110990112B CN 201911052394 A CN201911052394 A CN 201911052394A CN 110990112 B CN110990112 B CN 110990112B
Authority
CN
China
Prior art keywords
sai
interface
implementation
logic
simulation platform
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
CN201911052394.4A
Other languages
Chinese (zh)
Other versions
CN110990112A (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.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN201911052394.4A priority Critical patent/CN110990112B/en
Publication of CN110990112A publication Critical patent/CN110990112A/en
Application granted granted Critical
Publication of CN110990112B publication Critical patent/CN110990112B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method and a device for realizing an interface simulation platform, wherein the method comprises the following steps: when the network operating system is verified to be adapted to the bottom chip driver through the middleware interface, a general test program compiling mode is provided through an automatic full-test framework, and a software simulation platform is constructed; and testing the functions of all the modules of the middleware interface integrally through the simulation platform. The embodiment of the invention can accelerate the iteration and development speed of the middleware software through the simulation platform, thereby accelerating the project progress.

Description

一种接口仿真平台的实现方法和装置Implementation method and device of an interface simulation platform

技术领域technical field

本发明涉及网络技术,尤指一种接口仿真平台的实现方法和装置。The invention relates to network technology, in particular to a method and device for realizing an interface simulation platform.

背景技术Background technique

在交换机领域,网络操作系统(Network Operating System,NOS)和交换机芯片驱动之间的适配层一直是一个重要的组件。该适配层的存在可以实现上层NOS和底层交换芯片及交换芯片驱动之间的解耦,也就意味着同一个NOS可以适配到不同的交换芯片硬件,同时,不同的NOS可以适配到同一个交换芯片硬件上。交换机抽象接口(Switch AbstractionInterface,SAI)层作为一种开放式的控制层面适配层受到众多交换机厂商的认可,SAI具有开放、标准化等诸多优点。SAI层可以屏蔽掉不同交换芯片厂商驱动层之间的差异,对上层的NOS提供统一的调用模式和接口。因此,快速迭代、验证SAI的功能性实现就显得尤为重要。In the switch field, the adaptation layer between the network operating system (Network Operating System, NOS) and the switch chip driver has always been an important component. The existence of this adaptation layer can realize the decoupling between the upper layer NOS and the bottom switch chip and the switch chip driver, which means that the same NOS can be adapted to different switch chip hardware, and different NOS can be adapted to the On the same switch chip hardware. As an open control plane adaptation layer, the switch abstraction interface (Switch Abstraction Interface, SAI) layer is recognized by many switch manufacturers. SAI has many advantages such as openness and standardization. The SAI layer can shield the differences between the driver layers of different switch chip manufacturers, and provide a unified calling mode and interface for the upper-layer NOS. Therefore, it is particularly important to quickly iterate and verify the functional implementation of SAI.

目前,存在SAI接口的仿真技术,不过这部分技术方案不具备完整性,无法满足具体的开发、验证需求。传统方法是基于一款具体的交换芯片硬件,从NOS调用一直验证到硬件交换芯片驱动层实现,来验证整个功能逻辑是否正常。然而,如果依赖于实际的交换芯片硬件进行SAI接口的验证和开发的话,可能会存在迷失在硬件驱动的细节当中,无法从宏观角度掌握SAI的设计和开发。At present, there is a simulation technology for the SAI interface, but this part of the technical solution is not complete and cannot meet the specific development and verification requirements. The traditional method is based on a specific switch chip hardware, from the NOS call to the implementation of the hardware switch chip driver layer to verify whether the entire functional logic is normal. However, if the verification and development of the SAI interface depends on the actual switching chip hardware, it may be lost in the details of the hardware driver, and it is impossible to grasp the design and development of SAI from a macro perspective.

因此,现有技术目前存在的SAI接口仿真技术存在SAI接口仿真覆盖度低、针对特定功能仿真系统化程度低的缺点。Therefore, the current SAI interface simulation technology in the prior art has the disadvantages of low coverage of SAI interface simulation and low degree of systematization for specific function simulation.

发明内容Contents of the invention

为了解决上述技术问题,本发明实施例提供了一种接口仿真平台的实现方法和装置,通过所述仿真平台可以加速中间件软件的迭代、开发速度,从而加快项目进展。In order to solve the above technical problems, the embodiment of the present invention provides a method and device for implementing an interface simulation platform, through which the simulation platform can accelerate the iteration and development speed of middleware software, thereby accelerating the project progress.

为了达到本发明目的,一方面,本发明实施例提供了一种接口仿真平台的实现方法,包括:In order to achieve the purpose of the present invention, on the one hand, the embodiment of the present invention provides an implementation method of an interface simulation platform, including:

当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;When verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, a general test program writing mode is provided through the automated full test framework to build a software simulation platform;

通过所述仿真平台整体测试所述中间件接口各个模块的功能。The function of each module of the middleware interface is tested as a whole through the simulation platform.

进一步地,所述中间件接口为交换机抽象接口SAI,其中,Further, the middleware interface is a switch abstract interface SAI, wherein,

当验证从网络操作系统NOS层调用交换机抽象接口SAI时,使用仿真软件模拟SAI接口的实现逻辑部分,验证SAI接口实现的逻辑是否正确;When verifying that the switch abstract interface SAI is called from the network operating system NOS layer, use simulation software to simulate the implementation logic part of the SAI interface, and verify whether the logic implemented by the SAI interface is correct;

当验证从SAI接口调用交换芯片硬件驱动以验证SAI接口的驱动实现细节时,利用虚拟化的方式验证SAI接口的细节功能的实现是否正确。When verifying that the switching chip hardware driver is called from the SAI interface to verify the details of the driver implementation of the SAI interface, it is verified whether the implementation of the detailed functions of the SAI interface is correct by means of virtualization.

进一步地,所述使用仿真软件模拟SAI接口的实现逻辑部分还包括:Further, the implementation logic part of using simulation software to simulate the SAI interface also includes:

使用C/C++编程语言实现SAI规范定义的接口,将所有逻辑打印出来,验证设计的SAI逻辑实现是否满足SAI规范的定义。Use the C/C++ programming language to implement the interface defined by the SAI specification, print out all the logic, and verify whether the designed SAI logic implementation meets the definition of the SAI specification.

进一步地,所述利用虚拟化的方式验证SAI接口的细节功能的实现是否正确包括:Further, verifying whether the implementation of the detailed functions of the SAI interface by means of virtualization is correct includes:

利用可编程语言P4实现一个基本功能的虚拟交换机,同时实现控制层面的驱动接口和SAI的适配层,通过所述仿真平台进行所有的SAI接口的验证和开发。A virtual switch with basic functions is realized by using the programming language P4, and at the same time, the driver interface of the control plane and the adaptation layer of the SAI are realized, and all the verification and development of the SAI interfaces are carried out through the simulation platform.

进一步地,所述方法还包括:Further, the method also includes:

通过软件模拟仿真应用层调用逻辑时,根据详细的log来判断分析SAI层的功能逻辑实现情况。When the logic is invoked by the application layer through software simulation, the implementation of the functional logic of the SAI layer is judged and analyzed according to the detailed log.

另一方面,本发明实施例还提供了一种接口仿真平台的实现装置,包括:On the other hand, the embodiment of the present invention also provides an implementation device of an interface simulation platform, including:

构建模块,用于当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;The building block is used to provide a general test program writing mode through the framework of automated full testing when verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, and build a software simulation platform;

验证模块,用于通过所述仿真平台整体测试所述中间件接口各个模块的功能。The verification module is used for testing the functions of each module of the middleware interface as a whole through the simulation platform.

进一步地,所述中间件接口为交换机抽象接口SAI,其中,所述验证模块用于:Further, the middleware interface is a switch abstract interface SAI, wherein the verification module is used for:

当验证从网络操作系统NOS层调用交换机抽象接口SAI时,使用仿真软件模拟SAI接口的实现逻辑部分,验证SAI接口实现的逻辑是否正确;When verifying that the switch abstract interface SAI is called from the network operating system NOS layer, use simulation software to simulate the implementation logic part of the SAI interface, and verify whether the logic implemented by the SAI interface is correct;

当验证从SAI接口调用交换芯片硬件驱动以验证SAI接口的驱动实现细节时,利用虚拟化的方式验证SAI接口的细节功能的实现是否正确。When verifying that the switching chip hardware driver is called from the SAI interface to verify the details of the driver implementation of the SAI interface, it is verified whether the implementation of the detailed functions of the SAI interface is correct by means of virtualization.

进一步地,所述验证模块用于:Further, the verification module is used for:

使用C/C++编程语言实现SAI规范定义的接口,将所有逻辑打印出来,验证设计的SAI逻辑实现是否满足SAI规范的定义。Use the C/C++ programming language to implement the interface defined by the SAI specification, print out all the logic, and verify whether the designed SAI logic implementation meets the definition of the SAI specification.

进一步地,所述构建模块用于:Further, the building blocks are used for:

利用可编程语言P4实现一个基本功能的虚拟交换机,同时实现控制层面的驱动接口和SAI的适配层,通过所述仿真平台进行所有的SAI接口的验证和开发。A virtual switch with basic functions is realized by using the programming language P4, and at the same time, the driver interface of the control plane and the adaptation layer of the SAI are realized, and all the verification and development of the SAI interfaces are carried out through the simulation platform.

进一步地,所述验证模块用于:Further, the verification module is used for:

通过软件模拟仿真应用层调用逻辑时,根据详细的log来判断分析SAI层的功能逻辑实现情况。When the logic is invoked by the application layer through software simulation, the implementation of the functional logic of the SAI layer is judged and analyzed according to the detailed log.

本发明实施例当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;通过所述仿真平台整体测试所述中间件接口各个模块的功能。本发明实施例通过所述仿真平台可以加速中间件软件的迭代、开发速度,从而加快项目进展。In the embodiment of the present invention, when verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, a general test program writing mode is provided through the framework of the automated full test, and a software simulation platform is constructed; The middleware interface functions of each module. The embodiment of the present invention can accelerate the iteration and development speed of the middleware software through the simulation platform, thereby accelerating the progress of the project.

本发明的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by 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 solution of the present invention, and constitute a part of the description, and are used together with the embodiments of the application to explain the technical solution of the present invention, and do not constitute a limitation to the technical solution of the present invention.

图1为本发明实施例接口仿真平台的实现方法的流程图;Fig. 1 is the flowchart of the realization method of interface emulation platform of the embodiment of the present invention;

图2为本发明实施例接口仿真平台的实现方法中的仿真平台框图;Fig. 2 is the emulation platform block diagram in the implementation method of interface emulation platform of the embodiment of the present invention;

图3为本发明实施例接口仿真平台的实现装置的结构图。FIG. 3 is a structural diagram of an implementation device of an interface simulation platform according to an embodiment of the present invention.

具体实施方式detailed description

为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.

在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps shown in the flowcharts of the figures may be performed in a computer system, such as a set of computer-executable instructions. Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that shown or described herein.

图1为本发明实施例接口仿真平台的实现方法的流程图,如图1所示,本发明实施例的方法包括以下步骤:Fig. 1 is the flowchart of the realization method of interface emulation platform of the embodiment of the present invention, as shown in Fig. 1, the method of the embodiment of the present invention comprises the following steps:

步骤101:当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;Step 101: When verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, provide a general test program writing mode through the framework of the automated full test, and build a software simulation platform;

例如,所述中间件接口为交换机抽象接口SAI,其中SAI:Switch AbstractionInterface,交换机抽象接口层,用于NOS和底层交换机芯片驱动之间的适配。For example, the middleware interface is a switch abstraction interface SAI, wherein SAI: Switch Abstraction Interface, a switch abstraction interface layer, is used for adaptation between the NOS and the underlying switch chip driver.

具体地,本发明实施例的方法提供了一种可以脱离实际硬件交换芯片的仿真验证平台,利用此平台可以实现针对SAI接口的快速验证,二次开发,快速迭代等目的,利用此仿真平台做完逻辑上的验证后,再移植到实际的硬件交换芯片上做实际的验证。Specifically, the method of the embodiment of the present invention provides a simulation verification platform that can be separated from the actual hardware switching chip, using this platform can realize the purposes of rapid verification, secondary development, rapid iteration, etc. for the SAI interface, and use this simulation platform to do After completing the logical verification, it is transplanted to the actual hardware switching chip for actual verification.

本发明实施例可以加速SAI这个中间件软件的迭代、开发速度,从而加快项目进展。The embodiment of the present invention can accelerate the iteration and development speed of the SAI middleware software, thereby speeding up the progress of the project.

步骤102:通过所述仿真平台整体测试所述中间件接口各个模块的功能。Step 102: Test the functions of each module of the middleware interface through the simulation platform as a whole.

例如,当验证从网络操作系统NOS层调用交换机抽象接口SAI时,使用仿真软件模拟SAI接口的实现逻辑部分,验证SAI接口实现的逻辑是否正确;For example, when verifying that the switch abstract interface SAI is called from the network operating system NOS layer, use simulation software to simulate the implementation logic part of the SAI interface to verify whether the logic implemented by the SAI interface is correct;

当验证从SAI接口调用交换芯片硬件驱动以验证SAI接口的驱动实现细节时,利用虚拟化的方式验证SAI接口的细节功能的实现是否正确。When verifying that the switching chip hardware driver is called from the SAI interface to verify the details of the driver implementation of the SAI interface, it is verified whether the implementation of the detailed functions of the SAI interface is correct by means of virtualization.

进一步地,所述使用仿真软件模拟SAI接口的实现逻辑部分还包括:Further, the implementation logic part of using simulation software to simulate the SAI interface also includes:

使用C/C++编程语言实现SAI规范定义的接口,将所有逻辑打印出来,验证设计的SAI逻辑实现是否满足SAI规范的定义。Use the C/C++ programming language to implement the interface defined by the SAI specification, print out all the logic, and verify whether the designed SAI logic implementation meets the definition of the SAI specification.

进一步地,所述利用虚拟化的方式验证SAI接口的细节功能的实现是否正确包括:Further, verifying whether the implementation of the detailed functions of the SAI interface by means of virtualization is correct includes:

利用可编程语言P4实现一个基本功能的虚拟交换机,同时实现控制层面的驱动接口和SAI的适配层,通过所述仿真平台进行所有的SAI接口的验证和开发。A virtual switch with basic functions is realized by using the programming language P4, and at the same time, the driver interface of the control plane and the adaptation layer of the SAI are realized, and all the verification and development of the SAI interfaces are carried out through the simulation platform.

其中P4是一种交换机数据平面的通用编程语言(P4 is a language forprogramming the data plane of network devices)。P4 is a general-purpose programming language for the data plane of switches (P4 is a language for programming the data plane of network devices).

所述虚拟交换机用于虚拟局域网(Virtual Local Area Network,VLAN)。The virtual switch is used in a virtual local area network (Virtual Local Area Network, VLAN).

进一步地,所述方法还包括:Further, the method also includes:

通过软件模拟仿真应用层调用逻辑时,根据详细的log来判断分析SAI层的功能逻辑实现情况。When the logic is invoked by the application layer through software simulation, the implementation of the functional logic of the SAI layer is judged and analyzed according to the detailed log.

图2为本发明实施例接口仿真平台的实现方法中的仿真平台框图,如图2所示,本发明实施例技术方案详细阐述如下:Fig. 2 is the emulation platform block diagram in the realization method of interface emulation platform of the embodiment of the present invention, as shown in Fig. 2, the technical scheme of the embodiment of the present invention is elaborated as follows:

本发明实施例提供了用于验证、开发SAI接口仿真平台的实现方法,可以脱离实际交换芯片的仿真验证平台,利用此平台可以实现针对SAI接口的快速验证,二次开发,快速迭代等目的,可以提高SAI的开发、验证的效率。The embodiment of the present invention provides an implementation method for verifying and developing the SAI interface simulation platform, which can be separated from the actual exchange chip simulation verification platform. Using this platform, the purposes of rapid verification, secondary development, and rapid iteration for the SAI interface can be realized. The efficiency of development and verification of SAI can be improved.

SAI接口是交换机控制层面的一个统一抽象层,目的是为了屏蔽掉各个交换芯片的具体驱动调用细节,是一个通用的适配层,用于适配衔接NOS和底层交换芯片。有了这个适配层的存在,本发明实施例就可以规划统一的平台来兼容不同的NOS和不同的硬件交换芯片。因此,SAI接口的定义一定是根据实际控制交换机的具体需求角度来定义的,根据具体需求,目前SAI接口定义了以下模块:The SAI interface is a unified abstraction layer of the switch control layer. The purpose is to shield the specific driver call details of each switch chip. It is a general adaptation layer for adapting and connecting NOS and the underlying switch chip. With the existence of this adaptation layer, the embodiment of the present invention can plan a unified platform to be compatible with different NOS and different hardware switching chips. Therefore, the definition of the SAI interface must be defined according to the specific needs of the actual control switch. According to the specific needs, the SAI interface currently defines the following modules:

SAI_API_UNSPECIFIED、SAI_API_SWITCH、SAI_API_PORT、SAI_API_FDB、SAI_API_UNSPECIFIED, SAI_API_SWITCH, SAI_API_PORT, SAI_API_FDB,

SAI_API_VLAN、SAI_API_VIRTUAL_ROUTER、SAI_API_ROUTE、SAI_API_VLAN, SAI_API_VIRTUAL_ROUTER, SAI_API_ROUTE,

SAI_API_NEXT_HOP、SAI_API_NEXT_HOP_GROUP、SAI_API_NEXT_HOP, SAI_API_NEXT_HOP_GROUP,

SAI_API_ROUTER_INTERFACE、SAI_API_NEIGHBORSAI_API_ROUTER_INTERFACE, SAI_API_NEIGHBOR

SAI_API_ACL、SAI_API_HOSTIF、SAI_API_MIRROR、SAI_API_ACL, SAI_API_HOSTIF, SAI_API_MIRROR,

SAI_API_SAMPLEPACKET、SAI_API_STPSAI_API_SAMPLEPACKET, SAI_API_STP

SAI_API_LAG、SAI_API_POLICER、SAI_API_WRED、SAI_API_QOS_MAPSAI_API_LAG, SAI_API_POLICER, SAI_API_WRED, SAI_API_QOS_MAP

SAI_API_QUEUE、SAI_API_SCHEDULER、SAI_API_SCHEDULER_GROUP、SAI_API_QUEUE, SAI_API_SCHEDULER, SAI_API_SCHEDULER_GROUP,

SAI_API_BUFFER、SAI_API_HASH、SAI_API_UDF、SAI_API_TUNNEL、SAI_API_BUFFER, SAI_API_HASH, SAI_API_UDF, SAI_API_TUNNEL,

SAI_API_L2MC、SAI_API_IPMC、SAI_API_RPF_GROUP、SAI_API_L2MC, SAI_API_IPMC, SAI_API_RPF_GROUP,

SAI_API_L2MC_GROUP、SAI_API_IPMC_GROUP、SAI_API_MCAST_FDB、SAI_API_L2MC_GROUP, SAI_API_IPMC_GROUP, SAI_API_MCAST_FDB,

SAI_API_BRIDGE、SAI_API_TAM、SAI_API_SEGMENTROUTE、SAI_API_BRIDGE, SAI_API_TAM, SAI_API_SEGMENTROUTE,

SAI_API_MPLS、SAI_API_DTELSAI_API_MPLS, SAI_API_DTEL

SAI_API_BFD、SAI_API_ISOLATION_GROUP、SAI_API_MAX。SAI_API_BFD, SAI_API_ISOLATION_GROUP, SAI_API_MAX.

上述模块的每个模块验证都需要从两个方面进行验证,一是从NOS层调用SAI接口验证SAI接口实现的逻辑是否正确,二是验证从SAI接口调用交换芯片硬件驱动验证具体功能的实现是否正确。为实现上述验证,本发明实施例提出另一种思路,利用虚拟化的方式将上述需要验证的内容进行验证。The verification of each module of the above-mentioned modules needs to be verified from two aspects. One is to call the SAI interface from the NOS layer to verify whether the logic implemented by the SAI interface is correct. correct. In order to realize the above-mentioned verification, the embodiment of the present invention proposes another way of thinking, using virtualization to verify the above-mentioned content that needs to be verified.

一是验证NOS层调用SAI接口的逻辑部分,这部分使用仿真软件来模拟SAI接口的实现逻辑部分,不直接下发给硬件,而是纯模拟实现逻辑,可以将所有逻辑打印出来,以帮助设计者验证设计的SAI逻辑实现是否满足SAI规范的定义。One is to verify the logical part of the NOS layer calling the SAI interface. This part uses simulation software to simulate the implementation logic part of the SAI interface. It does not directly send it to the hardware, but purely simulates the implementation logic. All logic can be printed out to help design The author verifies whether the designed SAI logic implementation meets the definition of the SAI specification.

二是验证SAI接口的实际实现细节,也即驱动实现细节,这部分也用软件仿真系统实现。利用可编程语言P4实现一个基本功能的交换机模型,同时实现控制层面的驱动接口和SAI的适配层,从而可以利用装置纯软件仿真平台来实现所有的SAI接口的验证和开发。The second is to verify the actual implementation details of the SAI interface, that is, the details of the driver implementation. This part is also implemented with a software simulation system. Use the programming language P4 to realize a switch model with basic functions, and at the same time realize the driver interface of the control layer and the adaptation layer of SAI, so that the verification and development of all SAI interfaces can be realized by using the pure software simulation platform of the device.

同时,为了满足测试所有SAI模块的需求,本发明实施例设计了自动化全测试的框架,此框架提供了一种通用的测试程序编写模式,方便整体测试SAI各个模块的功能。本仿真平台的整体框架图见图2仿真平台框图,其中具体包括:测试实例T1和测试实例T2,经过函数调用测试框架层、SAI接口层,仿真框架层,分别与仿真交换芯片A的控制层面和仿真交换芯片B的控制层面交互。At the same time, in order to meet the requirements of testing all SAI modules, the embodiment of the present invention designs an automated full-test framework, which provides a general test program writing mode to facilitate the overall testing of the functions of each SAI module. The overall frame diagram of the simulation platform is shown in Figure 2. The block diagram of the simulation platform, which specifically includes: test instance T1 and test instance T2, through the function call test frame layer, SAI interface layer, simulation frame layer, and the control layer of the simulation exchange chip A respectively Interact with the control plane of the emulated switch chip B.

本发明实施例的整个技术方案的实施步骤如下:The implementation steps of the whole technical solution of the embodiment of the present invention are as follows:

SAI接口验证从层次上划分可以分为SAI实现的逻辑验证和SAI功能实现的细节功能验证。SAI实现的逻辑验证本发明实施例使用C/C++编程语言实现SAI规范定义的接口,逻辑验证使用打印log的形式进行,本仿真平台使用Linux系统下自带的syslog系统来做log输出。根据详细的log系统输出,本发明实施例可以很方便地调试SAI接口上层实现的逻辑问题。验证SAI接口对下的具体实现上,本发明实施例使用P4编程语言实现一个虚拟的交换机,该交换机实现了大部分常见的数据报文处理流程和基本功能。在这个虚拟出来的交换机基础上,本发明实施例实现SAI接口的适配驱动层,实现SAI接口功能实现的细节验证。这样本发明实施例就可以从应用层的逻辑功能到交换机的控制层面以及部分转发功能的各个方面进行详细的验证。SAI interface verification can be divided into logic verification of SAI implementation and detailed function verification of SAI function realization from the level of division. The logical verification that SAI realizes the embodiment of the present invention uses C/C++ programming language to realize the interface of SAI standard definition, logical verification uses the form of printing log to carry out, and this emulation platform uses the syslog system that carries under Linux system to do log output. According to the detailed log system output, the embodiment of the present invention can conveniently debug the logic problem of the upper layer implementation of the SAI interface. In terms of verifying the specific implementation of the SAI interface pair, the embodiment of the present invention implements a virtual switch using the P4 programming language, and the switch realizes most common data packet processing procedures and basic functions. On the basis of the virtualized switch, the embodiment of the present invention realizes the adaptation driver layer of the SAI interface, and realizes the detailed verification of the function realization of the SAI interface. In this way, the embodiment of the present invention can carry out detailed verification on various aspects from the logic function of the application layer to the control plane of the switch and some forwarding functions.

下面用一个具体的例子说明本发明实施例的实现过程:The implementation process of the embodiment of the present invention is illustrated below with a specific example:

本发明实施例中介绍的仿真平台涉及到的模块众多,这里以VLAN为例子来进行阐述具体的实施方法。SAI模块中定义的操作函数有以下:The emulation platform introduced in the embodiment of the present invention involves many modules, and the specific implementation method is described here by taking VLAN as an example. The operation functions defined in the SAI module are as follows:

create_vlan、remove_vlan、set_vlan_attribute、get_vlan_attribute、create_vlan_member、remove_vlan_member、set_vlan_member_attribute、get_vlan_member_attribute、create_vlan_members、remove_vlan_members、get_vlan_stats、get_vlan_stats_ext、clear_vlan_stats。create_vlan, remove_vlan, set_vlan_attribute, get_vlan_attribute, create_vlan_member, remove_vlan_member, set_vlan_member_attribute, get_vlan_member_attribute, create_vlan_members, remove_vlan_members, get_vlan_stats, get_vlan_stats_ext, clear_vlan

本发明实施例以create_vlan为例子来介绍具体的实施方法。首先,本发明实施例要初始化SAI的使用环境,使用sai_api_initialize函数初始化SAI,然后使用sai_api_query查询到调用create_vlan的具体实现函数。SAI接口的应用层逻辑验证使用打印log的方式进行。SAI应用角度创建一个vlan的过程描述如下:The embodiment of the present invention uses create_vlan as an example to introduce a specific implementation method. First, the embodiment of the present invention needs to initialize the use environment of SAI, use the sai_api_initialize function to initialize SAI, and then use sai_api_query to query the specific implementation function for calling create_vlan. The application layer logic verification of the SAI interface is performed by printing logs. The process of creating a vlan from the perspective of SAI application is described as follows:

打印出进入create_vlan函数的日志,并把传入此函数的所有参数打印。Print out the log entering the create_vlan function, and print all the parameters passed into this function.

判断传入需要创建的vlan数值是否符合要求,如果不符合打印详细log。Determine whether the value of the incoming vlan to be created meets the requirements, and if not, print the detailed log.

判断需要创建的vlan数值是否可用,是否已经创建过。如果不可用打印详细的logDetermine whether the VLAN value to be created is available and has already been created. Print detailed log if unavailable

在SAI的实现层记录已经创建的VLAN。Record the VLANs that have been created at the implementation layer of the SAI.

调用真正的交换芯片驱动层函数,判断返回值,根据返回值情况打印详细的log。Call the real switching chip driver layer function, judge the return value, and print the detailed log according to the return value.

create_vlan函数退出时,打印详细的包含函数返回值的log。When the create_vlan function exits, print a detailed log containing the return value of the function.

通过上述的软件模拟仿真应用层调用逻辑,可以根据详细的log来判断分析SAI层的功能逻辑实现是否存在问题。可以利用这一仿真平台,快速验证逻辑问题,并不依赖于具体的交换芯片和CPU硬件平台。Through the above-mentioned software simulation application layer calling logic, it can be judged and analyzed whether there is a problem in the functional logic implementation of the SAI layer according to the detailed log. This simulation platform can be used to quickly verify logic problems without depending on specific switching chips and CPU hardware platforms.

SAI接口的详细实现的仿真就需要依赖于一个基本的交换机仿真模型,这个仿真模型本发明实施例使用P4语言的一个模拟器bmv2,这个模拟器可以让你运行用P4语言编写的模拟交换芯片基本转发功能的软件。这样本发明实施例就可以根据本发明实施例的需求来编写交换机转发逻辑和对外提供的控制层面的接口。然后本发明实施例可以继续实现一个SAI接口的适配层,来实现SAI层调用的具体的实现代码。有了具体细节的驱动实现调用的仿真平台,本发明实施例就可以快速验证从应用层到实现层的所有逻辑。可以实现快速迭代SAI接口的开发和调试。The simulation of the detailed implementation of the SAI interface needs to rely on a basic switch simulation model. This simulation model uses a simulator bmv2 of the P4 language in the embodiment of the present invention. Software for forwarding functions. In this way, the embodiment of the present invention can program the forwarding logic of the switch and the interface of the control plane provided externally according to the requirements of the embodiment of the present invention. Then the embodiment of the present invention can continue to implement an adaptation layer of the SAI interface to implement the specific implementation code called by the SAI layer. With the emulation platform for specific details of the driver implementation call, the embodiment of the present invention can quickly verify all the logic from the application layer to the implementation layer. Rapid iterative development and debugging of SAI interfaces can be achieved.

本发明实施例技术方案中,用于验证、开发SAI接口仿真平台的实现方法能够实现以下功能:本仿真平台提供了自动化测试的框架;本仿真平台利用P4编程语言实现了基本的交换芯片功能模型;本仿真平台在交换芯片功能模型的基础上实现了SAI接口的适配驱动层。In the technical solution of the embodiment of the present invention, the implementation method for verifying and developing the SAI interface simulation platform can realize the following functions: the simulation platform provides a framework for automated testing; the simulation platform uses the P4 programming language to realize the basic switching chip function model ; This simulation platform implements the adaptive driver layer of the SAI interface on the basis of the switch chip function model.

需要说明的是,本发明实施例的思路还可以用于各种中间件接口的开发和验证上,提供仿真平台可以加快软件的迭代速度。It should be noted that the idea of the embodiment of the present invention can also be used in the development and verification of various middleware interfaces, and the provision of a simulation platform can speed up the iteration speed of the software.

图3为本发明实施例接口仿真平台的实现装置的结构图,如图3所示,本发明实施例另一方面提供的一种接口仿真平台的实现装置,包括:FIG. 3 is a structural diagram of an implementation device of an interface simulation platform according to an embodiment of the present invention. As shown in FIG. 3 , another aspect of an implementation device of an interface simulation platform provided by an embodiment of the present invention includes:

构建模块301,用于当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;The construction module 301 is used to provide a general test program writing mode through the framework of the automated full test when verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, and build a software simulation platform;

验证模块302,用于通过所述仿真平台整体测试所述中间件接口各个模块的功能。The verification module 302 is configured to test the functions of each module of the middleware interface as a whole through the simulation platform.

进一步地,所述中间件接口为交换机抽象接口SAI,其中,所述验证模块302用于:Further, the middleware interface is a switch abstract interface SAI, wherein the verification module 302 is used for:

当验证从网络操作系统NOS层调用交换机抽象接口SAI时,使用仿真软件模拟SAI接口的实现逻辑部分,验证SAI接口实现的逻辑是否正确;When verifying that the switch abstract interface SAI is called from the network operating system NOS layer, use simulation software to simulate the implementation logic part of the SAI interface, and verify whether the logic implemented by the SAI interface is correct;

当验证从SAI接口调用交换芯片硬件驱动以验证SAI接口的驱动实现细节时,利用虚拟化的方式验证SAI接口的细节功能的实现是否正确。When verifying that the switching chip hardware driver is called from the SAI interface to verify the details of the driver implementation of the SAI interface, it is verified whether the implementation of the detailed functions of the SAI interface is correct by means of virtualization.

进一步地,所述验证模块用于:Further, the verification module is used for:

使用C/C++编程语言实现SAI规范定义的接口,将所有逻辑打印出来,验证设计的SAI逻辑实现是否满足SAI规范的定义。Use the C/C++ programming language to implement the interface defined by the SAI specification, print out all the logic, and verify whether the designed SAI logic implementation meets the definition of the SAI specification.

进一步地,所述构建模块301用于:Further, the building block 301 is used for:

利用可编程语言P4实现一个基本功能的虚拟交换机,同时实现控制层面的驱动接口和SAI的适配层,通过所述仿真平台进行所有的SAI接口的验证和开发。A virtual switch with basic functions is realized by using the programming language P4, and at the same time, the driver interface of the control plane and the adaptation layer of the SAI are realized, and all the verification and development of the SAI interfaces are carried out through the simulation platform.

进一步地,所述验证模块302用于:Further, the verification module 302 is used for:

通过软件模拟仿真应用层调用逻辑时,根据详细的log来判断分析SAI层的功能逻辑实现情况。When the logic is invoked by the application layer through software simulation, the implementation of the functional logic of the SAI layer is judged and analyzed according to the detailed log.

本发明实施例当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;通过所述仿真平台整体测试所述中间件接口各个模块的功能。本发明实施例通过所述仿真平台可以加速中间件软件的迭代、开发速度,从而加快项目进展。In the embodiment of the present invention, when verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, a general test program writing mode is provided through the framework of the automated full test, and a software simulation platform is constructed; The middleware interface functions of each module. The embodiment of the present invention can accelerate the iteration and development speed of the middleware software through the simulation platform, thereby accelerating the progress of the project.

虽然本发明所揭露的实施方式如上,但所述的内容仅为便于理解本发明而采用的实施方式,并非用以限定本发明。任何本发明所属领域内的技术人员,在不脱离本发明所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本发明的专利保护范围,仍须以所附的权利要求书所界定的范围为准。Although the embodiments disclosed in the present invention are as above, the described content is only an embodiment adopted for understanding the present invention, and is not intended to limit the present invention. Anyone skilled in the field of the present invention 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 must still be The scope defined by the appended claims shall prevail.

Claims (8)

1.一种接口仿真平台的实现方法,其特征在于,包括:1. A method for implementing an interface simulation platform, comprising: 当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;其中,所述中间件接口为交换机抽象接口SAI,When verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, a general test program writing mode is provided through the framework of the automated full test to build a software simulation platform; wherein the middleware interface is the switch abstract interface SAI, 当验证从网络操作系统NOS层调用交换机抽象接口SAI时,使用仿真软件模拟SAI接口的实现逻辑部分,验证SAI接口实现的逻辑是否正确;When verifying that the switch abstract interface SAI is called from the network operating system NOS layer, use simulation software to simulate the implementation logic part of the SAI interface, and verify whether the logic implemented by the SAI interface is correct; 当验证从SAI接口调用交换芯片硬件驱动以验证SAI接口的驱动实现细节时,利用虚拟化的方式验证SAI接口的细节功能的实现是否正确;When verifying that the switching chip hardware driver is called from the SAI interface to verify the driver implementation details of the SAI interface, use virtualization to verify whether the implementation of the detailed functions of the SAI interface is correct; 通过所述仿真平台整体测试所述中间件接口各个模块的功能。The function of each module of the middleware interface is tested as a whole through the simulation platform. 2.根据权利要求1所述的接口仿真平台的实现方法,其特征在于,所述使用仿真软件模拟SAI接口的实现逻辑部分还包括:2. the realization method of interface emulation platform according to claim 1, is characterized in that, the implementation logic part of described use emulation software to simulate SAI interface also comprises: 使用C/C++编程语言实现SAI规范定义的接口,将所有逻辑打印出来,验证设计的SAI逻辑实现是否满足SAI规范的定义。Use the C/C++ programming language to implement the interface defined by the SAI specification, print out all the logic, and verify whether the designed SAI logic implementation meets the definition of the SAI specification. 3.根据权利要求1所述的接口仿真平台的实现方法,其特征在于,所述利用虚拟化的方式验证SAI接口的细节功能的实现是否正确包括:3. the implementation method of the interface simulation platform according to claim 1, is characterized in that, whether the realization of the details function of the verification SAI interface by means of virtualization is correct comprising: 利用可编程语言P4实现一个基本功能的虚拟交换机,同时实现控制层面的驱动接口和SAI的适配层,通过所述仿真平台进行所有的SAI接口的验证和开发。A virtual switch with basic functions is realized by using the programming language P4, and at the same time, the driver interface of the control plane and the adaptation layer of the SAI are realized, and all the verification and development of the SAI interfaces are carried out through the simulation platform. 4.根据权利要求2所述的接口仿真平台的实现方法,其特征在于,还包括:4. the realization method of interface simulation platform according to claim 2, is characterized in that, also comprises: 通过软件模拟仿真应用层调用逻辑时,根据详细的log来判断分析SAI层的功能逻辑实现情况。When the logic is invoked by the application layer through software simulation, the implementation of the functional logic of the SAI layer is judged and analyzed according to the detailed log. 5.一种接口仿真平台的实现装置,其特征在于,包括:5. A device for implementing an interface simulation platform, characterized in that it comprises: 构建模块,用于当验证从网络操作系统通过中间件接口适配到底层芯片驱动时,通过自动化全测试的框架提供通用的测试程序编写模式,构建软件仿真平台;其中,所述中间件接口为交换机抽象接口SAI,其中,验证模块用于:The building block is used for when verifying that the network operating system is adapted to the underlying chip driver through the middleware interface, providing a general test program writing mode through the framework of the automated full test, and building a software simulation platform; wherein the middleware interface is The switch abstract interface SAI, wherein the verification module is used for: 当验证从网络操作系统NOS层调用交换机抽象接口SAI时,使用仿真软件模拟SAI接口的实现逻辑部分,验证SAI接口实现的逻辑是否正确;When verifying that the switch abstract interface SAI is called from the network operating system NOS layer, use simulation software to simulate the implementation logic part of the SAI interface, and verify whether the logic implemented by the SAI interface is correct; 当验证从SAI接口调用交换芯片硬件驱动以验证SAI接口的驱动实现细节时,利用虚拟化的方式验证SAI接口的细节功能的实现是否正确When verifying that the switching chip hardware driver is called from the SAI interface to verify the driver implementation details of the SAI interface, use virtualization to verify whether the implementation of the detailed functions of the SAI interface is correct 验证模块,用于通过所述仿真平台整体测试所述中间件接口各个模块的功能。The verification module is used for testing the functions of each module of the middleware interface as a whole through the simulation platform. 6.根据权利要求5所述的接口仿真平台的实现装置,其特征在于,所述验证模块用于:6. the realization device of interface emulation platform according to claim 5, is characterized in that, described verification module is used for: 使用C/C++编程语言实现SAI规范定义的接口,将所有逻辑打印出来,验证设计的SAI逻辑实现是否满足SAI规范的定义。Use the C/C++ programming language to implement the interface defined by the SAI specification, print out all the logic, and verify whether the designed SAI logic implementation meets the definition of the SAI specification. 7.根据权利要求5所述的接口仿真平台的实现装置,其特征在于,所述构建模块用于:7. the realization device of interface simulation platform according to claim 5, is characterized in that, described building block is used for: 利用可编程语言P4实现一个基本功能的虚拟交换机,同时实现控制层面的驱动接口和SAI的适配层,通过所述仿真平台进行所有的SAI接口的验证和开发。A virtual switch with basic functions is realized by using the programming language P4, and at the same time, the driver interface of the control plane and the adaptation layer of SAI are realized, and the verification and development of all SAI interfaces are carried out through the simulation platform. 8.根据权利要求6所述的接口仿真平台的实现装置,其特征在于,所述验证模块用于:8. the realization device of interface emulation platform according to claim 6, is characterized in that, described verification module is used for: 通过软件模拟仿真应用层调用逻辑时,根据详细的log来判断分析SAI层的功能逻辑实现情况。When the logic is invoked by the application layer through software simulation, the implementation of the functional logic of the SAI layer is judged and analyzed according to the detailed log.
CN201911052394.4A 2019-10-31 2019-10-31 Method and device for realizing interface simulation platform Active CN110990112B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911052394.4A CN110990112B (en) 2019-10-31 2019-10-31 Method and device for realizing interface simulation platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911052394.4A CN110990112B (en) 2019-10-31 2019-10-31 Method and device for realizing interface simulation platform

Publications (2)

Publication Number Publication Date
CN110990112A CN110990112A (en) 2020-04-10
CN110990112B true CN110990112B (en) 2022-12-16

Family

ID=70082870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911052394.4A Active CN110990112B (en) 2019-10-31 2019-10-31 Method and device for realizing interface simulation platform

Country Status (1)

Country Link
CN (1) CN110990112B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1725188A (en) * 2004-07-22 2006-01-25 华为技术有限公司 Logic verification system and method
CN103440195A (en) * 2013-07-11 2013-12-11 盛科网络(苏州)有限公司 Switch chip verification method and device based on logic chip

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8997034B2 (en) * 2012-07-30 2015-03-31 Synopsys, Inc. Emulation-based functional qualification

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1725188A (en) * 2004-07-22 2006-01-25 华为技术有限公司 Logic verification system and method
CN103440195A (en) * 2013-07-11 2013-12-11 盛科网络(苏州)有限公司 Switch chip verification method and device based on logic chip

Also Published As

Publication number Publication date
CN110990112A (en) 2020-04-10

Similar Documents

Publication Publication Date Title
Canini et al. A {NICE} way to test {OpenFlow} applications
CN105323161B (en) The method and system of realization virtualization router based on windows platform
US10666775B1 (en) Integrated packet generator and checker
CN110838954A (en) A lightweight and large-scale autonomous network protocol functional testing method
CN109450705B (en) A mapping-oriented network-on-chip verification method and system based on FPGA
Ryzhyk et al. Correct by construction networks using stepwise refinement
CN101383822A (en) Aviation Telecommunications Network Router Virtual Machine
CN109495293B (en) Method, system, equipment and storage medium for testing control surface of switch
Kuzniar et al. OFTEN testing OpenFlow networks
WO2024130861A1 (en) Cloud native hardware logic simulation fpga acceleration method and system
Maier et al. Scalable network emulation: A comparison of virtual routing and virtual machines
CN109495309A (en) The intelligent detecting method and device of cloud platform virtual network state
CN107566238B (en) Method for automatically identifying vlan frame and non-vlan frame through user-state configuration physical interface
CN110990112B (en) Method and device for realizing interface simulation platform
CN116192654A (en) A method and device for dynamic access of physical equipment in a network shooting range
CN114745285A (en) Large-scale distributed virtualized network simulation method based on virtualized container
Rankothge Past before future: a comprehensive review on software defined networks road map
CN113708965A (en) High-performance component-based data packet processing framework
CN113806203A (en) Block chain testing method and device
CN117787154A (en) Simulation verification method, electronic device, and computer-readable medium
Xue et al. Research and application of floyd algorithm based on SDN network
CN101958816A (en) High speed core switching equipment testing system and testing method thereof
Byma Virtualizing FPGAs for cloud computing applications
Taher Testing of floodlight controller with mininet in sdn topology
Pathak et al. Software defined network simulation using OpenNet for vehicular network

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
CP03 Change of name, title or address

Address after: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province

Patentee after: Suzhou Yuannao Intelligent Technology Co.,Ltd.

Country or region after: China

Address before: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province

Patentee before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd.

Country or region before: China