Network testing method, device, equipment, system and storage medium
By creating a sandbox cloud host on a physical server for network function testing, the problem of slow creation of real cloud hosts is solved, and efficient and low-cost network automation testing is achieved.
Patent Information
- Application Number
- CN202410218657.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-27
- Publication Date
- 2025-08-29
AI Technical Summary
In the prior art, creating real cloud hosts is slow and time-consuming, resulting in low network automation testing efficiency and high cost, and occupying cloud host resources.
By creating a sandbox cloud host, using a sandbox execution unit to implement network function testing on the physical server, the creation and destruction speed of the sandbox cloud host is in seconds, and the network function testing is simulated in a real cloud host environment.
Improves the efficiency of network automation testing, reduces the time and cost of creating a test environment, and has good compatibility and portability.
Smart Images

Figure CN120567731A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a network testing method, apparatus, device, system, and storage medium. Background Art
[0002] In the cloud computing network field, to ensure the stability of backend products and network infrastructure, network function testing and verification are required for new product releases, feature iterations, and rollouts. Regression verification of network functions is typically performed through automated testing. Automated testing relies on creating the required test environment. In the same-subnet cloud host communication testing scenario, two cloud hosts within the same subnet must be created to test network connectivity between them.
[0003] In the prior art, the process of performing network automation testing in the above test scenario is: calling the cloud service provider's OpenAPI to create two real cloud hosts, entering the real cloud hosts to perform network function testing, and after the test is completed, calling the cloud service provider's OpenAPI to destroy the created real cloud hosts.
[0004] However, creating real cloud hosts on cloud service providers is slow and time-consuming, and destroying cloud hosts is also time-consuming. The efficiency of creating test environments restricts the efficiency of automated testing, resulting in low efficiency of network automated testing. Furthermore, the need to create real cloud hosts for testing occupies cloud host resources, leading to high network testing costs. Summary of the Invention
[0005] The embodiments of the present application provide a network testing method, apparatus, device, system, and storage medium, which reduce the time required to create a test environment, improve the efficiency of network automated testing, and reduce the cost of network automated testing.
[0006] In a first aspect, an embodiment of the present application provides a network testing method, comprising:
[0007] Receive a request from a client to create a sandbox cloud host, and create a first sandbox cloud host so that the first sandbox cloud host is hosted on a first physical server;
[0008] Sending the instance identifier of the first sandbox cloud host to the client;
[0009] receiving a request from the client to access the first sandbox cloud host, and forwarding the request to access the first sandbox cloud host to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host;
[0010] Based on the communication connection, a network function test is performed inside the first sandbox cloud host.
[0011] In a second aspect, an embodiment of the present application provides a network testing device, comprising:
[0012] The receiving module is used to receive a request from a client to create a sandbox cloud host;
[0013] A processing module, configured to create a first sandbox cloud host, so that the first sandbox cloud host is hosted on a first physical server;
[0014] A sending module, configured to send the instance identifier of the first sandbox cloud host to the client;
[0015] The receiving module is further configured to: receive a request from the client to access the first sandbox cloud host;
[0016] The sending module is further configured to: forward the request for accessing the first sandbox cloud host to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host;
[0017] A testing module is used to perform a network function test inside the first sandbox cloud host based on the communication connection.
[0018] In a third aspect, an embodiment of the present application provides a network testing system, including a sandbox main service unit, a sandbox execution unit, and a sandbox access gateway;
[0019] The sandbox main service unit is configured to: receive a request from a client to create a sandbox cloud host, create a first sandbox cloud host resource object so that the first sandbox cloud host resource object is hosted on a first physical server, and send a request to the sandbox execution unit to create the first sandbox cloud host;
[0020] The sandbox execution unit is configured to: receive the request to create the first sandbox cloud host and create the first sandbox cloud host, wherein the sandbox execution unit is located on the first physical server;
[0021] The sandbox main service unit is further configured to: send the instance identifier of the first sandbox cloud host to the client;
[0022] The sandbox access gateway is configured to: receive a request from the client to access the first sandbox cloud host, and forward the request to access the first sandbox cloud host to the sandbox execution unit;
[0023] The sandbox execution unit is further configured to establish a communication connection between the client and the first sandbox cloud host, and perform a network function test inside the first sandbox cloud host based on the communication connection.
[0024] In a fourth aspect, an embodiment of the present application provides a computer device, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory to execute the method of the first aspect.
[0025] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, which enables a computer to execute the method of the first aspect.
[0026] In a sixth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect.
[0027] In summary, in an embodiment of the present application, a first sandbox cloud host is created by receiving a request to create a sandbox cloud host sent by a client, so that the first sandbox cloud host is carried on a first physical server, and the instance identifier of the first sandbox cloud host is sent to the client, thereby realizing the creation of the sandbox cloud host. After receiving a request to access the first sandbox cloud host sent by the client, the request to access the first sandbox cloud host is forwarded to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host, and then performs a network function test inside the first sandbox cloud host based on the communication connection, thereby realizing network automation testing using the created sandbox cloud host. Since the creation speed and destruction speed of the sandbox cloud host are in seconds, the creation and destruction performance is improved compared to creating a real cloud host, which greatly reduces the time required to create a test environment and improves the efficiency of network automation testing. Moreover, since it does not need to occupy real computing resources, the cost of network automation testing is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0029] Figure 1 A schematic diagram of an implementation scenario of a network testing method provided in an embodiment of the present application;
[0030] Figure 2 A flowchart of a network testing method provided in an embodiment of the present application;
[0031] Figure 3 A flowchart of a network testing method provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of the structure of a network testing system provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of an interactive process of a network testing method provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of the structure of a sandbox testing system provided in an embodiment of the present application;
[0035] Figure 7 A schematic diagram of the structure of a sandbox main service unit provided in an embodiment of the present application;
[0036] Figure 8 A schematic diagram of the process of creating a sandbox cloud host provided in an embodiment of the application;
[0037] Figure 9 A schematic diagram of a flow chart of a network function test provided in an embodiment of the present application;
[0038] Figure 10 A schematic diagram of a framework of a sandbox execution unit provided in an embodiment of the present application;
[0039] Figure 11 A schematic diagram of the structure of a network testing device provided in an embodiment of the present application;
[0040] Figure 12 It is a schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0042] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] The embodiments of the present application may involve cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or a local area network to realize data calculation, storage, processing, and sharing.
[0044] Cloud technology is a general term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies based on the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a crucial support. Backend services for technical network systems, such as video websites, image websites, and more portals, require extensive computing and storage resources. With the rapid development and application of the internet industry, every item will likely have its own unique identifier, requiring transmission to backend systems for logical processing. Different levels of data will be processed separately, and data from various industries will require a strong system backend, which can only be achieved through cloud computing.
[0045] Embodiments of this application may involve a private cloud. A private cloud is a cloud infrastructure with software and hardware resources built within a firewall, allowing departments within an organization or enterprise to share data center resources. In addition to hardware resources, creating a private cloud typically also includes cloud infrastructure (IaaS) software.
[0046] Private cloud computing also encompasses three layers: cloud hardware, cloud platform, and cloud services. The difference is that the cloud hardware is the user's own personal computer or server, rather than the cloud computing vendor's data center. Cloud computing vendors build data centers to provide public cloud services to millions of users, requiring tens or even millions of servers. Private cloud computing, for individuals, only serves friends and family, while for businesses, only serves their employees, customers, and suppliers. Therefore, an individual or business's own personal computer or server is sufficient for providing cloud services.
[0047] The present application may involve a public cloud. A public cloud generally refers to a cloud provided by a third-party provider for user use. Public clouds are typically available over the Internet and may be free or inexpensive. The core attribute of a public cloud is shared resource services. There are numerous instances of this type of cloud, providing services across today's open public networks.
[0048] Embodiments of this application may involve hybrid clouds, which integrate public and private clouds and have been a major model and development direction for cloud computing in recent years. Private clouds are primarily targeted at enterprise users. For security reasons, enterprises prefer to store data in private clouds, but at the same time, they want to access the computing resources of public clouds. In this context, hybrid clouds are increasingly being adopted, mixing and matching public and private clouds to achieve optimal results. This personalized solution achieves both cost-saving and security goals.
[0049] Before introducing the technical solutions of the embodiments of the present application, the following is an introduction to the relevant knowledge of the embodiments of the present application:
[0050] 1. OpenAPI: OpenAPI is a specification for describing and documenting RESTful APIs. It provides a standard, easy-to-understand format for defining API endpoints, request parameters, response structure, and other information. By using OpenAPI, developers can automatically generate API client and server stubs, as well as interactive documentation, improving development efficiency and reducing errors.
[0051] 2. Domain Name System (DNS): This is a distributed database system used to convert human-readable domain names (such as www.example.com) into their corresponding IP addresses (such as 192.0.2.1). DNS plays a key role in the internet, allowing users to access websites and online services by entering easy-to-remember domain names instead of having to remember complex IP addresses.
[0052] 3. IP Address (Internet Protocol Address): This is a numerical label used by the Internet Protocol (IP) to identify devices on a network. Every device connected to the internet requires a unique IP address for communication. IP addresses are divided into two types: IPv4 (32 bits) and IPv6 (128 bits). For example, the IPv4 address is 192.168.1.1, and the IPv6 address is 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
[0053] 4. MAC Address (Media Access Control Address): This is the hardware address used to uniquely identify a network interface controller (NIC) at the data link layer (Layer 2 of the OSI model). A device's MAC address is typically assigned by the network adapter manufacturer and is globally unique and fixed. A MAC address consists of 12 hexadecimal digits, for example: 00:1A:2B:3C:4D:5E.
[0054] 5. MySQL: MySQL is an open-source relational database management system (RDBMS) that uses Structured Query Language (SQL) for data operations. It boasts high performance, stability, ease of use, and flexibility, making it widely used in various application systems and website development for storing, querying, and managing data.
[0055] 6. SSH (Secure Shell): SSH is an encrypted network transmission protocol used to enable secure remote login, data transmission, and command execution in insecure network environments. SSH uses public key encryption and digital signatures to protect the privacy and integrity of data during transmission, preventing security threats such as man-in-the-middle attacks. Common SSH applications include remotely logging into Linux servers using an SSH client such as PuTTY.
[0056] 7. Network Namespace: This is a virtualization technology in the Linux kernel that isolates and manages different network resources (such as interfaces, routing tables, and firewall rules). By creating independent network namespaces, users can assign dedicated network configurations and connections to each namespace, enabling multiple virtual network environments to run concurrently on the same physical device, improving resource utilization and security. Network namespaces are often used for network isolation in container technologies such as Docker.
[0057] 8. Containers: Containers are a lightweight virtualization technology that allows multiple applications to run in isolation on the same physical machine, each in an independent environment. By encapsulating an application along with its dependent libraries, configuration files, and other resources, containers enable rapid deployment, portability, and efficient resource utilization. Compared to traditional virtual machine technology, containers offer lower performance overhead and faster startup times.
[0058] 9. Docker: Docker is an open-source container platform that simplifies the creation, deployment, and management of containers. Docker provides a complete set of tools and an ecosystem, including Docker Engine (container runtime), Docker Compose (multi-container orchestration), and Docker Hub (container image repository), enabling developers to easily build, share, and run containerized applications.
[0059] 10. Shell: In the Linux operating system, a shell is a command-line interpreter that allows users to interact with the operating system by entering text commands. Shells can not only execute simple commands but also support complex scripting for automated tasks and system management. Common Linux shells include Bash (Bourne Again Shell), Zsh (ZShell), and Fish (Friendly Interactive Shell).
[0060] 11. Hypertext Transfer Protocol (HTTP): An application-layer protocol for data transmission and communication on the World Wide Web. HTTP defines the request and response format between clients (such as browsers) and servers, supporting the transmission of a variety of data types, including text, images, audio, and video.
[0061] In existing network testing methods, the efficiency of creating a test environment is low. In network automation testing, dozens or even hundreds of tests are often involved, and each test requires the creation of a test environment. The efficiency of creating a test environment restricts the efficiency of test automation operation, resulting in low efficiency of network automation testing. Moreover, since a real cloud host needs to be created for testing, cloud host resources are occupied, resulting in high network testing costs.
[0062] To solve this technical problem, an embodiment of the present application provides a network testing system, which is a lightweight sandbox testing system. The lightweight sandbox testing system is used to replace the real test environment. Through the sandbox testing system, the time required to create the test environment is greatly reduced, and the efficiency of automated testing is improved. Moreover, since there is no need to occupy real computing resources, the bottom layer only creates a virtual network isolation environment, thereby reducing the cost of network automated testing.
[0063] Furthermore, because the sandbox system fully implements OpenAPI and SSH protocols, the access point of the sandbox environment is exactly the same as that of the real cloud host, thus ensuring excellent compatibility and portability. Furthermore, by using technologies such as containers and network namespaces to implement the sandbox cloud host, network isolation is achieved while providing full Linux command support, allowing for unrestricted testing of any network function within the sandbox cloud host.
[0064] An embodiment of the present application provides a network testing method, which is applied to a sandbox testing system. By receiving a request to create a sandbox cloud host sent by a client, a first sandbox cloud host is created, so that the first sandbox cloud host is carried on a first physical server, and the instance identifier of the first sandbox cloud host is sent to the client, thereby realizing the creation of the sandbox cloud host. After receiving a request to access the first sandbox cloud host sent by the client, the request to access the first sandbox cloud host is forwarded to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host, and then according to the communication connection, a network function test is performed inside the first sandbox cloud host, thereby realizing the use of the created sandbox cloud host for network automation testing. Since the creation speed and destruction speed of the sandbox cloud host are in seconds, the creation and destruction performance is improved compared to creating a real cloud host, which greatly reduces the time required to create a test environment and improves the efficiency of network automation testing. Moreover, since it does not need to occupy real computing resources, the cost of network automation testing is reduced.
[0065] The embodiments of the present application can be applied to network testing scenarios and can be applied to the underlying automated testing of cloud network related products, such as the testing of private networks (VPCs) in cloud networks, the testing of cloud enterprise networks (CCNs), the testing of load balancing (CLBs), and the testing of security groups. Among them, private networks can build isolated, self-configured virtual network environments for cloud resources. Cloud enterprise networks provide high-speed and stable network interoperability between cloud network instances through automatic routing distribution learning. Load balancing is a service that distributes access traffic to multiple back-end servers according to policies, which can expand the system's external service capabilities, eliminate single points of failure, and thus improve the overall availability of the system. In the field of cloud networks, a security group is a virtual firewall used to control and limit the inbound and outbound network traffic of a group of cloud servers (cloud hosts). By setting security group rules, users can allow or deny specific IP addresses, protocols, and ports to access cloud servers, thereby improving the security of cloud servers.
[0066] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios described below are only used to illustrate the embodiments of the present application and are not limiting. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0067] For example, Figure 1 A schematic diagram of an implementation scenario of a network testing method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the implementation scenario of the embodiment of the present application involves a server 1 and a terminal device 2, and the terminal device 2 can communicate data with the server 1 through a communication network.
[0068] In some implementations, terminal device 2 refers to a device that has a variety of human-computer interaction methods, has Internet access, is typically equipped with various operating systems, and has strong processing capabilities. Terminal device 2 includes, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc.
[0069] In one embodiment, a network test client can be installed and run on the terminal device 2, and the user can use the network test client to perform network testing. Specifically, the client sends a request to create a sandbox cloud host, and after the server receives the request to create a sandbox cloud host, it executes the network testing method provided in the embodiment of the application.
[0070] Figure 1 The server 1 in the example may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. This embodiment of the present application does not impose any restrictions on this.
[0071] The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.
[0072] The technical solutions of the embodiments of the present application are described in detail below:
[0073] Figure 2 A flowchart of a network testing method provided in an embodiment of the present application, wherein the execution subject of the method may be a network testing device or a network testing system, wherein the network testing device may be a computer device, such as Figure 2 As shown, the method may include the following steps:
[0074] S101: Receive a request from a client to create a sandbox cloud host, and create a first sandbox cloud host so that the first sandbox cloud host is hosted on a first physical server.
[0075] Specifically, the client can be a client corresponding to the network testing program. When a certain network test needs to be performed, the network testing program that executes the network test can call the sandbox open application programming interface (OpenAPI) to create a sandbox cloud host. At this time, the client sends a request to the network testing device to create a sandbox cloud host. Optionally, the input and response of the sandbox OpenAPI in this embodiment conform to the cloud host management interface specification provided by the cloud service provider. The purpose of setting this interface specification is to make the interface of the network testing device consistent with the interface of the existing cloud service provider, so that the network testing program can be compatible with the sandbox testing environment without any modification. For example, a network testing program that originally uses the XX cloud environment to perform network function testing on the XX cloud can directly use the sandbox environment to immediately create a virtual test environment by modifying the OpenAPI interface call address.
[0076] In this embodiment, the created first sandbox cloud host is a virtual cloud host and needs to be hosted on a physical server.
[0077] Specifically, in one practicable manner, receiving a request for creating a sandbox cloud host sent by a client in S101 may specifically include: receiving a request for creating a sandbox cloud host sent by the client by calling a sandbox open application programming interface (OpenAPI).
[0078] In this embodiment, the client sends a request to create a sandbox cloud host by calling the sandbox OpenAPI. The calling interface (i.e., the sandbox OpenAPI) and the cloud service provider have the same interface specifications, allowing network automation testing programs to be integrated without modification, with strong portability and compatibility. The sandbox OpenAPI provides functions such as adding sandbox cloud hosts, deleting sandbox cloud hosts, modifying sandbox cloud hosts, and querying sandbox cloud hosts.
[0079] Specifically, as an implementable method, the first sandbox cloud host is created in S101, which may be:
[0080] S1011. Create a first sandbox cloud host resource object and store data structure information of the first sandbox cloud host resource object. The data structure information of the first sandbox cloud host resource object includes an instance identifier and cloud network attribute data of the first sandbox cloud host.
[0081] Specifically, the cloud network attribute data may include an IP address and a MAC address, among others. The instance identifier of the first sandbox cloud host may be a virtual instance identifier (ID). The first sandbox cloud host resource object includes the virtual instance identifier and real cloud network attribute data. By simulating the data structure, a complete sandbox cloud host resource object is generated. The sandbox cloud host resource object has the same data structure information as the real cloud host.
[0082] Optionally, the data structure information of the first sandbox cloud host resource object may be stored in a database, for example, a database such as MySQL, or a file database.
[0083] S1012: Determine a first physical server for hosting a first sandbox cloud host resource object, and store a mapping relationship between an instance identifier of the first sandbox cloud host and an Internet Protocol IP address of the first physical server in a mapping table.
[0084] Specifically, determining the first physical server for hosting the first sandbox cloud host resource object may involve selecting a physical server from a plurality of preset physical servers as the first physical server, or selecting a preset physical server as the first physical server. After determining the first physical server, a mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server is stored in a mapping table.
[0085] Optionally, as an implementable manner, the mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server is stored in a mapping table. Specifically, the mapping relationship between the instance identifier of the first sandbox cloud host resource object and the IP address of the first physical server can be stored in the mapping table as Domain Name System (DNS) configuration information. The mapping relationship between the first sandbox cloud host and the first physical server is provided through DNS.
[0086] S1013: Send a request to create a first sandbox cloud host to the first physical server, so that the first physical server creates the first sandbox cloud host.
[0087] Specifically, as an implementable manner, in S1013, sending a request to the first physical server to create a first sandbox cloud host may be:
[0088] The application programming interface of the sandbox execution unit on the first physical server is called to send a request to the sandbox execution unit to create a first sandbox cloud host, so that the sandbox execution unit creates the first sandbox cloud host. Optionally, the first sandbox cloud host created can be a network namespace sandbox cloud host or a container-type sandbox cloud host. These two types of sandbox cloud hosts can be deployed in a mixed manner on the first physical server at the same time. For example, the first sandbox cloud host created is a network namespace sandbox cloud host, and the second sandbox cloud host created is a container-type sandbox cloud host. The first sandbox cloud host and the second sandbox cloud host can be deployed in a mixed manner on the first physical server at the same time. By creating a network namespace sandbox cloud host or a container-type sandbox cloud host, network isolation can be adapted and supported. Different network test programs can initiate the creation of different sandbox cloud hosts, simulating a real cloud host through a network isolation environment. Because for network function testing, the sandbox cloud host only needs to have an isolated and real network environment (IP address, MAC address, network card, etc.), without requiring a complete computing environment, these requirements can be met through the Linux kernel's network namespace and container (Docker) technologies.
[0089] In the embodiment of the present application, when the provided network testing device is used, it is only necessary to modify the interface call address of the network testing program, for example, switching from a real XX cloud API address to the address of the sandbox OpenAPI, to achieve the creation of a sandbox cloud host. The created sandbox cloud host is a virtual cloud host object. The sandbox cloud host has complete computing properties and network properties and can be used for real network function testing.
[0090] S102: Send the instance identifier of the first sandbox cloud host to the client.
[0091] After the creation of the first sandbox cloud host is completed, the instance identifier of the first sandbox cloud host can be sent to the client so that the client can know that the creation is complete and know the instance identifier of the created first sandbox cloud host for subsequent access and network function testing.
[0092] S103: Receive a request from the client to access the first sandbox cloud host, and forward the request to access the first sandbox cloud host to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host.
[0093] Specifically, after the first sandbox cloud host is created, the first sandbox cloud host can be accessed and a network function test can be performed.
[0094] Optionally, in one embodiment, the request for accessing the first sandbox cloud host is a Secure Shell (SSH) request, and the SSH request carries the instance identifier of the first sandbox cloud host.
[0095] S104: Perform a network function test inside the first sandbox cloud host based on the communication connection.
[0096] Optionally, in an implementable manner, S104 may specifically be:
[0097] S1041. Send a network test command to the first sandbox cloud host according to the communication connection, so that the first sandbox cloud host performs a corresponding network test according to the network test command and obtains a network test result.
[0098] S1042: Receive the network test result sent by the first sandbox cloud host.
[0099] In the embodiment of the present application, the client can access the first sandbox cloud host through SSH request, enter the first sandbox cloud host, bind the stdin / stdout / stderr file descriptors of the first sandbox cloud host, and achieve full shell support, supporting the input and output of any command, so as to execute system commands, network test commands, etc. to perform network function testing. Because the SSH protocol is supported, the network test program can also use the network test system provided by the embodiment of the present application to perform network function testing without any modification, which has strong compatibility and portability.
[0100] Furthermore, in one embodiment, the method of this embodiment may further include:
[0101] S105: Receive a request from the client to destroy the first sandbox cloud host.
[0102] S106: Delete the first sandbox cloud host.
[0103] Optionally, in an practicable manner, S106 may specifically be:
[0104] S1061. Delete the stored data structure information of the first sandbox cloud host resource object.
[0105] S1062: Delete the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table.
[0106] S1063: Send a request to delete the first sandbox cloud host to the first physical server, so that the first physical server deletes the first sandbox cloud host.
[0107] In this embodiment, the function of destroying the first sandbox cloud host is provided, and the destruction speed is in seconds. Therefore, the speed of creating and destroying cloud hosts in the embodiment of the present application is greatly improved.
[0108] The network testing method provided in this embodiment creates a first sandbox cloud host by receiving a request from a client to create a sandbox cloud host, so that the first sandbox cloud host is carried on a first physical server, and the instance identifier of the first sandbox cloud host is sent to the client, thereby realizing the creation of the sandbox cloud host. After receiving a request from the client to access the first sandbox cloud host, the request to access the first sandbox cloud host is forwarded to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host, and then performs a network function test inside the first sandbox cloud host based on the communication connection, thereby realizing network automation testing using the created sandbox cloud host. Since the creation speed and destruction speed of the sandbox cloud host are in seconds, the creation and destruction performance is improved compared to creating a real cloud host, which greatly reduces the time required to create a test environment and improves the efficiency of network automation testing. Moreover, since it does not need to occupy real computing resources, the cost of network automation testing is reduced.
[0109] The following describes in detail the specific process of the network testing method provided in the embodiment of the present application in conjunction with a specific embodiment through the interaction process between the client and the network testing device.
[0110] Figure 3 A flowchart of a network testing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the method of this embodiment may include the following steps:
[0111] S201. The client sends a request to create a sandbox cloud host to the network testing device.
[0112] Specifically, the client can be the client corresponding to the network testing program. When a certain network test needs to be performed, the network testing program that executes the network test can call the sandbox open application programming interface (OpenAPI) to create a sandbox cloud host. At this time, the client sends a request to create a sandbox cloud host to the network testing device.
[0113] Optionally, the input and response of the sandbox OpenAPI in this embodiment comply with the cloud host management interface specification provided by the cloud service provider. The purpose of setting this interface specification is to make the interface of the network testing equipment consistent with the interface of the existing cloud service provider, so that the network testing program can be compatible with the sandbox testing environment without any modification. For example, a network testing program that originally uses the XX cloud environment to perform network function testing on the XX cloud can directly use the sandbox environment to immediately create a virtual testing environment by modifying the OpenAPI interface call address.
[0114] Optionally, in one embodiment, the client sends a request to the network testing device to create a sandbox cloud host. Specifically, the client can send a request to the network testing device to create a sandbox cloud host by calling the sandbox OpenAPI. In this embodiment, the sandbox OpenAPI and the cloud service provider have the same interface specifications, allowing network automated testing programs to integrate without modification, ensuring strong portability and compatibility. The sandbox OpenAPI provides functions such as adding, deleting, modifying, and querying sandbox cloud hosts.
[0115] S202: After receiving the request for creating a sandbox cloud host sent by the client, the network testing device creates a first sandbox cloud host, so that the first sandbox cloud host is hosted on a first physical server.
[0116] Specifically, after the network testing device receives the request to create a sandbox cloud host sent by the client, it creates a sandbox cloud host. The first sandbox cloud host in this embodiment is a sandbox cloud host created. The created first sandbox cloud host is a virtual cloud host and needs to be hosted on a physical server.
[0117] Specifically, as an implementable manner, in S202, the network testing device creates a first sandbox cloud host, which may be:
[0118] S2021. Create a first sandbox cloud host resource object and store data structure information of the first sandbox cloud host resource object. The data structure information of the first sandbox cloud host resource object includes the instance identifier and cloud network attribute data of the first sandbox cloud host.
[0119] Specifically, the cloud network attribute data may include an IP address and a MAC address, among others. The instance identifier of the first sandbox cloud host may be a virtual instance identifier (ID). The first sandbox cloud host resource object includes the virtual instance identifier and real cloud network attribute data. By simulating the data structure, a complete sandbox cloud host resource object is generated. The sandbox cloud host resource object has the same data structure information as the real cloud host.
[0120] Optionally, the data structure information of the first sandbox cloud host resource object may be stored in a database, for example, a database such as MySQL, or a file database.
[0121] S2022: Determine a first physical server for hosting a first sandbox cloud host resource object, and store a mapping relationship between an instance identifier of the first sandbox cloud host and an IP address of the first physical server in a mapping table.
[0122] Specifically, determining the first physical server for hosting the first sandbox cloud host resource object may involve selecting a physical server from a plurality of preset physical servers as the first physical server, or selecting a preset physical server as the first physical server. After determining the first physical server, a mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server is stored in a mapping table.
[0123] Optionally, as an implementable manner, the mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server is stored in a mapping table. Specifically, the mapping relationship between the instance identifier of the first sandbox cloud host resource object and the IP address of the first physical server can be stored in the mapping table as Domain Name System (DNS) configuration information. The mapping relationship between the first sandbox cloud host and the first physical server is provided through DNS.
[0124] S2023. Send a request to create a first sandbox cloud host to the first physical server, so that the first physical server creates the first sandbox cloud host.
[0125] Specifically, as an implementable manner, in S2023, a request to create a first sandbox cloud host is sent to the first physical server, which may be:
[0126] The application programming interface of the sandbox execution unit on the first physical server is called to send a request to the sandbox execution unit to create a first sandbox cloud host, so that the sandbox execution unit creates the first sandbox cloud host. Optionally, the first sandbox cloud host created can be a network namespace sandbox cloud host or a container-type sandbox cloud host. These two types of sandbox cloud hosts can be deployed in a mixed manner on the first physical server at the same time. For example, the first sandbox cloud host created is a network namespace sandbox cloud host, and the second sandbox cloud host created is a container-type sandbox cloud host. The first sandbox cloud host and the second sandbox cloud host can be deployed in a mixed manner on the first physical server at the same time. By creating a network namespace sandbox cloud host or a container-type sandbox cloud host, network isolation can be adapted and supported. Different network test programs can initiate the creation of different sandbox cloud hosts, simulating a real cloud host through a network isolation environment. Because for network function testing, the sandbox cloud host only needs to have an isolated and real network environment (IP address, MAC address, network card, etc.), without requiring a complete computing environment, these requirements can be met through the Linux kernel's network namespace and container (Docker) technologies.
[0127] In the embodiment of the present application, when the provided network testing device is used, it is only necessary to modify the interface call address of the network testing program, for example, switching from a real XX cloud API address to the address of the sandbox OpenAPI, to achieve the creation of a sandbox cloud host. The created sandbox cloud host is a virtual cloud host object. The sandbox cloud host has complete computing properties and network properties and can be used for real network function testing.
[0128] S203: The network testing device sends the instance identifier of the first sandbox cloud host to the client.
[0129] Specifically, after the network testing device completes the creation of the first sandbox cloud host, it can send the instance identifier of the first sandbox cloud host to the client so that the client knows that the creation is complete, and knows the instance identifier of the created first sandbox cloud host for subsequent access and network function testing.
[0130] S204: The client sends a request to the network testing device to access the first sandbox cloud host.
[0131] Specifically, after the first sandbox cloud host is created, the first sandbox cloud host can be accessed and a network function test can be performed.
[0132] S205. The network testing device forwards the request for accessing the first sandbox cloud host to the first physical server, so that the first physical server can establish a communication connection between the client and the first sandbox cloud host.
[0133] Optionally, in one embodiment, the request for accessing the first sandbox cloud host is a Secure Shell (SSH) request, and the SSH request carries the instance identifier of the first sandbox cloud host.
[0134] S206. The network testing device performs a network function test inside the first sandbox cloud host based on the communication connection.
[0135] Optionally, in an implementable manner, S206 may specifically be:
[0136] S2061. The network testing device sends a network testing command to the first sandbox cloud host according to the communication connection, so that the first sandbox cloud host performs a corresponding network test according to the network testing command and obtains a network test result.
[0137] S2062. The network testing device receives the network test result sent by the first sandbox cloud host.
[0138] In the embodiment of the present application, the client can access the first sandbox cloud host through SSH request, enter the first sandbox cloud host, bind the stdin / stdout / stderr file descriptors of the first sandbox cloud host, and achieve full shell support, supporting the input and output of any command, so as to execute system commands, network test commands, etc. to perform network function testing. Because the SSH protocol is supported, the network test program can also use the network test system provided by the embodiment of the present application to perform network function testing without any modification, which has strong compatibility and portability.
[0139] S207: The client sends a request to the network testing device to destroy the first sandbox cloud host.
[0140] S208. The network testing device deletes the first sandbox cloud host.
[0141] In one embodiment, the network testing device may delete the first sandbox cloud host by:
[0142] S2081. The network testing device deletes the stored data structure information of the first sandbox cloud host resource object.
[0143] S2082. The network testing device deletes the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table.
[0144] S2083. The network testing device sends a request to delete the first sandbox cloud host to the first physical server, so that the first physical server deletes the first sandbox cloud host.
[0145] In this embodiment, the function of destroying the first sandbox cloud host is provided, and the destruction speed is in seconds. Therefore, the speed of creating and destroying the cloud host in the embodiment of the present application is greatly improved.
[0146] The network testing method provided in this embodiment implements automated network testing using a created sandbox cloud host. Because sandbox cloud hosts can be created and destroyed in seconds, compared to creating a real cloud host, the creation and destruction performance is improved, significantly reducing the time required to create a test environment and improving the efficiency of automated network testing. Furthermore, since only a virtual, isolated network environment is created without requiring real computing resources, the cost of automated network testing is reduced.
[0147] Figure 4 A schematic diagram of the structure of a network testing system provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the network testing system of this embodiment includes a sandbox main body service unit 110 , a sandbox execution unit 210 and a sandbox access gateway 310 .
[0148] Alternatively, in one embodiment, the sandbox service unit 110 and the sandbox access gateway 310 may be deployed on the same server or server cluster, and the sandbox execution unit 210 may be deployed on a computing node. In one embodiment, the sandbox service unit 110, the sandbox execution unit 210, and the sandbox access gateway 310 may be deployed on the same server or on different servers.
[0149] The sandbox main service unit 110 is used to: receive a request from the client to create a sandbox cloud host, create a first sandbox cloud host resource object so that the first sandbox cloud host resource object is hosted on the first physical server, and send a request to the sandbox execution unit 210 to create a first sandbox cloud host.
[0150] The sandbox execution unit 210 is used to receive a request to create a first sandbox cloud host and create the first sandbox cloud host. The sandbox execution unit 210 is located on the first physical server.
[0151] The sandbox main service unit 110 is further configured to send the instance identifier of the first sandbox cloud host to the client.
[0152] The sandbox access gateway 310 is configured to receive a request from a client to access the first sandbox cloud host, and forward the request to access the first sandbox cloud host to the sandbox execution unit 210 .
[0153] The sandbox execution unit 210 is further configured to establish a communication connection between the client and the first sandbox cloud host, and perform a network function test within the first sandbox cloud host based on the communication connection.
[0154] In one embodiment, the sandbox service unit 110 is configured to:
[0155] A first sandbox cloud host resource object is created, and data structure information of the first sandbox cloud host resource object is stored. The data structure information of the first sandbox cloud host resource object includes an instance identifier and cloud network attribute data of the first sandbox cloud host.
[0156] A first physical server for hosting a first sandbox cloud host resource object is determined, and a mapping relationship between an instance identifier of the first sandbox cloud host and an IP address of the first physical server is stored in a mapping table.
[0157] In one embodiment, the sandbox service unit 110 is specifically configured to:
[0158] The mapping relationship between the instance identifier of the first sandbox cloud host resource object and the IP address of the first physical server is stored in the mapping table as domain name system DNS configuration information.
[0159] In one embodiment, the sandbox service unit 110 is specifically configured to:
[0160] The application programming interface of the sandbox execution unit 210 is called, and a request to create a first sandbox cloud host is sent to the sandbox execution unit 210, so that the sandbox execution unit 210 creates the first sandbox cloud host.
[0161] In one embodiment, the first sandbox cloud host is a sandbox cloud host of a network namespace or a container-type sandbox cloud host.
[0162] In one embodiment, the sandbox service unit 110 is specifically configured to:
[0163] Receive a request from a client to create a sandbox cloud host by calling the sandbox open application programming interface (OpenAPI).
[0164] In one embodiment, the request for accessing the first sandbox cloud host is a Secure Shell Protocol (SSH) request, and the SSH request carries an instance identifier of the first sandbox cloud host;
[0165] The sandbox access gateway 310 is specifically configured to: after receiving the SSH request sent by the client, send a DNS query request to the sandbox main service unit 110 , where the DNS query request carries the instance identifier of the first sandbox cloud host.
[0166] The sandbox main service unit 110 is specifically used to: parse the DNS query request, query the IP address of the first physical server corresponding to the instance identifier of the first sandbox cloud host from the mapping table, and send a DNS response to the sandbox access gateway 310, where the DNS response carries the IP address of the first physical server.
[0167] The sandbox access gateway 310 is specifically configured to forward the SSH request to the sandbox execution unit 210 .
[0168] In one embodiment, the sandbox execution unit 210 is specifically configured to:
[0169] According to the communication connection, a network test command is sent to the first sandbox cloud host, so that the first sandbox cloud host performs a corresponding network test according to the network test command to obtain a network test result.
[0170] Receive the network test result sent by the first sandbox cloud host.
[0171] In one embodiment, the sandbox main service unit 110 is also used to: receive a request sent by the client to destroy the first sandbox cloud host, delete the stored data structure information of the first sandbox cloud host resource object, delete the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table, and send a request to delete the first sandbox cloud host to the sandbox execution unit 210.
[0172] The sandbox execution unit 210 is further configured to delete the first sandbox cloud host.
[0173] The following combination Figure 5 The interaction process among the sandbox main service unit, sandbox execution unit and sandbox access gateway in the network testing system is described in detail.
[0174] Figure 5 A schematic diagram of an interactive flow of a network testing method provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the method of this embodiment may include:
[0175] S301. The client sends a request to the sandbox main service unit to create a sandbox cloud host.
[0176] S302: The sandbox main service unit creates a first sandbox cloud host resource object. The data structure information of the first sandbox cloud host resource object includes the instance identifier and cloud network attribute data of the first sandbox cloud host.
[0177] Specifically, the sandbox main service unit generates a first sandbox cloud host resource object.
[0178] S303: The sandbox main service unit stores data structure information of the first sandbox cloud host resource object.
[0179] Specifically, the sandbox main body service unit writes the generated data structure information of the first sandbox cloud host resource object into the storage layer for storage.
[0180] S304: The sandbox main service unit determines a first physical server for hosting the first sandbox cloud host resource object, and stores a mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server in a mapping table.
[0181] S305: The sandbox main service unit calls the application programming interface of the sandbox execution unit and sends a request to the sandbox execution unit to create a first sandbox cloud host.
[0182] S306: After receiving the request to create a first sandbox cloud host, the sandbox execution unit creates the first sandbox cloud host.
[0183] Specifically, the created first sandbox cloud host may be a sandbox cloud host of a network namespace or a sandbox cloud host of a container type.
[0184] S307: The sandbox execution unit sends a first sandbox cloud host creation completion notification message to the sandbox main service unit.
[0185] S308. The sandbox main service unit sends the instance identifier of the first sandbox cloud host to the client.
[0186] S309. The client sends a request to the sandbox access gateway to access the first sandbox cloud host. The request to access the first sandbox cloud host is an SSH request.
[0187] S310: After receiving the SSH request sent by the client, the sandbox access gateway sends a DNS query request to the sandbox main service unit. The DNS query request carries the instance identifier of the first sandbox cloud host.
[0188] S311. The sandbox main service unit parses the DNS query request and searches the mapping table for the IP address of the first physical server corresponding to the instance identifier of the first sandbox cloud host.
[0189] S312. The sandbox main service unit sends a DNS response to the sandbox access gateway. The DNS response carries the IP address of the first physical server.
[0190] S313. The sandbox access gateway sends an SSH request to the sandbox execution unit on the first physical server.
[0191] S314. After receiving the SSH request, the sandbox execution unit establishes a communication connection between the client and the first sandbox cloud host.
[0192] S315. The client sends a network test command to the first sandbox cloud host on the sandbox execution unit according to the communication connection.
[0193] S316. The first sandbox cloud host on the sandbox execution unit performs a corresponding network test according to the network test command to obtain a network test result.
[0194] S317. The sandbox execution unit sends a network test command response to the client, where the response may include a network test result.
[0195] S318. After receiving the network test command response, the client continues to execute other test commands to perform network function testing until the test is completed.
[0196] S319. The client sends a request to the sandbox main service unit to destroy the first sandbox cloud host.
[0197] S320: The sandbox main service unit deletes the stored data structure information of the first sandbox cloud host resource object, and deletes the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table.
[0198] S321. The sandbox main service unit sends a request to delete the first sandbox cloud host to the sandbox execution unit.
[0199] S322: The sandbox execution unit deletes the first sandbox cloud host.
[0200] S323: The sandbox execution unit may also send a notification message to the sandbox main service unit indicating that the first sandbox cloud host has been successfully deleted.
[0201] After the client receives the notification message of successful deletion, the network test ends.
[0202] The network testing system provided in this embodiment is a lightweight sandbox testing system. The lightweight sandbox testing system is used to replace the real testing environment. Through the sandbox testing system, the time required to create the testing environment is greatly reduced, and the efficiency of automated testing is improved. Moreover, since there is no need to occupy real computing resources, the bottom layer only creates a virtual network isolation environment, thereby reducing the cost of network automated testing.
[0203] Furthermore, because the network testing system fully implements OpenAPI and SSH protocols, the access points of the sandbox environment are identical to those of the actual cloud host, resulting in excellent compatibility and portability. Furthermore, by leveraging technologies such as containers and network namespaces to implement the sandbox cloud host, network isolation is achieved while providing full Linux command support, allowing for unrestricted testing of any network functionality within the sandbox cloud host.
[0204] The following describes in detail the structure of the network testing system and the functions of each component provided by the embodiment of the present application in conjunction with a specific embodiment. In the following embodiment, the network testing system is described as a sandbox testing system.
[0205] Figure 6A schematic diagram of the structure of a sandbox testing system provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the sandbox testing system of this embodiment includes three components, namely a sandbox main body service unit 10, a sandbox access gateway 20 and a sandbox execution unit 30.
[0206] Among them, the sandbox main service unit 10 is the core service unit of the sandbox testing system. The sandbox main service unit 10 is an HTTP service that provides a cloud host management interface. It provides a set of interfaces that comply with the OpenAPI standard for adding, deleting, modifying, and querying cloud hosts. The input and response of these interfaces comply with the cloud host management interface specifications provided by the cloud service provider. The purpose of these interfaces complying with the cloud service provider's interface specifications is to ensure that the interface of the sandbox testing system is consistent with the interface of the existing cloud service provider, so that the network automation testing program can be compatible with the sandbox testing environment without any modification. For example, a network testing program that originally used the XX cloud environment to perform network function testing on the XX cloud can directly use the sandbox environment to create a virtual testing environment by modifying the call address of the OpenAPI interface.
[0207] Specifically, Figure 7 A structural diagram of a sandbox main service unit provided in an embodiment of the present application is shown as follows: Figure 7 As shown, the sandbox main body service unit 10 may include an OPEN-API service layer 101 , a DNS service layer 102 and a storage layer 103 .
[0208] Among them, the OPEN-API service layer 101 is used to provide an HTTP interface for managing cloud hosts, including adding cloud hosts, deleting cloud hosts, modifying cloud hosts, and querying cloud hosts. After the OPEN-API service layer 101 receives a request from the client (such as a request to add a new cloud host), it creates a sandbox cloud host resource object.
[0209] The storage layer 103 is used to save the created sandbox cloud host resource object, for example, in a database.
[0210] The DNS service layer 102 is used to accept external DNS queries and map the sandbox cloud host object to the real backend physical server IP.
[0211] The following describes the creation process of the sandbox cloud host in detail with S1-S3. Figure 8 A schematic diagram of the creation process of a sandbox cloud host provided in the application embodiment is shown as follows: Figure 8 As shown, the creation process may include:
[0212] S1. The client sends a request to create a sandbox cloud host.
[0213] Specifically, the client (automated testing program or the client used by the user) calls the interface provided by the OpenAPI service layer to create a sandbox cloud host.
[0214] S2. After receiving the cloud host creation request, the OPEN-API service layer generates a sandbox cloud host resource object. The data structure of the sandbox cloud host resource object includes the instance identifier of the first sandbox cloud host and cloud network attribute data, which may include an IP address and a MAC address. The OPEN-API service layer then writes the generated sandbox cloud host resource object to the storage layer 103 for storage, for example, for persistent storage, such as in a database such as MySQL or a file database.
[0215] S3. The OPEN-API service layer selects a real physical server to host the sandbox cloud host resource object, and stores the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server in a mapping table.
[0216] In an embodiment of the present application, a backend service with a cloud host management interface is provided through the OPEN-API service layer. The OPEN-API service layer and the cloud service provider have the same interface specifications, allowing network automation testing programs to be accessed without modification, with strong portability and compatibility. The OPEN-API service layer generates a complete sandbox cloud host resource object by simulating the cloud host data structure. The sandbox cloud host resource object and the real cloud host object have the same data structure representation. At the same time, the sandbox cloud host object is stored in local storage. The real mapping relationship between the cloud host and the backend physical server is provided through DNS. In the prior art, the network automation testing program needs to call an interface such as XX Cloud to create a real network test environment and create a cloud host. However, after using this sandbox testing system, it is only necessary to modify the interface call address of the network automation testing program and switch the address from the XX Cloud API address to the address of the OPEN-API service layer. The created cloud host is a virtual cloud host object of the sandbox system. This object has complete computing properties (such as CPU, memory, configuration information and resource information, etc.) and network properties, and can be used for real network function testing.
[0217] The sandbox cloud host created through the above process can be accessed by the network automation test program through the sandbox access gateway described below, and network function testing can be performed.
[0218] Figure 9 A flow chart of a network function test provided in an embodiment of the present application is shown as follows: Figure 9 As shown, the network function test process of this embodiment may include:
[0219] S11. The sandbox access gateway receives a request from a client to access a first sandbox cloud host.
[0220] Specifically, the request sent by the client to access the first sandbox cloud host can be an SSH request, which can support entering the simulated sandbox cloud host through the SSH protocol and provide complete system commands and network test commands through containers and other means to perform network testing. In this embodiment, since the SSH protocol is supported, the network automation test program can use the sandbox system provided in the embodiment of this application to perform network function testing without any modification, which has good compatibility and portability.
[0221] S12. The sandbox access gateway sends a DNS query request to the sandbox main service unit. The DNS query request carries the instance ID of the first sandbox cloud host.
[0222] For example, the instance ID of the first sandbox cloud host to be accessed is VM-1. In this embodiment, the DNS protocol is used to provide access to the sandbox cloud host, allowing users to access the sandbox cloud host by executing the ssh vm-id@sandbox-gateway command and execute commands for testing. This ensures that the sandbox cloud host and the real cloud host have the same access method, which is user-insensitive.
[0223] S13. The sandbox main service unit parses the DNS query request and queries the IP address of the first physical server corresponding to the instance ID of the first sandbox cloud host from the mapping table at the DNS service layer.
[0224] Specifically, the mapping table stores the correspondence between the instance ID of the created sandbox cloud host and the IP address of the physical server. According to the instance ID of the first sandbox cloud host, the IP address of the first physical server corresponding to the instance ID of the first sandbox cloud host can be queried from the mapping table, for example, the IP address is 1.1.1.1.
[0225] S14. The sandbox main service unit sends a DNS response to the sandbox access gateway. The DNS response carries the IP address of the first physical server corresponding to the instance ID of the first sandbox cloud host.
[0226] S15. The sandbox access gateway forwards the request to access the first sandbox cloud host to the first physical server.
[0227] Specifically, for example, the IP address of the physical server corresponding to the instance ID of the first sandbox cloud host is 1.1.1.1. The first physical server is the physical server with the IP address 1.1.1.1, and the first physical server processes the request to access the first sandbox cloud host.
[0228] The following describes in detail the functions and processing of the sandbox execution unit. The sandbox execution unit can be a service running on a real physical server. The sandbox execution unit is used to manage the sandbox cloud host and supports the SSH protocol to provide access to the sandbox cloud host.
[0229] Specifically, the sandbox execution unit is a service process deployed on a physical server. The process provides methods for creating and destroying sandbox cloud hosts and provides lifecycle management for the sandbox cloud hosts on the physical server. Figure 10 A schematic diagram of a sandbox execution unit provided in an embodiment of the present application is shown in FIG. Figure 10 As shown, the sandbox execution unit 30 is deployed on the physical server 40. The sandbox execution unit 30 supports different backend sandbox cloud host types through a variety of virtualization and isolation technologies, such as network namespace and container (docker) technologies, so that different backend sandbox cloud hosts can be created according to test needs. Figure 9 As shown, sandbox cloud host vm-1, sandbox cloud host vm-2 and sandbox cloud host vm-3 can represent sandbox cloud hosts of network namespace type, sandbox cloud host vm-4, sandbox cloud host vm-5 and sandbox cloud host vm-6 can represent sandbox cloud hosts of container type, and the two types of sandbox cloud hosts can be deployed in a mixed manner on the physical server 40 at the same time.
[0230] In an embodiment of the present application, the sandbox execution unit 30 implements the SSH protocol and supports access to the inside of the sandbox cloud host through the SSH protocol. For a sandbox cloud host of the network namespace type, it supports executing test commands within the network namespace to achieve network isolation; for a sandbox cloud host of the container type, it supports session transfer by mounting the container shell and binding the standard input (stdin) / standard output (stdout) / standard error output (stderr) file descriptors, and the container provides network isolation guarantees. The sandbox execution unit 30 adapts to and supports a variety of network isolation technologies, and simulates a real cloud host through a network isolation environment. Because for network function testing, the sandbox cloud host only needs to have an isolated and real network environment (such as IP address, MAC address, network card, etc.), and does not require a complete computing environment. Among them, standard input (stdin) is an input stream associated with a program, usually used to receive data from a keyboard or other input device. In the Linux command line, users can pass the output of files or other commands as stdin to the program through redirection or pipes. Standard output (stdout) is an output stream associated with a program, typically used to display the program's normal output (such as calculation results, query results, etc.) on the screen or write it to a file. In the Linux command line, users can redirect or pipe stdout to other commands or save it to a file. Standard error output (stderr) is an output stream associated with a program, specifically used to output program error messages and warnings. Compared to stdout, stderr is usually not redirected or captured by pipes, allowing users to clearly distinguish between normal output and error messages. In the Linux command line, users can redirect stderr separately to record error logs.
[0231] In an embodiment of the present application, the sandbox execution unit 30 implements the SSH protocol and an SSH relay gateway to forward SSH requests into the backend sandbox cloud host and bind the stdin / stdout / stderr file descriptors of the backend sandbox cloud host to achieve full support for the shell and support the input and output of any command.
[0232] Figure 11 A schematic diagram of the structure of a network testing device provided in an embodiment of the present application is shown in FIG. Figure 11 As shown, the device may include: a receiving module 21, a processing module 22, a sending module 23 and a testing module 24.
[0233] The receiving module 21 is used to receive a request from a client to create a sandbox cloud host;
[0234] The processing module 22 is used to create a first sandbox cloud host, so that the first sandbox cloud host is hosted on the first physical server;
[0235] The sending module 23 is used to send the instance identifier of the first sandbox cloud host to the client;
[0236] The receiving module 21 is further configured to: receive a request from a client to access the first sandbox cloud host;
[0237] The sending module 23 is further configured to: forward the request for accessing the first sandbox cloud host to the first physical server, so that the first physical server can establish a communication connection between the client and the first sandbox cloud host;
[0238] The testing module 24 is used to perform a network function test inside the first sandbox cloud host based on the communication connection.
[0239] In one embodiment, the processing module 22 is configured to: create a first sandbox cloud host resource object and store data structure information of the first sandbox cloud host resource object, where the data structure information of the first sandbox cloud host resource object includes an instance identifier and cloud network attribute data of the first sandbox cloud host;
[0240] Determine a first physical server for hosting a first sandbox cloud host resource object, and store a mapping relationship between an instance identifier of the first sandbox cloud host and an Internet Protocol IP address of the first physical server in a mapping table;
[0241] The sending module 23 is configured to send a request to create a first sandbox cloud host to the first physical server, so that the first physical server creates the first sandbox cloud host.
[0242] In one embodiment, the processing module 22 is specifically configured to store the mapping relationship between the instance identifier of the first sandbox cloud host resource object and the IP address of the first physical server as domain name system (DNS) configuration information in a mapping table.
[0243] In one embodiment, the sending module 23 is used to: call the application programming interface of the sandbox execution unit on the first physical server, and send a request to create a first sandbox cloud host to the sandbox execution unit, so that the sandbox execution unit can create the first sandbox cloud host.
[0244] In one embodiment, the first sandbox cloud host is a sandbox cloud host of a network namespace or a container-type sandbox cloud host.
[0245] In one embodiment, the receiving module 21 is configured to receive a request for creating a sandbox cloud host sent by a client by calling a sandbox open application programming interface (OpenAPI).
[0246] In one embodiment, the request for accessing the first sandbox cloud host is a Secure Shell Protocol (SSH) request, and the SSH request carries the instance identifier of the first sandbox cloud host.
[0247] In one embodiment, the testing module 24 is configured to: send a network test command to the first sandbox cloud host according to the communication connection, so that the first sandbox cloud host performs a corresponding network test according to the network test command and obtains a network test result;
[0248] The receiving module 21 is further configured to receive a network test result sent by the first sandbox cloud host.
[0249] In one embodiment, the receiving module 21 is further configured to: receive a request from the client to destroy the first sandbox cloud host;
[0250] The processing module 22 is further configured to delete the first sandbox cloud host.
[0251] In one embodiment, the processing module 22 is specifically configured to:
[0252] Deleting the stored data structure information of the first sandbox cloud host resource object;
[0253] Deleting the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table;
[0254] The sending module 23 is further configured to send a request to delete the first sandbox cloud host to the first physical server, so that the first physical server deletes the first sandbox cloud host.
[0255] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, they will not be described here. Specifically, Figure 10 The network testing device shown can execute the corresponding method embodiments described above, and the aforementioned and other operations and / or functions of each module in the device are respectively for implementing the corresponding method embodiments of the network testing device, which will not be described here for the sake of brevity.
[0256] The network testing device of the embodiment of the present application is described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in the form of hardware, can be implemented by instructions in the form of software, or can be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in conjunction with its hardware.
[0257] Figure 12 It is a schematic block diagram of a computer device provided in an embodiment of the present application.
[0258] like Figure 12 As shown, the computer device may include:
[0259] The memory 310 and the processor 320 are configured to store computer programs and transmit the program code to the processor 320. In other words, the processor 320 can call and run the computer program from the memory 310 to implement the method in the embodiment of the present application.
[0260] For example, the processor 320 may be configured to execute the above method embodiments according to instructions in the computer program.
[0261] In some embodiments of the present application, the processor 320 may include but is not limited to:
[0262] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0263] In some embodiments of the present application, the memory 310 includes but is not limited to:
[0264] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0265] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 310 and executed by the processor 320 to implement the method provided by the embodiment of the present application. The one or more modules may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program in the test device.
[0266] like Figure 12 As shown, the computer device may also include:
[0267] The transceiver 330 may be connected to the processor 320 or the memory 310 .
[0268] The processor 320 may control the transceiver 330 to communicate with other devices. Specifically, the processor 320 may send information or data to other devices or receive information or data sent by other devices. The transceiver 330 may include a transmitter and a receiver. The transceiver 330 may further include one or more antennas.
[0269] It should be understood that the various components in the computer device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0270] The present application also provides a computer storage medium having a computer program stored thereon, which, when executed by a computer, enables the computer to perform the method of the above-mentioned method embodiment. In other words, the present application also provides a computer program product containing instructions, which, when executed by a computer, enables the computer to perform the method of the above-mentioned method embodiment.
[0271] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid state drive (SSD)).
[0272] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this application.
[0273] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0274] Modules described as separate components may or may not be physically separate, and components displayed as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected based on actual needs to achieve the purpose of the solution of this embodiment. For example, the functional modules in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module.
[0275] The above content is merely a specific implementation of the embodiments of the present application, but the scope of protection of the embodiments of the present application is not limited thereto. Any person skilled in the art who can easily conceive of changes or substitutions within the technical scope disclosed in the embodiments of the present application should be included in the scope of protection of the embodiments of the present application. Therefore, the scope of protection of the embodiments of the present application should be based on the scope of protection of the claims.
Claims
1. A network testing method, characterized in that: include: Receive a request from a client to create a sandbox cloud host, and create a first sandbox cloud host so that the first sandbox cloud host is hosted on a first physical server; Sending the instance identifier of the first sandbox cloud host to the client; receiving a request from the client to access the first sandbox cloud host, and forwarding the request to access the first sandbox cloud host to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host; Based on the communication connection, a network function test is performed inside the first sandbox cloud host.
2. The method according to claim 1, characterized in that The step of creating the first sandbox cloud host includes: Creating a first sandbox cloud host resource object and storing data structure information of the first sandbox cloud host resource object, where the data structure information of the first sandbox cloud host resource object includes an instance identifier and cloud network attribute data of the first sandbox cloud host; Determine the first physical server for hosting the first sandbox cloud host resource object, and store a mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server in a mapping table; Send a request to create a first cloud sandbox host to the first physical server, so that the first physical server creates the first cloud sandbox host.
3. The method according to claim 2, characterized in that The step of storing the mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server in a mapping table includes: The mapping relationship between the instance identifier of the first sandbox cloud host resource object and the IP address of the first physical server is stored in the mapping table as domain name system DNS configuration information.
4. The method according to claim 2, characterized in that The sending a request to the first physical server to create a first sandbox cloud host includes: The application programming interface of the sandbox execution unit on the first physical server is called, and the request for creating the first sandbox cloud host is sent to the sandbox execution unit, so that the sandbox execution unit creates the first sandbox cloud host.
5. The method according to claim 4, characterized in that The first sandbox cloud host is a sandbox cloud host of a network namespace or a sandbox cloud host of a container type.
6. The method according to claim 1, characterized in that The receiving a request from the client to create a sandbox cloud host includes: A request for creating a sandbox cloud host is received from the client by calling the sandbox open application programming interface OpenAPI.
7. The method according to claim 1, characterized in that The request for accessing the first sandbox cloud host is a Secure Shell Protocol (SSH) request, and the SSH request carries the instance identifier of the first sandbox cloud host.
8. The method according to claim 1, characterized in that The performing a network function test within the first sandbox cloud host according to the communication connection includes: Sending a network test command to the first sandbox cloud host according to the communication connection, so that the first sandbox cloud host performs a corresponding network test according to the network test command and obtains a network test result; Receive the network test result sent by the first sandbox cloud host.
9. The method according to any one of claims 1 to 8, characterized in that Also includes: receiving a request from the client to destroy the first sandbox cloud host; Delete the first sandbox cloud host.
10. The method according to claim 9, characterized in that The deleting the first sandbox cloud host includes: Deleting the stored data structure information of the first sandbox cloud host resource object; Deleting the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table; Send a request to delete the first sandbox cloud host to the first physical server, so that the first physical server deletes the first sandbox cloud host.
11. A network testing device, characterized in that: include: The receiving module is used to receive a request from a client to create a sandbox cloud host; A processing module, configured to create a first sandbox cloud host, so that the first sandbox cloud host is hosted on a first physical server; A sending module, configured to send the instance identifier of the first sandbox cloud host to the client; The receiving module is further configured to: receive a request from the client to access the first sandbox cloud host; The sending module is further configured to: forward the request for accessing the first sandbox cloud host to the first physical server, so that the first physical server establishes a communication connection between the client and the first sandbox cloud host; A testing module is used to perform a network function test inside the first sandbox cloud host based on the communication connection.
12. A network testing system, characterized in that: It includes a sandbox main service unit, a sandbox execution unit and a sandbox access gateway; The sandbox main service unit is configured to: receive a request from a client to create a sandbox cloud host, create a first sandbox cloud host resource object so that the first sandbox cloud host resource object is hosted on a first physical server, and send a request to the sandbox execution unit to create the first sandbox cloud host; The sandbox execution unit is configured to: receive the request to create the first sandbox cloud host and create the first sandbox cloud host, wherein the sandbox execution unit is located on the first physical server; The sandbox main service unit is further configured to: send the instance identifier of the first sandbox cloud host to the client; The sandbox access gateway is configured to: receive a request from the client to access the first sandbox cloud host, and forward the request to access the first sandbox cloud host to the sandbox execution unit; The sandbox execution unit is further configured to establish a communication connection between the client and the first sandbox cloud host, and perform a network function test inside the first sandbox cloud host based on the communication connection.
13. The system according to claim 12, wherein: The sandbox main body service unit is used to: Creating a first sandbox cloud host resource object and storing data structure information of the first sandbox cloud host resource object, where the data structure information of the first sandbox cloud host resource object includes an instance identifier and cloud network attribute data of the first sandbox cloud host; The first physical server for hosting the first sandbox cloud host resource object is determined, and a mapping relationship between the instance identifier of the first sandbox cloud host and the Internet Protocol IP address of the first physical server is stored in a mapping table.
14. The system according to claim 12, wherein: The sandbox main body service unit is specifically used to: The application programming interface of the sandbox execution unit is called to send the request for creating the first sandbox cloud host to the sandbox execution unit, so that the sandbox execution unit creates the first sandbox cloud host.
15. The system according to claim 12, wherein: The request for accessing the first sandbox cloud host is a Secure Shell Protocol (SSH) request, and the SSH request carries the instance identifier of the first sandbox cloud host; The sandbox access gateway is specifically configured to: after receiving the SSH request sent by the client, send a DNS query request to the sandbox main service unit, where the DNS query request carries the instance identifier of the first sandbox cloud host; The sandbox main service unit is specifically configured to: parse the DNS query request, query the IP address of the first physical server corresponding to the instance identifier of the first sandbox cloud host from the mapping table, and send a DNS response to the sandbox access gateway, where the DNS response carries the IP address of the first physical server; The sandbox access gateway is specifically configured to forward the SSH request to the sandbox execution unit.
16. The system according to claim 12, wherein: The sandbox execution unit is specifically used to: Sending a network test command to the first sandbox cloud host according to the communication connection, so that the first sandbox cloud host performs a corresponding network test according to the network test command and obtains a network test result; Receive the network test result sent by the first sandbox cloud host.
17. The system according to any one of claims 12 to 16, characterized in that: The sandbox main body service unit is also used to: receiving a request from the client to destroy the first sandbox cloud host; Deleting the stored data structure information of the first sandbox cloud host resource object; Deleting the mapping relationship between the instance identifier of the first sandbox cloud host and the IP address of the first physical server from the mapping table; Sending a request to delete the first sandbox cloud host to the sandbox execution unit; The sandbox execution unit is further configured to delete the first sandbox cloud host.
18. A computer device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 10.
19. A computer-readable storage medium, characterized in that The computer program comprises instructions which, when run on a computer program, cause the computer to perform the method according to any one of claims 1 to 10.
20. A computer program product comprising instructions, characterized in that When the instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.