CN116886558A - Network protocol testing method, device, equipment, medium and system - Google Patents

Network protocol testing method, device, equipment, medium and system Download PDF

Info

Publication number
CN116886558A
CN116886558A CN202310620413.9A CN202310620413A CN116886558A CN 116886558 A CN116886558 A CN 116886558A CN 202310620413 A CN202310620413 A CN 202310620413A CN 116886558 A CN116886558 A CN 116886558A
Authority
CN
China
Prior art keywords
test
data
preset
network protocol
determining
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.)
Pending
Application number
CN202310620413.9A
Other languages
Chinese (zh)
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202310620413.9A priority Critical patent/CN116886558A/en
Publication of CN116886558A publication Critical patent/CN116886558A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Security & Cryptography (AREA)
  • Maintenance And Management Of Digital Transmission (AREA)

Abstract

The application provides a network protocol testing method, a device, equipment, a medium and a system, which can be used in the financial field or other fields, and the method comprises the following steps: receiving a test instruction sent by main control equipment; determining a corresponding preset test instance according to the test instruction; the method comprises the steps that a preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to a software defined network; the preset test case comprises a corresponding test logic flow of a test object; based on the test logic flow, the following processing is performed: coding the test data to be transmitted to generate corresponding coded test data; the data format of the coded test data is a data format capable of network transmission; transmitting the encoded test data to a target device to be tested; and receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data. The network protocol testing method improves the efficiency of the testing flow.

Description

Network protocol testing method, device, equipment, medium and system
Technical Field
The present application relates to the financial field or other fields, and in particular, to a network protocol testing method, device, apparatus, medium and system.
Background
In the financial field, such as banks, online services gradually adopt SDN (english is called Software Defined Network, chinese is software defined network) to perform intersystem communication. The SDN network separates the control surface from the data surface of the network equipment, so that flexible control of network traffic is realized, and the network becomes more intelligent.
At present, since one network device or software is usually implemented by multiple protocols, the complexity of the system increases the difficulty of implementing the protocols correctly, and thus, when developing inter-system communication, a protocol consistency test is required. The protocol consistency test is a test for detecting the degree of protocol implementation and protocol standard compliance by testing the basic functional behavior of the protocol implementation. The consistency test is used as a basic protocol test, and aims to eliminate the place inconsistent with the protocol standard in the protocol implementation process as far as possible, so that the protocol implementation is consistent with the protocol standard enough to be capable of communicating with other devices normally in the network.
Currently, for protocols in an SDN network, a solution for efficiently implementing network protocol testing is lacking.
Disclosure of Invention
The application provides a network protocol testing method, device, equipment, medium and system, which are used for solving the problem that a scheme for efficiently realizing network protocol testing is lacking for protocols in an SDN network at present.
The first aspect of the present application provides a network protocol testing method, where a network protocol testing system includes: a master device and a slave device in communication with each other; the slave device is in communication connection with the target device to be tested; the method is applied to a slave device, the method comprising:
receiving a test instruction sent by main control equipment;
determining a corresponding preset test instance according to the test instruction; the preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network; the preset test case comprises a corresponding test logic flow of a test object;
based on the test logic flow, the following processing is performed:
coding the test data to be transmitted to generate corresponding coded test data; the data format of the coded test data is a data format capable of network transmission;
transmitting the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data to generate test result data;
and receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
A second aspect of the present application provides a network protocol testing apparatus, a network protocol testing system comprising: a master device and a slave device in communication with each other; the slave device is in communication connection with the target device to be tested; the apparatus is located in a slave device, the apparatus comprising:
the receiving module is used for receiving the test instruction sent by the main control equipment;
the determining module is used for determining a corresponding preset test instance according to the test instruction; the preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network; the preset test case comprises a corresponding test logic flow of a test object;
the test module is used for carrying out the following processing based on the test logic flow:
coding the test data to be transmitted to generate corresponding coded test data; the data format of the coded test data is a data format capable of network transmission; transmitting the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data to generate test result data; and receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
A third aspect of the present application provides an electronic apparatus, comprising: a memory and a processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the network protocol testing method of any of the first aspects.
A fourth aspect of the present application provides a computer-readable storage medium having stored therein computer-executable instructions for implementing the network protocol testing method of any one of the first aspects when executed by a processor.
A fifth aspect of the application provides a computer program product comprising a computer program which, when executed by a processor, implements the network protocol testing method of any of the first aspects.
A sixth aspect of the present application provides a network protocol testing system, including: a master device and at least one slave device in communication with each other; the main control equipment is used for controlling the slave equipment to perform corresponding test processing; the slave device is in communication connection with the target device to be tested; the slave device is for use in the network protocol testing method of any one of the first aspects.
The application provides a network protocol testing method, a device, equipment, a medium and a system, wherein the network protocol testing system comprises: a master device and a slave device in communication with each other; the slave device is in communication connection with the target device to be tested; the method is applied to a slave device, the method comprising: receiving a test instruction sent by main control equipment; determining a corresponding preset test instance according to the test instruction; the preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network; the preset test case comprises a corresponding test logic flow of a test object; based on the test logic flow, the following processing is performed: coding the test data to be transmitted to generate corresponding coded test data; the data format of the coded test data is a data format capable of network transmission; transmitting the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data to generate test result data; and receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data. According to the network protocol testing method, a network protocol testing system is adopted to provide a testing environment, one or more slave devices are adopted to respectively conduct different tests through the framework of the master control device and the slave devices, and the testing efficiency is improved. Meanwhile, the preset test instance for testing is compiled and generated based on TTCN-3 standard test language and is related to the network protocol to be tested corresponding to the software defined network, so that the efficiency of each test flow is further improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a scenario diagram of a network protocol testing method in which embodiments of the present application may be implemented;
FIG. 2 is a flow chart of a network protocol testing method according to the present application;
FIG. 3 is a second flow chart of the network protocol testing method according to the present application;
fig. 4 is a schematic diagram of an application scenario of the network protocol testing method provided by the present application;
FIG. 5 is a schematic diagram of a slave device architecture of the network protocol testing method according to the present application;
fig. 6 is a schematic structural diagram of a network protocol testing device according to the present application;
fig. 7 is a schematic structural diagram of an electronic device provided by the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
In the technical scheme of the embodiment of the application, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user accord with the regulations of related laws and regulations, and the public order is not violated.
It should be noted that, the target user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.
It should be noted that the network protocol testing method, device, equipment and storage medium of the present disclosure may be used in the financial field or other fields. But can be used in any fields other than the financial field or other fields. The application fields of the network protocol testing method, the device, the equipment and the storage medium are not limited.
The technical scheme of the application is described in detail below by specific examples. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
For a clear understanding of the technical solutions of the present application, the prior art solutions will be described in detail first. Currently, when developing inter-system communications, protocol conformance testing is required. The protocol consistency test is a test for detecting the degree of protocol implementation and protocol standard compliance by testing the basic functional behavior of the protocol implementation. After the protocol standard is formulated and released by the standardization organization, different manufacturers and developers develop hardware or software according to the protocol standard, and finally different protocol implementations can be obtained. Ideally these protocol implementations would be able to communicate with each other as long as they were developed according to the same protocol standard. But in practice it is not easy to implement communication of different systems: first, network communication is a very complex process, and a network device or software is usually an implementation of multiple protocols, and the complexity of the system increases the difficulty of implementing the protocols correctly. Meanwhile, since the protocol standard is a document described by natural language, the document may not be avoided in places with unknown semantics, and different developers may have different understanding of the document in the development process, which eventually leads to deviation, inconsistent with the standard, and unable to work normally. In addition, errors are unavoidable in the protocol implementation process, and normal communication cannot be realized. The consistency test is used as a basic protocol test, and aims to eliminate the place inconsistent with the protocol standard in the protocol implementation process as far as possible, so that the protocol implementation is consistent with the protocol standard enough to be capable of communicating with other devices normally in the network.
Currently, for protocols in an SDN network, a solution for efficiently implementing network protocol testing is lacking.
Therefore, the inventor finds out in research that in order to solve the problem that a scheme for efficiently realizing network protocol testing is lacking for protocols in an SDN network in the prior art, a network protocol testing system can be adopted to provide various testing environments, and meanwhile, one or more slave devices are adopted to respectively perform different tests through the architectures of a master control device and the slave devices, so that the testing efficiency is improved. In addition, a preset test case can be written based on TTCN-3 standard test language, and the preset test case is related to a network protocol to be tested corresponding to the software defined network, so that the efficiency of each test flow is further improved.
Specifically, the network protocol test system includes: a master device and a slave device in communication with each other. The slave device is communicatively connected to the target device to be tested. The method is applied to the slave device, and comprises the following steps: and receiving a test instruction sent by the main control equipment. And determining a corresponding preset test instance according to the test instruction. The preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network. The preset test case comprises a corresponding test logic flow of a test object. The following processes are performed based on the test logic flow: and encoding the test data to be transmitted to generate corresponding encoded test data. The data format of the encoded test data is a data format that can be transmitted over a network. And sending the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data, and test result data is generated. And receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
According to the network protocol testing method, a network protocol testing system is adopted to provide a testing environment, one or more slave devices are adopted to respectively conduct different tests through the framework of the master control device and the slave devices, and the testing efficiency is improved. Meanwhile, the preset test instance for testing is compiled and generated based on TTCN-3 standard test language and is related to the network protocol to be tested corresponding to the software defined network, so that the efficiency of each test flow is further improved.
The inventor proposes the technical scheme of the application based on the creative discovery.
The application scenario of the network protocol testing method provided by the embodiment of the application is described below. As shown in fig. 1, wherein 1 is a slave device, 2 is a master device, and 3 is a target device to be tested. The network architecture of the application scenario corresponding to the network protocol testing method provided by the embodiment of the application comprises the following steps: slave device 1, master device 2, and target device 3. The network protocol testing system in this embodiment includes: a master device 2 and a slave device 1 in communication with each other. The slave device 1 is communicatively connected to a target device 3 to be tested. The number of slave devices 1 may be one or more, and this embodiment is exemplified by only one slave device, and the number of slave devices may be determined according to the number of electronic devices required for actual testing.
Illustratively, when performing network protocol testing, the master device 2 sends a test instruction to the slave device 1 according to a test requirement. The slave device 1 receives the test instruction sent by the master device and determines a corresponding preset test case according to the test instruction. The preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network. The preset test case comprises a corresponding test logic flow of a test object.
Meanwhile, the slave device 1 performs the following processing based on the test logic flow: and encoding the test data to be transmitted to generate corresponding encoded test data. The data format of the coded test data is a data format capable of network transmission. And sending the encoded test data to the target device 3 to be tested, so that the target device 3 carries out corresponding processing based on the encoded test data to generate test result data. And receiving test result data fed back by the target equipment 3, and determining a corresponding test result according to the test result data. After determining the test result, the test result may be fed back to the main control device 2, so that the main control device 2 records and analyzes the test result.
Embodiments of the present application will now be described with reference to the accompanying drawings.
Fig. 2 is a schematic flow chart of a network protocol testing method provided by the present application, as shown in fig. 2, in this embodiment, an execution body of the embodiment of the present application is a network protocol testing device, and the network protocol testing device may be integrated in an electronic device, such as a slave device. In this embodiment, the network protocol test system includes: a master device and a slave device in communication with each other. The slave device is communicatively connected to the target device to be tested. The network protocol testing method provided by the embodiment comprises the following steps:
step S101, a test instruction sent by a main control device is received.
In this embodiment, the master device is configured to control the slave devices to perform related tests, where the number of slave devices may be one or more, and when the number of slave devices is multiple, different slave devices may be controlled to perform corresponding tests respectively, so that test efficiency is improved. Meanwhile, the main control equipment can also acquire test results corresponding to all the test parts and analyze the test results.
The test instruction comprises relevant information such as a test type identifier, test time and the like.
Step S102, determining a corresponding preset test case according to the test instruction. The preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network. The preset test case comprises a corresponding test logic flow of a test object.
In this embodiment, TTCN (English is called Testing and Test Control Notation) -3 standard test language is a global applicable standard test language. TTCN-3 is a modern and flexible language, in its recently approved third generation standard, used to describe many types of system testing through a wide range of interfaces. The specific flow is executed through the preset test instance compiled and generated by the TTCN-3 standard test language, so that the efficiency is higher.
The developer can write a preset test instance in advance through a TTCN-3 standard test language, and establish a mapping relation between the preset test instance and the test instruction.
The preset test example comprises a test logic flow corresponding to the test purpose, such as defining a test component, defining a variable, mapping a port, sending a message, starting a timer, receiving the message, analyzing the received message, testing and judging, and determining the flow of the next step (ending the test, sending the message or receiving the message, etc.) according to the judging result.
There are various network protocols in the software defined network SDN network, such as netcon f protocol, BGP-LS protocol, etc.
Step S103, the following process is performed based on the test logic flow.
In this embodiment, the corresponding flow process is performed based on the test logic flow, so as to implement the test.
Step S104, the test data to be sent are encoded, and corresponding encoded test data are generated. The data format of the encoded test data is a data format that can be transmitted over a network.
In this embodiment, the encoding is used to convert the data format of the original TTCN-3 standard test language into a data format capable of network transmission, so as to provide a basis for subsequent data transmission and corresponding test.
Step S105, the coded test data is sent to the target equipment to be tested, so that the target equipment performs corresponding processing based on the coded test data, and test result data is generated.
The corresponding processing of the target device based on the encoded test data may be conversion based on the encoded test data, may be receiving the encoded test data only according to a network protocol, or the like, or may be specifically processed according to actual requirements, which is not limited in this embodiment.
And S106, receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
After receiving the test result data fed back by the target device, the corresponding test result can be determined according to the test result data, for example, whether the test result data meets the preset requirement, whether the test result data is identical to the preset correct data, and the like.
After receiving the test result data, the test result data can be decoded to generate corresponding TTCN-3 language data, so that the subsequent determination of the test result is facilitated.
The embodiment of the application provides a network protocol testing method, which comprises the following steps: and receiving a test instruction sent by the main control equipment. And determining a corresponding preset test instance according to the test instruction. The preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network. The preset test case comprises a corresponding test logic flow of a test object. The following processes are performed based on the test logic flow: and encoding the test data to be transmitted to generate corresponding encoded test data. The data format of the encoded test data is a data format that can be transmitted over a network. And sending the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data, and test result data is generated. And receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
According to the network protocol testing method, a network protocol testing system is adopted to provide a testing environment, one or more slave devices can be adopted to respectively conduct different tests through the framework of the master control device and the slave devices, and the testing efficiency is improved. Meanwhile, the preset test instance for testing is compiled and generated based on TTCN-3 standard test language and is related to the network protocol to be tested corresponding to the software defined network, so that the efficiency of each test flow is further improved.
Fig. 3 is a second flow chart of the network protocol testing method according to the present application, as shown in fig. 3, where the network protocol testing method according to the present embodiment is further refined based on the network protocol testing method according to the previous embodiment of the present application. The network protocol testing method provided in this embodiment includes the following steps.
Step S201, receiving a test instruction sent by the master control device.
In this embodiment, the implementation manner of step 201 is similar to that of step 101 in the previous embodiment, and will not be described in detail here.
Optionally, in this embodiment, before S201, the method further includes the following steps:
it is determined whether a preset test case exists in an on-going state.
If the preset test case in the running state is determined to exist, initializing the preset test case in the running state.
In this embodiment, the running state of the current device may be known by determining whether the preset test case in the running state exists, and if it is determined that the preset test case in the running state exists, the initialization process may be performed on the preset test case in the running state for the test that needs to be performed currently, so as to provide a running space and running resources for the test that needs to be performed currently, and improve the efficiency of the current network protocol test.
It should be noted that the test instruction includes a test type identifier.
Step S202, determining a corresponding preset test instance from a preset database according to the test type identifier. The preset database stores the mapping relation between the test type identifier and the preset test instance.
In this embodiment, the test type identifier is, for example, an update test identifier, a transmission test identifier, a data processing test identifier, or the like. The network protocol test can have various test modes and test contents according to different application scenes. By pre-establishing the mapping relation between the test type identifier and the preset test instance, the corresponding preset test instance can be determined from the preset database directly based on the test type identifier when the network protocol test is actually performed, and the efficiency of determining the preset test instance is improved.
Step S203, the following processing is performed based on the test logic flow:
in this embodiment, the implementation of step 203 is similar to that of step 103 in the previous embodiment, and will not be described in detail here.
Step S204, determining the TTCN-3 data type corresponding to the test data to be sent.
And step S205, calling a corresponding preset coding sub-function according to the TTCN-3 data type by adopting an encoding function to encode the test data to be transmitted, and generating corresponding encoded test data.
TTCN-3 data types are multiple, and more efficient coding processing can be performed by calling corresponding preset coding subfunctions according to different data types. The corresponding preset coding sub-function can be more efficiently called through the encoding function of the encoding, so that the encoding efficiency is improved.
Optionally, in this embodiment, S204 may further include:
and performing variable definition and variable data filling according to a preset test data template corresponding to the preset test instance to generate test data to be sent. The preset test case and the preset test data template have a mapping relation.
And carrying out variable definition and variable data filling on the corresponding preset test data template based on the preset test instance, thereby generating corresponding test data to be transmitted. For example, defining updated data variables in a preset test data template, and determining actual values, so as to obtain test data to be sent, which are adopted in an update test.
In this embodiment, a mapping relationship between a preset test case and a preset test data template may be pre-established, so as to facilitate generation of test data to be sent subsequently.
Step S206, the coded test data is sent to the target equipment to be tested, so that the target equipment performs corresponding processing based on the coded test data, and test result data is generated.
In this embodiment, the implementation manner of step 206 is similar to that of step 105 in the previous embodiment, and will not be described in detail here.
Optionally, in this embodiment, after S206, the method further includes:
a timer is started.
And if the test result data fed back by the target equipment is received before the preset time in the timer is over, determining that the network protocol test is in a normal state.
If the test result data fed back by the target equipment is not received before the preset time in the timer is over, determining that the network protocol test is in an abnormal state.
In this embodiment, by starting the timer, it is further determined whether the network protocol test is in an abnormal state, so that an error test result is avoided when the network protocol test is in an abnormal state, and accuracy of the network protocol test is improved. The setting time of the timer can be set according to actual requirements.
Step S207, receiving test result data fed back by the target device.
The data format of the test result data fed back by the target equipment is a data format capable of network transmission.
And step S208, adopting a decode decoding function to call a decoding sub-function to decode the test result data to generate corresponding TTCN-3 decoding data.
In this embodiment, the decoding result data is decoded by calling the decoding sub-function through the decoding function to generate TTCN-3 decoded data, so that a subsequent test result determining process is conveniently performed. When the decode decoding function calls the decoding sub-function, the decoding sub-function can be correspondingly called according to the TTCN-3 data type corresponding to the test result data.
Step S209, determining a corresponding test result according to the TTCN-3 decoding data and a preset correct test result.
The preset correct test result may be whether the TTCN-3 decoded data meets a preset requirement, whether the TTCN-3 decoded data is identical to the test data to be transmitted, and the like.
Optionally, in this embodiment, the network protocol to be tested is BGP-LS protocol. The preset correct test result is preset correct result data. The preset correct result data is the same as the test data to be sent. The test type identifier is a transport type identifier of the BGP-LS protocol. Wherein S209 may specifically be:
and comparing the TTCN-3 decoding data with a preset correct test result.
If the comparison result of the TTCN-3 decoding data and the preset correct test result is the same, the test result is determined to pass.
If the comparison result of the TTCN-3 decoding data and the preset correct test result is the same, the test result is determined to be not passed.
Aiming at the BGP-LS protocol, whether the network protocol test passes or not can be judged by adopting the mode that the preset correct result data is the same as the test data to be sent.
To describe the testing of the BGP-LS protocol in further detail, as shown in fig. 4, two slaves, slave 1 and slave 2 in the figure, may be employed for testing the BGP-LS protocol in terms of processing update messages of the network protocol, the device under test being the route. Wherein the slave device 1 and the device under test build an internal BGP protocol peer, i.e., BGP protocol peers located in the same autonomous domain AS-1. The slave device 1 and the device under test build external BGP protocol peers, i.e. BGP protocol peers located in different autonomous domains AS (english: autonomous System, chinese: autonomous domain) -1 and AS-2. Test purpose of this example: ensuring that the device under test is able to properly handle the ORIGIN field in the UPDATE message sent by the internal peer.
The test of this embodiment is specifically performed by:
1) A test environment is established according to fig. 4, and normal service of the tested equipment is configured.
2) An internal BGP connection is established with slave 1 and the device under test, and an external BGP connection is established with slave 2 and the device under test.
3) An UPDATE message is sent from device 1 to the device under test, with the ORIGIN field set to INCOMPLETE, NLRI (all in english: network Layer Reachability Information, chinese is: network layer reachable information) field contains an address prefix AS9-NLRI1, and monitors the message sent from the tested device on the slave device 2;
4) An UPDATE message is sent from device 1 to the device under test, with the ORIGIN field set to EGP (all in english: external Gateway Protocol, chinese is external gateway protocol), the NLRI field contains an address prefix AS-NLRI2, and messages sent from the device under test are monitored on the slave device 2.
5) An UPDATE message is sent from device 1 to the device under test, with the ORIGIN field set to IGP (all in english: internal Gateway Protocol, chinese is: internal gateway protocol), the NLRI field contains an address prefix AS9-NLRI3, and messages sent from the device under test are monitored on the slave device 2.
Expected test results:
in step 3), the UPDATE message from the device 2 should be received, wherein the ORIGIN field INCOMPLETE, NLRI contains an address prefix AS9-NLRI1.
In step 4), the UPDATE message from the device 2 should be received, wherein the ORIGIN field is EGP and the NLRI field contains an address prefix AS9-NLRI2.
In step 5), the slave device 2 should be able to receive an UPDATE message from the device under test, where the ORIGIN field is IGP and the NLRI field contains an address prefix AS9-NLRI3.
Satisfying the above results represents a test pass.
For better understanding of the network protocol testing method of the present embodiment, the following will further describe with reference to fig. 5. As shown in fig. 5, the overall architecture (software module) of the slave device of the present embodiment is as follows, and is communicatively connected to the master device and the device under test, respectively:
(1) System adapter
The system adapter realizes communication adaptation between the test system and the tested system, and the TTCN-3 runtime interface (English is called Test Runtime Interface, english is called TRI for short) defines functions to be realized by the system adapter, including the actions of initializing the test system, starting the test, binding, mapping and unmapping ports, transmitting and receiving data and the like.
And when the test system is initialized, the system adapter performs initialization operation on the whole test environment. Initializing related resources of the current test case by the system adapter when the test starts, and releasing the related resources of the current test case by the system adapter when the test ends. And the system adapter establishes corresponding connection according to the requirements of the test protocol when the ports are mapped, and releases the connection when the ports are unmapped. When data is transmitted, the system adapter transmits the data to the opposite terminal through the established connection, and when the data is received, the system adapter acquires the data from the connected buffer area.
And developing a system adapter of the TTCN-3 testing system according to the requirements of the tested equipment and the tested protocol, and taking charge of port mapping and communication between the testing system and the tested system. When the test case starts to execute, a triexeutetestcase function is called, relevant parameters are initialized, and whether the input relevant components are legal or not is judged. When the test case performs Map connection with two ports, a triMap function is called, and corresponding sub threads are started according to input parameters for establishing appointed connection. When the test case performs Unmap to disconnect two ports, a trianmap function is called, and corresponding sub threads are closed and designated connection is disconnected according to input parameters. When the test case performs send sending operation, a triSend function is called, and the coded data stream is sent through the established connection and the input parameters. And after the test case is finished, the system calls a specific tritestCaseEnd function to release the used system resources.
(2) Encoding/decoding device
In order to send a message to the outside through a TTCN-3 port, the running environment of TTCN-3 needs to provide the encoding function. Similarly, the received data must be decoded into TTCN-3 values to match the TTCN-3 template definition. The encoding and decoding module realizes the data encoding and decoding functions of the system. Wherein the encoding section encodes the basic data types of TTCN-3 and the protocol message format composed of these basic data types into a data format that can be network-transmitted with the adapter; the decoding part analyzes the message data received by the system adapter, and combines the corresponding data into a message represented by the TTCN-3 data type, so that the TTCN-3 abstract test sleeve can conveniently analyze, match and the like the data.
Developing a coder-decoder (CD) of a TTCN-3 testing system according to the requirements of tested equipment and a tested protocol, wherein an encoding part encodes the basic data types of the TTCN-3 and SDN protocol message formats formed by the basic data types into a data format capable of being transmitted by an adapter in a network; the decoding part analyzes the message data received by the system adapter, and combines the corresponding data into a message represented by the TTCN-3 data type, so that the TTCN-3 abstract test sleeve can conveniently analyze, match and the like the data. The encode function calls a designated encoding sub-function according to the input TTCN-3 data type and data name, and the input TTCN-3 data is converted into a byte array in the encoding sub-function for network transmission. The decode function calls the appointed decode sub-function according to the input TTCN-3 data type and data name, and acquires data from the received byte array according to the TTCN-3 data type in the decode sub-function to construct a message template for subsequent analysis and matching.
(3) Abstract test suite, namely TTCN-3 in the figure
The abstract test suite is the core of the protocol test, which is written in the TTCN-3 language. In the abstract test suite, test data and logic are described, and mainly include: protocol message format definitions, message template definitions, test system component and port definitions, test cases, test controls, etc. After analyzing the protocol text, summarizing test points, namely test purposes, according to the logic of the protocol, dividing the test purposes according to functions, and finally forming a complete set. According to the test requirement, designing an abstract test sleeve, writing a test script by using a language, and realizing the abstract logic process of the test. The main module is used as an inlet module of the abstract test sleeve, and is used for leading in a test case module to control the execution of the test case; the test case module comprises all test cases, the test cases are divided into logical groups according to different functions, the test cases are conveniently executed according to the functional groups, the test case module imports definitions of basic elements such as message types, templates, components and ports and functions, each test case comprises a test logic process for testing purposes, a typical test case process usually defines a test component, defines a variable, maps a port, sends a message, starts a timer, receives a message, analyzes the received message, tests and judges, and determines the next step (ending the test, sending the message or receiving the message and the like) according to the judging result. Message types, templates, components and ports, functions are basic definitions, defined by different modules, respectively.
According to the test requirement, designing an abstract test sleeve, and writing a test script by using a TTCN-3 language to realize the abstract logic process of the test. An abstract test suite may include a main module and a test case module. The main module is used as an inlet module of the abstract test sleeve, and is used for importing a test case module to control the execution of the test case. The test case module comprises all test cases, the test cases are divided into logical groups according to different functions, the test cases are conveniently executed according to the functional groups, the test case module imports definitions of basic elements such as message types, templates, components and ports and functions, each test case comprises a test logic process for testing purposes, a typical test case process usually defines a test component, defines a variable, maps a port, sends a message, starts a timer, receives a message, analyzes the received message, tests and judges, and determines the next step (ending the test, sending the message or receiving the message and the like) according to the judging result. Message types, templates, components and ports, functions are basic definitions, defined by different modules, respectively.
(4) Test topology construction
According to the requirements of the test protocol, a network topology is constructed by adopting a mode that a plurality of test devices work together. And each test device independently runs test codes with specified functions, simulates the test codes as node devices in network topology, and jointly completes the test on the tested devices.
(5) Test management, test recording, component recording, and platform adapter
The test management is used for managing the test flow operation of the slave equipment, the test record is used for recording test related data, the component record is used for recording the conditions of the components and the components, and the platform adapter is used for constructing a connection relation with the platform.
Fig. 6 is a schematic structural diagram of a network protocol testing device provided by the present application, as shown in fig. 6, in this embodiment, a network protocol testing system includes: a master device and a slave device in communication with each other. The slave device is communicatively connected to the target device to be tested. The apparatus is located in a slave device, and the network protocol testing apparatus 300 includes:
the receiving module 301 is configured to receive a test instruction sent by the master control device.
The determining module 302 is configured to determine a corresponding preset test case according to the test instruction. The preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network. The preset test case comprises a corresponding test logic flow of a test object.
The test module 303 is configured to perform the following processing based on the test logic flow:
and encoding the test data to be transmitted to generate corresponding encoded test data. The data format of the encoded test data is a data format that can be transmitted over a network. And sending the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data, and test result data is generated. And receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
The network protocol testing apparatus provided in this embodiment may execute the technical scheme of the method embodiment shown in fig. 2, and its implementation principle and technical effects are similar to those of the method embodiment shown in fig. 2, and are not described in detail herein.
The network protocol testing apparatus provided by the present application further refines the network protocol testing apparatus based on the network protocol testing apparatus provided in the previous embodiment, and the network protocol testing apparatus 300 includes:
optionally, in this embodiment, the test instruction includes a test type identifier.
The determining module 302 is specifically configured to:
and determining a corresponding preset test instance from a preset database according to the test type identifier. The preset database stores the mapping relation between the test type identifier and the preset test instance.
Optionally, in this embodiment, when the test module 303 encodes the test data to be sent to generate the corresponding encoded test data, the test module is specifically configured to:
and determining the TTCN-3 data type corresponding to the test data to be sent. And calling a corresponding preset coding sub-function according to the TTCN-3 data type by adopting an encoding function to encode the test data to be transmitted, and generating corresponding encoded test data.
Optionally, in this embodiment, when determining the corresponding test result according to the test result data, the test module 303 is specifically configured to:
And adopting a decoding function to call a decoding sub-function to decode the test result data, and generating corresponding TTCN-3 decoding data. And determining a corresponding test result according to the TTCN-3 decoding data and a preset correct test result.
Optionally, in this embodiment, the network protocol to be tested is BGP-LS protocol. The preset correct test result is preset correct result data. The preset correct result data is the same as the test data to be sent. The test type identifier is a transport type identifier of the BGP-LS protocol.
The test module 303 is specifically configured to, when determining a corresponding test result according to the TTCN-3 decoded data and a preset correct test result:
and comparing the TTCN-3 decoding data with a preset correct test result. If the comparison result of the TTCN-3 decoding data and the preset correct test result is the same, the test result is determined to pass. If the comparison result of the TTCN-3 decoding data and the preset correct test result is the same, the test result is determined to be not passed.
Optionally, in this embodiment, the network protocol testing apparatus 300 further includes:
the generating module is used for carrying out variable definition and variable data filling according to a preset test data template corresponding to the preset test instance, and generating test data to be sent. The preset test case and the preset test data template have a mapping relation.
Optionally, in this embodiment, the network protocol testing apparatus 300 further includes:
and the initialization module is used for determining whether a preset test case in an running state exists.
If the preset test case in the running state is determined to exist, initializing the preset test case in the running state.
Optionally, in this embodiment, the network protocol testing apparatus 300 further includes:
and the timing module is used for starting the timer. And if the test result data fed back by the target equipment is received before the preset time in the timer is over, determining that the network protocol test is in a normal state. If the test result data fed back by the target equipment is not received before the preset time in the timer is over, determining that the network protocol test is in an abnormal state.
The network protocol testing apparatus provided in this embodiment may execute the technical scheme of the method embodiment shown in fig. 2 to 5, and its implementation principle and technical effects are similar to those of the method embodiment shown in fig. 2 to 5, and are not described in detail herein.
According to an embodiment of the present application, the present application further provides a network protocol testing system, including: a master device and at least one slave device in communication with each other. The main control equipment is used for controlling the slave equipment to perform corresponding test processing. The slave device is communicatively connected to the target device to be tested. The slave device is configured to implement the network protocol testing method in the above embodiment.
Optionally, in this embodiment, according to the requirement of the test protocol, a network topology is constructed by adopting a mode that a plurality of test devices work together. And each test device independently runs test codes with specified functions, simulates the test codes as node devices in network topology, and jointly completes the test on the tested devices.
The main control equipment is communicated with other node equipment in the network topology through the control network segment, the other node equipment is connected and communicated with the tested system through the test network segment, and the control network segment and the test network segment are mutually isolated, so that interference in the test process is avoided. The user can send instructions to other node devices in the network topology through the main control device, each node device returns the test results to the main control device for summarizing, and the user can complete the whole protocol test flow by only operating the main control device.
For the main application electronic equipment, services such as client data change, full client information inquiry and the like can be added, and the slicing application calls the main application service.
According to embodiments of the present application, the present application also provides an electronic device, a computer-readable storage medium, and a computer program product.
As shown in fig. 7, fig. 7 is a schematic structural diagram of an electronic device provided by the present application. Electronic devices are intended for various forms of digital computers, such as laptops, desktops, personal digital assistants, blade electronics, mainframes, and other appropriate computers. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 7, the electronic device includes: a processor 401 and a memory 402. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device.
Memory 402 is a non-transitory computer readable storage medium provided by the present application. The memory stores instructions executable by the at least one processor to cause the at least one processor to perform the network protocol testing method provided by the application. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to execute the network protocol testing method provided by the present application.
The memory 402 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the receiving module 301, the determining module 302, and the testing module 303 shown in fig. 6) corresponding to the network protocol testing method according to the embodiment of the present application. The processor 401 executes various functional applications of the electronic device and data processing, i.e., implements the network protocol testing method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.
Meanwhile, the present embodiment also provides a computer product, which when executed by a processor of an electronic device, enables the electronic device to execute the network protocol testing method of the above embodiment.
Other implementations of the examples of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of embodiments of the application following, in general, the principles of the embodiments of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the embodiments of the application pertains.
It is to be understood that the embodiments of the application are not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be made without departing from the scope thereof. The scope of embodiments of the application is limited only by the appended claims.

Claims (12)

1. A network protocol testing method, characterized in that the network protocol testing system comprises: a master device and a slave device in communication with each other; the slave device is in communication connection with the target device to be tested; the method is applied to a slave device, the method comprising:
Receiving a test instruction sent by main control equipment;
determining a corresponding preset test instance according to the test instruction; the preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network; the preset test case comprises a corresponding test logic flow of a test object;
based on the test logic flow, the following processing is performed:
coding the test data to be transmitted to generate corresponding coded test data; the data format of the coded test data is a data format capable of network transmission;
transmitting the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data to generate test result data;
and receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
2. The method of claim 1, wherein the test instruction includes a test type identification;
the determining a corresponding preset test case according to the test instruction comprises the following steps:
determining a corresponding preset test instance from a preset database according to the test type identifier; the preset database stores the mapping relation between the test type identifier and a preset test instance.
3. The method of claim 2, wherein encoding the test data to be transmitted to generate corresponding encoded test data comprises:
determining a TTCN-3 data type corresponding to the test data to be sent;
and calling a corresponding preset coding sub-function according to the TTCN-3 data type by adopting an encoding function to encode the test data to be transmitted, and generating corresponding encoded test data.
4. A method according to claim 3, wherein said determining a corresponding test result from said test result data comprises:
adopting a decoding function to call a decoding sub-function to decode the test result data, and generating corresponding TTCN-3 decoding data;
and determining a corresponding test result according to the TTCN-3 decoding data and a preset correct test result.
5. The method of claim 4, wherein the network protocol to be tested is BGP-LS protocol; the preset correct test result is preset correct result data; the preset correct result data are the same as the test data to be sent; the test type identifier is a transmission type identifier of BGP-LS protocol;
the determining a corresponding test result according to the TTCN-3 decoding data and a preset correct test result comprises the following steps:
Comparing the TTCN-3 decoding data with the preset correct test result;
if the comparison result of the TTCN-3 decoding data and the preset correct test result is the same, determining that the test result is passing;
if the comparison result of the TTCN-3 decoding data and the preset correct test result is the same, the test result is determined to be not passed.
6. The method of claim 5, wherein prior to encoding the test data to be transmitted, further comprising:
performing variable definition and variable data filling on the corresponding preset test data templates according to the preset test examples to generate the test data to be sent; the preset test instance and the preset test data template have a mapping relation.
7. The method according to any one of claims 1 to 6, further comprising, before receiving the test instruction sent by the master device:
determining whether a preset test case in an operating state exists;
if the preset test case in the running state is determined to exist, initializing the preset test case in the running state.
8. The method according to any one of claims 1 to 6, further comprising, after the transmitting the encoded test data to the target device to be tested:
Starting a timer;
if the test result data fed back by the target equipment is received before the preset time in the timer is over, determining that the network protocol test is in a normal state;
and if the test result data fed back by the target equipment is not received before the preset time in the timer is over, determining that the network protocol test is in an abnormal state.
9. A network protocol testing apparatus, wherein the network protocol testing system comprises: a master device and a slave device in communication with each other; the slave device is in communication connection with the target device to be tested; the apparatus is located in a slave device, the apparatus comprising:
the receiving module is used for receiving the test instruction sent by the main control equipment;
the determining module is used for determining a corresponding preset test instance according to the test instruction; the preset test instance is compiled and generated based on TTCN-3 standard test language and is related to a network protocol to be tested corresponding to the software defined network; the preset test case comprises a corresponding test logic flow of a test object;
the test module is used for carrying out the following processing based on the test logic flow:
coding the test data to be transmitted to generate corresponding coded test data; the data format of the coded test data is a data format capable of network transmission; transmitting the encoded test data to target equipment to be tested, so that the target equipment carries out corresponding processing based on the encoded test data to generate test result data; and receiving test result data fed back by the target equipment, and determining a corresponding test result according to the test result data.
10. An electronic device, comprising: a memory and a processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the network protocol testing method of any one of claims 1 to 8.
11. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are for implementing the network protocol testing method of any of claims 1 to 8.
12. A network protocol testing system, comprising: a master device and at least one slave device in communication with each other; the main control equipment is used for controlling the slave equipment to perform corresponding test processing; the slave device is in communication connection with the target device to be tested; the slave device is configured to implement the network protocol testing method according to any one of claims 1 to 8.
CN202310620413.9A 2023-05-29 2023-05-29 Network protocol testing method, device, equipment, medium and system Pending CN116886558A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310620413.9A CN116886558A (en) 2023-05-29 2023-05-29 Network protocol testing method, device, equipment, medium and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310620413.9A CN116886558A (en) 2023-05-29 2023-05-29 Network protocol testing method, device, equipment, medium and system

Publications (1)

Publication Number Publication Date
CN116886558A true CN116886558A (en) 2023-10-13

Family

ID=88265049

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310620413.9A Pending CN116886558A (en) 2023-05-29 2023-05-29 Network protocol testing method, device, equipment, medium and system

Country Status (1)

Country Link
CN (1) CN116886558A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117729138A (en) * 2024-02-08 2024-03-19 广州高新兴网联科技有限公司 Internet of vehicles protocol consistency test method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117729138A (en) * 2024-02-08 2024-03-19 广州高新兴网联科技有限公司 Internet of vehicles protocol consistency test method and system
CN117729138B (en) * 2024-02-08 2024-05-28 广州高新兴网联科技有限公司 Internet of vehicles protocol consistency test method and system

Similar Documents

Publication Publication Date Title
WO2017054531A1 (en) Yang model-based compiling method, and corresponding interface, component, and system
US10621124B2 (en) Method, device and computer program product for enabling SR-IOV functions in endpoint device
CN112306884B (en) Program test control, execution method and corresponding device, equipment and medium thereof
CN109840155A (en) A kind of method and device for realizing remote procedure call
CN116886558A (en) Network protocol testing method, device, equipment, medium and system
CN113806037A (en) Service calling method and device, storage medium and electronic equipment
US20220046028A1 (en) Method and system for determining a state of an account in a network device running a light client protocol of a distributed ledger technology network
CN111770122A (en) Service communication agent SCP registration method, service calling method and network equipment
CN113596017A (en) Protocol analysis method, device, soft gateway and storage medium
CN114647422A (en) Vehicle electronic control unit flashing method, device, equipment and medium
CN112395339A (en) Method and device for checking data access between systems, computer equipment and storage medium
US20100161836A1 (en) Method port arrangement and configuration method thereof for robot software component
CN115277641B (en) Address sharing method and device, electronic equipment and storage medium
CN109068170B (en) Storage method, device, terminal and storage medium for barrage message
CN114285859B (en) Data processing method, device, equipment and storage medium for middle layer block chain service
CN111459819B (en) Software testing method and device, electronic equipment and computer readable medium
WO2022067509A1 (en) Device upgrade control method and apparatus, and computer device and storage medium
CN110548285B (en) Game communication control method and device, medium and electronic equipment
CN108288135B (en) System compatibility method and device, computer readable storage medium and electronic equipment
EP4350511A1 (en) Method and apparatus for co-simulation
CN114428924A (en) Service request processing method and system based on GRPC framework
CN116185424A (en) Signal transmission method, signal transmission device, electronic equipment, storage medium and vehicle
CN117424925A (en) Micro-service application calling method and electronic equipment
CN117950987A (en) Script verification method and device, electronic equipment and storage medium
CN116566911A (en) Load balancing method, load balancing device, electronic equipment and computer readable storage medium

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