SDN networking automation test method, device and equipment and storage medium

By encapsulating host operations through Docker container virtualization and Flask services, combined with distributed version control and the Robotframe-Python framework, the problems of resource waste and low efficiency in SDN networking testing are solved, achieving efficient automated test management.

CN119728507BActive Publication Date: 2026-02-10CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411753685.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2026-02-10
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

Existing SDN network testing requires a large amount of host resources and has low testing efficiency. Traditional manual testing methods are inefficient, and automated testing operations have limited efficiency.

Method used

We combine Docker container virtualization with Flask services, encapsulate host-related commands into web interfaces, manage test cases using a distributed version control system, and improve the efficiency of automated testing using the Robotframe-Python keyword framework.

Benefits of technology

It effectively saves host resource consumption, improves testing efficiency, simplifies automated test case steps, enhances test case readability and maintainability, and supports multi-version test case management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728507B_ABST
    Figure CN119728507B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of SDN networking automation test method, device, equipment and storage medium, belong to internet technology field, method includes: from distributed version control system, pull target test case, and distributed version control system is stored with the automation test case corresponding to at least one SDN networking version;Based on target test case, initialize SDN networking configuration environment;Call the Docker image of server, to execute target test case automatically under the environment of SDN networking according to the Flask service in Docker image, output test result, and Flask service encapsulates the Shell command corresponding to automation test script.The application adopts container virtualization and Flask service encapsulation host Shell command, realizes the web interface of host operation, can effectively save host resource consumption and improve execution efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet technology, and in particular to an automated testing method for SDN networking, an automated testing device for SDN networking, a computer device, and a computer-readable storage medium. Background Technology

[0002] Software Defined Network (SDN) is a novel network architecture and a method for implementing network virtualization. In SDN automated networking scenarios, it is necessary to test service chains, multicast networks, and conventional Layer 2 and 3 network configurations and traffic before release. These tests involve numerous host terminal operations, such as enabling and disabling network interface cards (NICs), initiating and receiving ping traffic, and initiating and receiving multicast traffic.

[0003] With the development and widespread application of SDN solutions in networking scenarios over the years, existing application networking scenarios have become exceptionally large. Traditional manual testing methods are inefficient and require significant human resources, and are no longer suitable for current testing needs, especially in version access and major function verification for version releases. Therefore, the introduction of automated testing operations has become an urgent need.

[0004] Currently, implementing automated operations requires introducing a large number of host terminals in a fixed network environment to simulate network verification operations of user terminals, but this approach results in a significant waste of test host resources. Furthermore, in the actual execution of automated test cases, routine operations are typically implemented based on steps such as host SSH login, shell command input, terminal response reception, and regular expression checks, which significantly reduce the efficiency of automated testing. Summary of the Invention

[0005] In view of the above problems, this invention proposes an automated testing method, apparatus, device, and storage medium for SDN networking to solve the problem that SDN networking testing in the prior art requires a large amount of host resources and has low testing efficiency.

[0006] To address the aforementioned issues, this invention discloses an automated SDN networking testing method applied to an execution host. The execution host is communicatively connected to an SDN controller and a server, where the server is a server with a Flask service container deployed. The method includes:

[0007] Pull the target test case from the distributed version control system. The distributed version control system stores at least one automated test case corresponding to the SDN networking version. The target test case contains automated test scripts.

[0008] Based on the target test case, initialize the SDN networking configuration environment, which includes the SDN controller;

[0009] The server's Docker image is invoked to automatically execute the target test cases and output test results in the SDN network environment based on the Flask service within the Docker image. The Flask service encapsulates the Shell commands corresponding to the automated test script.

[0010] In some embodiments, before pulling the target test cases from the distributed version control system, the process further includes:

[0011] The preset keyword-driven framework is invoked to create a test project file, which contains example files.

[0012] Based on the keyword operations of the preset keyword-driven framework, the target test cases are written in the example file;

[0013] Update the target test cases to the distributed version control system.

[0014] In some embodiments, initializing the SDN networking configuration environment based on the target test case includes:

[0015] Based on the target test case, SDN networking configuration information is sent to the SDN controller. The SDN networking configuration information includes target network device information. The SDN networking configuration information is used by the SDN controller to manage the target network devices in the SDN networking configuration environment, so as to open up the traffic path of the target network devices.

[0016] In some embodiments, before initializing the SDN networking configuration environment based on the target test case, the method further includes:

[0017] Based on the network application scenarios of the aforementioned SDN networking version, determine the target network devices that need to be managed;

[0018] Configure the SDN protocol and connection parameters of the target network device to add the target network device to the SDN controller to form an SDN network;

[0019] The SDN network is virtualized to generate SDN networking configuration information corresponding to the network application scenario.

[0020] In some embodiments, the invocation of the server's Docker image to automatically execute the target test cases and output test results in the SDN network environment, based on the Flask service within the Docker image, includes:

[0021] In the SDN networking environment, based on the Flask service within the Docker image, the Shell command corresponding to the target test case is executed, and the command output results are obtained;

[0022] The output of the command is matched using regular expressions to obtain the matching result, which is the test result.

[0023] In some embodiments, prior to invoking the Docker image of the server, the following steps are also included:

[0024] Based on the test case requirements of the SDN networking version, determine the automated test scripts corresponding to the test case requirements;

[0025] The Shell commands corresponding to the automated test script are encapsulated into the Flask service;

[0026] The Flask service is packaged into a Docker image, and the Docker image is synchronized to the server.

[0027] In some embodiments, the step of executing the Shell command corresponding to the target test case based on the Flask service within the Docker image and obtaining the command output includes:

[0028] Based on the Flask service within the Docker image, execute the Shell command to invoke the Robotframe-Python framework to run the target test case and output the command results.

[0029] This invention also provides an automated SDN networking testing device, applied to an execution host, which is communicatively connected to an SDN controller and a server, wherein the server is a server with Flask service containers deployed. The device includes:

[0030] The pull module is used to pull target test cases from a distributed version control system, which stores at least one automated test case corresponding to an SDN networking version, and the target test case contains automated test scripts.

[0031] An initialization module is used to initialize the SDN networking configuration environment based on the target test case, wherein the SDN networking configuration environment includes the SDN controller;

[0032] The calling module is used to call the Docker image of the server to automatically execute the target test cases and output test results in the SDN network environment according to the Flask service in the Docker image. The Flask service encapsulates the Shell commands corresponding to the automated test script.

[0033] This invention also provides a computer device, comprising:

[0034] One or more processors; and

[0035] One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the computer device to perform the steps of the method described above.

[0036] This invention also provides a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the steps of the method described above.

[0037] The embodiments of the present invention have the following advantages:

[0038] By pulling target test cases from a distributed version control system, which stores automated test cases corresponding to at least one SDN networking version, and the target test cases containing automated test scripts, version management tools are introduced to effectively manage automated test-related code branches when there are many SDN release versions. Based on the target test cases, an SDN networking configuration environment is initialized. The SDN networking configuration environment includes the SDN controller to configure SDN networking for different application testing scenarios, covering various application testing scenarios. The Docker image of the server is invoked to automatically execute the target test cases in the SDN networking environment according to the Flask service within the Docker image, and output test results. The Flask service encapsulates the shell commands corresponding to the automated test scripts. By using Docker container virtualization and Flask service to encapsulate host shell commands, a web interface for host operations is implemented, which can effectively save host resource consumption and improve execution efficiency. Attached Figure Description

[0039] Figure 1 This is a flowchart of the steps of an automated testing method for SDN networking provided in an embodiment of the present invention;

[0040] Figure 2 This is a structural block diagram of an SDN network provided in an embodiment of the present invention;

[0041] Figure 3 This is a structural block diagram of an automated testing device for SDN networking provided in an embodiment of the present invention. Detailed Implementation

[0042] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0043] As described in the background section, the current SDN networking test system has the following problems:

[0044] 1. When there are many SDN networking versions released, the repetitive workload of version verification is large, resulting in a waste of testing human resources; the number of test cases for automated testing version adaptation also increases, making it difficult to manage effectively.

[0045] 2. Under a fixed network configuration, when testing different SDN solutions, there is a significant waste of host resources;

[0046] 3. In typical practical operations, logging in via SSH to the host, typing shell commands, receiving terminal responses, and regular expression checks can significantly reduce the efficiency of automated testing.

[0047] To address this, this invention combines Docker container virtualization with Flask services in SDN automated testing. By encapsulating host-related commands, it enables web-based interfaces for host operations, significantly improving execution efficiency, simplifying automated test case steps, and enhancing the readability and maintainability of automated test cases. Furthermore, it introduces the distributed version control system Git to manage automated test cases, and encapsulates host Flask + Restapi services into branches for easy management of multiple test case versions. Finally, it introduces the Robotframe-Python keyword framework to further improve the readability and maintainability of automated test cases.

[0048] Reference Figure 1 , Figure 1 The diagram illustrates a step flowchart of an automated SDN networking testing method provided by an embodiment of the present invention. The method is applied to an execution host, which can be a computer device. The execution host is communicatively connected to an SDN controller and a server, and the server is a server with Flask service containers deployed on it.

[0049] SDN, short for Software Defined Networking, is a network architecture and management approach. In traditional network architectures, network devices (such as routers and switches) are typically closed systems, their functions and configurations determined by hardware and proprietary software. SDN, however, achieves centralized and automated network management by separating the network control plane from the data forwarding plane. In SDN, the control plane (responsible for policy formulation and path selection) and the data plane (responsible for actual packet forwarding) are separate. The control plane is usually managed by a centralized SDN controller, which communicates with network devices through standardized interfaces (such as the OpenFlow protocol) and issues control policies. This allows network administrators to centrally manage the entire network through the SDN controller without directly operating each individual network device.

[0050] Flask is a lightweight web application framework designed specifically for Python developers. It provides standard REST API services, allowing users to customize Linux host terminal shell operations and provide corresponding interfaces. Its key features are simplicity, flexibility, and ease of use, enabling developers to quickly build small to medium-sized web applications.

[0051] Robotframe is a Python-based, extensible, keyword-driven automation framework. Its core principle is "keyword-driven," meaning testers don't need to develop their own test code; instead, like a Selenium IDE, they can perform tests by executing keywords. This includes protocol-level interface testing, GUI interface testing, database testing, app testing, and command-line testing.

[0052] Specifically, Robot Framework uses a user-readable format for writing test cases, typically employing concise keyword-driven syntax. This allows stakeholders without technical backgrounds (such as product managers and testers) to understand and write test cases, thereby promoting team collaboration and communication. Test cases are defined using "keywords," which can be predefined or custom. Keywords encapsulate specific operations or verifications, making test case writing more intuitive and easier to maintain. Robot Framework supports extending its functionality through libraries. Developers can write custom libraries to implement specific test logic or interact with different technology stacks (such as databases, web services, mobile applications, etc.), enabling Robot Framework to adapt to various complex testing needs. Robot Framework supports not only functional testing but also performance testing, security testing, interface testing, and many other test types. It provides a rich set of built-in and third-party libraries, covering most common testing scenarios. Robot Framework can be integrated with other development and testing tools, such as continuous integration (CI) tools, version control systems, and defect tracking systems, allowing it to seamlessly integrate into existing development and testing processes.

[0053] A distributed version control system is a version management tool used to track file changes, record project history, and allow multiple developers to collaborate. Unlike centralized version control systems (such as SVN), it does not rely on a single central server to store all versions of data. Each developer's working copy is a complete repository containing the complete history of the project.

[0054] Docker is an open-source containerization platform that allows developers to package applications and their dependencies into lightweight, portable containers that can run in various environments without worrying about issues caused by environmental differences. Containers are more lightweight than traditional virtual machines (VMs), start up faster, consume fewer system resources, and multiple containers can share the same operating system kernel on the same host, thereby improving resource utilization.

[0055] like Figure 1 As shown, the SDN networking automated testing method of the present invention may specifically include the following steps S101 to S103, which are detailed below:

[0056] Step S101: Pull the target test case from the distributed version control system. The distributed version control system stores at least one automated test case corresponding to an SDN networking version. The target test case contains an automated test script.

[0057] In this step, the distributed version control system can be Git, which maintains a complete repository containing all commits, branches, and tags. Automated test cases are predefined test scenarios used to verify the functionality, performance, and security of software. Test cases include test scripts that can be executed without human intervention. A distributed version control system may store automated test cases for multiple versions, targeting different software versions or functional modules; the target test case is the automated test case for a specific version.

[0058] A pull refers to obtaining the latest version of code or test cases from a remote repository and bringing it to your local working environment. In a distributed version control system, pull operations can be used to obtain the latest code commits, branch changes, or other resources (such as test cases). Optionally, the pull process typically involves downloading data from the remote repository and updating the local repository to the latest state.

[0059] Step S102: Based on the target test case, initialize the SDN networking configuration environment, which includes the SDN controller.

[0060] In this step, the SDN controller is the core component of the SDN network, responsible for centrally managing the network's control plane. It provides functions such as network policy formulation, path calculation, and flow control. When initializing the SDN network configuration environment, the SDN controller needs to be installed and configured to ensure it can correctly communicate with network devices and execute the expected network policies.

[0061] The initialization process in this embodiment refers to building an SDN network environment that meets the testing requirements according to the target test cases. This includes configuring network devices, installing and configuring the SDN controller, and defining network policies. Optionally, after initialization, the SDN network configuration environment is verified to ensure that it meets the execution conditions of the target test cases. This includes checking the connectivity of network devices, verifying the normal functioning of the SDN controller, and testing whether the network policies are executed as expected.

[0062] This embodiment enables the reuse of resources and reduces resource waste during the testing of SDN solutions by initializing the SDN networking configuration environment.

[0063] Step S103: Invoke the Docker image of the server to automatically execute the target test case and output the test results in the SDN network environment according to the Flask service in the Docker image. The Flask service encapsulates the Shell commands corresponding to the automated test script.

[0064] In this step, the automated test script can consist of a series of shell commands that define the test steps and verification logic. The shell commands corresponding to the automated test script are encapsulated as Flask services, enabling the input of shell commands, regular expression matching of terminal results, and return of API results within the Flask service. Specifically, the encapsulation process can embed the shell commands into Flask routes or APIs, allowing these commands to be triggered and executed via HTTP requests.

[0065] For example, the specific steps of this embodiment are as follows: Before starting, ensure that all necessary components and the environment are ready: a server running Docker, a Docker image containing the Flask service, and a configured SDN network environment, including the SDN controller and network devices. Start the Docker container, using the previously prepared Docker image, and allocate necessary resources (such as ports, disk space, etc.). After the container starts, the Flask service will automatically start within the container. After the Flask service starts, send an HTTP request to the Flask service, specifying the target test case to be executed. After receiving the request, the Flask service parses the instructions and calls the encapsulated Shell command according to the instructions to execute the automated test script. During the execution of the test script, the SDN network environment (including the SDN controller and network devices) can be dynamically configured and controlled to simulate different network scenarios. After the test script is executed, the Flask service collects the test results, which may include the test pass / fail status, error messages, performance metrics, etc. The Flask service returns the collected test results to the client via an HTTP response, or writes the results to a file or database for subsequent analysis and reporting. After the test is completed, the Docker container can be stopped and resources released. If necessary, the SDN networking environment can be cleaned or reset for the next test.

[0066] In some embodiments, prior to step S101, the method further includes:

[0067] The preset keyword-driven framework is invoked to create a test project file, which contains example files.

[0068] Based on the keyword operations of the preset keyword-driven framework, the target test cases are written in the example file;

[0069] Update the target test cases to the distributed version control system.

[0070] In this embodiment, a keyword-driven framework is an automated testing method that uses predefined keywords (usually high-level abstract commands) to drive the execution of test scripts. These keywords can be Robot Framework, Squish, etc. This embodiment introduces the Robotframe keyword framework to improve the readability and maintainability of automated test cases.

[0071] For example, a new test project file is created, typically including a main directory and several subdirectories to store different test resources (such as test case files, data files, configuration files, etc.). Within the test project file, one or more test case files are created to store specific test cases. Based on a predefined keyword-driven framework, appropriate keywords are identified and selected to describe the test steps. Keywords typically represent high-level operations, such as "click a button," "enter text," and "verify results." In the test case files, specific test cases are written using the selected keywords. Each test case usually contains a series of steps, each step corresponding to a keyword and its parameters. After writing and debugging test cases locally, the test case files are committed to the local repository using version control system commands (such as Git's `git add` and `git commit`); the locally committed test cases are then pushed to the remote repository (such as Git's `git push`).

[0072] In some embodiments, step S102 includes:

[0073] Based on the target test case, SDN networking configuration information is sent to the SDN controller. The SDN networking configuration information includes target network device information. The SDN networking configuration information is used by the SDN controller to manage the target network devices in the SDN networking configuration environment, so as to open up the traffic path of the target network devices.

[0074] In this embodiment, the SDN networking configuration information includes information about the target network devices, such as device IP address, device type, port configuration, and link information. The specific configuration content, such as network topology, policy rules, and traffic forwarding paths, can be determined according to the requirements of the target test cases. The SDN controller communicates with the SDN controller via a southbound API (such as OpenFlow, OVSDB, etc.) or a northbound API (such as REST, gRPC, etc.) to send the SDN networking configuration information. After receiving the configuration information, the SDN controller begins to manage and configure the target network devices. Specifically, the SDN controller first needs to discover and identify the target network devices. Based on the received configuration information, the SDN controller configures the target network devices, such as setting switch ports, defining routing rules, and configuring ACLs; defining traffic paths to ensure that data packets can be transmitted between network devices according to predetermined paths; executing predetermined control policies, such as QoS policies, load balancing policies, and security policies, to ensure effective traffic management and optimization; and continuously monitoring the status and traffic of the target network devices to ensure unobstructed pathways between network devices.

[0075] This embodiment can effectively configure and manage SDN networking, ensuring smooth traffic flow between target network devices and meeting the requirements of target test cases. The centralized management and automation capabilities of the SDN controller simplify the configuration process and improve network flexibility and manageability.

[0076] In some embodiments, prior to step S102, the method further includes:

[0077] Based on the network application scenarios of the aforementioned SDN networking version, determine the target network devices that need to be managed;

[0078] Configure the SDN protocol and connection parameters of the target network device to add the target network device to the SDN controller to form an SDN network;

[0079] The SDN network is virtualized to generate SDN networking configuration information corresponding to the network application scenario.

[0080] In this embodiment, the main application scenarios in the current network are identified, such as data centers, enterprise intranets, remote branch offices, and IoT devices. The network requirements for each scenario are determined, including traffic patterns, bandwidth requirements, QoS requirements, and security policies. Network devices that need to be managed are listed, such as switches, routers, firewalls, and load balancers, ensuring that these devices support SDN protocols (such as OpenFlow) or can be integrated with the SDN controller in other ways.

[0081] Choose a suitable SDN controller platform, such as OpenDaylight, ONOS, or Contrail. Configure each network device to support SDN protocols, such as OpenFlow, ensuring that the devices can communicate with the SDN controller and accept its control and configuration. Add network devices to the SDN controller and perform authentication and authorization; configure the device connection parameters, such as IP address, port number, and protocol type. Import the current network topology into the SDN controller, ensuring that the controller can recognize and manage all devices; verify the accuracy of the topology, ensuring that the connection relationships and paths between devices are correct. Use the network virtualization functions provided by the SDN controller to create logical networks, such as virtual LANs (VLANs) and network slices, configure the virtual network's connection policies, security policies, QoS policies, etc., and persist the verified network policies to the SDN controller to generate SDN network configuration information.

[0082] This embodiment uses an SDN controller to manage network devices in a network environment, which can achieve efficient, flexible and secure network management, meet the needs of various application scenarios, and support the development and verification of automated use cases.

[0083] In some embodiments, step S103 includes:

[0084] In the SDN networking environment, based on the Flask service within the Docker image, the Shell command corresponding to the target test case is executed, and the command output results are obtained;

[0085] The output of the command is matched using regular expressions to obtain the matching result, which is the test result.

[0086] In this embodiment, a Docker container is started on the server using a Docker image containing the Flask service. An HTTP request is made to the Flask service, triggering the execution of the shell command corresponding to the target test case. Upon receiving the request, the Flask service parses and executes the corresponding shell command, obtaining the command output, which may include standard output (stdout), standard error (stderr), and an exit code to characterize the test case's execution status, network status, and other information. Based on the test requirements, a regular expression pattern is defined to match specific strings or values ​​from the output, such as specific error messages or performance metrics. The command output is matched against the regular expression to extract one or more matched strings or values, which are the test results. The matching results are analyzed to determine the test case's execution status; for example, if a specific error message is matched, the test fails; if the expected performance metric is matched, the test passes. The test results are returned to the caller via an HTTP response or written to a file or database for subsequent analysis and reporting.

[0087] In this embodiment, an error handling mechanism can be designed during the execution of Shell commands and regular expression matching to ensure that errors can be captured and handled in a timely manner when abnormal situations occur; it can support the parallel execution of multiple test cases to improve testing efficiency; and it can extract and analyze test results from command output results through regular expressions to ensure the correctness of network functions and the accurate evaluation of performance.

[0088] Optionally, the step of executing the Shell command corresponding to the target test case based on the Flask service within the Docker image and obtaining the command output includes:

[0089] Based on the Flask service within the Docker image, execute the Shell command to invoke the Robotframe-Python framework to run the target test case and output the command results.

[0090] In this optional embodiment, an HTTP request is made to the Flask service to trigger the execution of the Shell command corresponding to the target test case, thereby starting the Robotframework (Robotframe)-Python framework and loading the test case. The Robotframework-Python framework executes a series of test steps according to the definition of the test case, including operations (such as clicking a button or entering text) and verification (such as checking the expected results).

[0091] This embodiment uses the Flask service within a Docker container to automatically call the Robotframework-Python framework to run target test cases, and obtain and process test results, ensuring the efficiency and automation of the testing process.

[0092] In some embodiments, prior to step S103, the method further includes:

[0093] Based on the test case requirements of the SDN networking version, determine the automated test scripts corresponding to the test case requirements;

[0094] The Shell commands corresponding to the automated test script are encapsulated into the Flask service;

[0095] The Flask service is packaged into a Docker image, and the Docker image is synchronized to the server.

[0096] In this embodiment, the test case requirements based on the SDN networking version are transformed into automated test scripts, and efficient deployment and operation are achieved through Flask service and Docker image to ensure the automation and consistency of the test process.

[0097] Optionally, based on the test case requirements of the SDN networking version, appropriate automated test scripts are written or selected, including: Requirements analysis: Based on the test case requirements of the SDN networking version, analyze the specific requirements of the functions, performance, stability, etc. to be tested; Script design: Design automated test scripts to ensure that the scripts can cover the test requirements. The scripts may include the definition of test cases, the writing of test steps, the setting of expected results, etc.; Script writing: Use an appropriate programming language (such as Python, Shell) to write automated test scripts to ensure that the scripts can be executed in the target environment and generate correct test results.

[0098] The shell commands corresponding to the automated test scripts are encapsulated into Flask services for execution triggered via HTTP requests. This includes: Flask service design: designing the Flask service's API interface, defining the data formats for requests and responses, and the interface can include functions such as executing tests and retrieving results; Shell command encapsulation: encapsulating the shell commands corresponding to the automated test scripts within the Flask service's processing function. Upon receiving a request, the processing function executes the corresponding shell command and returns the execution result; Error handling: adding an error handling mechanism to the Flask service to ensure that exceptional situations can be captured and handled when executing shell commands.

[0099] The process involves packaging the pre-packaged Flask service into a Docker image for deployment and operation in different environments. This includes: Dockerfile writing: Writing a Dockerfile that defines the steps for building the Docker image. A Dockerfile typically includes steps such as installing dependencies, copying files, and setting environment variables. Image building: Using Docker commands to build the Docker image. During the build process, Docker generates an image containing the Flask service based on the Dockerfile definition. Image tagging: Adding appropriate tags to the built Docker image for version management and deployment.

[0100] Synchronize the built Docker image to the target server for deployment and operation, including: Image push: Use Docker commands to push the Docker image to the Docker registry (such as Docker Hub, a private image repository); Server preparation: Ensure that the target server has a Docker environment installed and configured to pull and run Docker images; Image pull: On the target server, use Docker commands to pull the Docker image from the Docker registry; Image deployment: On the target server, use Docker commands to start the Docker container, deploy and run the Flask service.

[0101] This is an example, not a limitation. Figure 2 This diagram illustrates an automated testing scenario for SDN networking. Specifically, an SDN controller is built within the same management network to manage switches with border, spine, and leaf roles in the SDN network, and BGP neighbors are established as needed. After successful management, a server is built within the same management network, and the Robotframe-Python framework environment is installed and deployed to automate test scripts. Flask services can be customized to encapsulate host operation REST API interfaces, and automated test cases can be developed based on test cases. These are packaged into Docker images and pushed to Git, which then pushes them to the server and the execution host. The server starts the Docker container and the Flask-Restapi service already encapsulated within it to execute test cases and verify the results of host-side operations. After execution, the corresponding Docker container can be destroyed to reclaim resources.

[0102] By pulling target test cases from a distributed version control system, which stores automated test cases corresponding to at least one SDN networking version, and the target test cases containing automated test scripts, version management tools are introduced to effectively manage automated test-related code branches when there are many SDN release versions. Based on the target test cases, an SDN networking configuration environment is initialized. The SDN networking configuration environment includes the SDN controller to configure SDN networking for different application testing scenarios, covering various application testing scenarios. The Docker image of the server is invoked to automatically execute the target test cases in the SDN networking environment according to the Flask service within the Docker image, and output test results. The Flask service encapsulates the shell commands corresponding to the automated test scripts. By using Docker container virtualization and Flask service to encapsulate host shell commands, a web interface for host operations is implemented, which can effectively save host resource consumption and improve execution efficiency.

[0103] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0104] Reference Figure 3 The diagram illustrates a structural block diagram of an automated SDN networking testing device according to an embodiment of the present invention. This automated SDN networking testing device is applied to an execution host, which is communicatively connected to an SDN controller and a server. The server is a server with Flask service containers deployed. Specifically, the device may include the following modules:

[0105] The pull module 301 is used to pull target test cases from a distributed version control system, wherein the distributed version control system stores at least one automated test case corresponding to an SDN networking version, and the target test case contains automated test scripts.

[0106] Initialization module 302 is used to initialize the SDN networking configuration environment based on the target test case, wherein the SDN networking configuration environment includes the SDN controller;

[0107] Module 303 is used to invoke the Docker image of the server to automatically execute the target test cases and output test results in the SDN network environment based on the Flask service in the Docker image. The Flask service encapsulates the Shell commands corresponding to the automated test script.

[0108] In some embodiments, the SDN networking automated testing device further includes:

[0109] Create a module to call a preset keyword-driven framework and create a test project file, which contains example files.

[0110] A module is written for keyword operations based on the preset keyword-driven framework, and for writing the target test cases in the example file;

[0111] An update module is used to update the target test cases to the distributed version control system.

[0112] In some embodiments, the initialization module 302 is specifically used for:

[0113] Based on the target test case, SDN networking configuration information is sent to the SDN controller. The SDN networking configuration information includes target network device information. The SDN networking configuration information is used by the SDN controller to manage the target network devices in the SDN networking configuration environment, so as to open up the traffic path of the target network devices.

[0114] In some embodiments, the SDN networking automated testing device further includes:

[0115] The first determining module is used to determine the target network devices that need to be managed based on the network application scenario of the SDN networking version.

[0116] An add module is used to configure the SDN protocol and connection parameters of the target network device, so as to add the target network device to the SDN controller and form an SDN network;

[0117] The virtualization module is used to virtualize the SDN network to generate SDN networking configuration information corresponding to the network application scenario.

[0118] In some embodiments, the calling module 303 includes:

[0119] The execution module is used to execute the Shell command corresponding to the target test case based on the Flask service in the Docker image under the SDN networking environment, and obtain the command output results;

[0120] The matching module is used to match the output of the command using regular expressions to obtain the matching result, which is the test result.

[0121] In some embodiments, the SDN networking automated testing device further includes:

[0122] The second determining module is used to determine the automated test script corresponding to the test case requirements based on the test case requirements of the SDN networking version.

[0123] The encapsulation module is used to encapsulate the Shell commands corresponding to the automated test scripts into the Flask service;

[0124] The synchronization module is used to package the Flask service into a Docker image and synchronize the Docker image to the server.

[0125] In some embodiments, the execution module is specifically used for:

[0126] Based on the Flask service within the Docker image, execute the Shell command to invoke the Robotframe-Python framework to run the target test case and output the command results.

[0127] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0128] This invention also provides a computer device, comprising:

[0129] One or more processors; and

[0130] One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the computer device to perform the methods described in the embodiments of the present invention.

[0131] This invention also provides a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.

[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0133] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, EEPROM, Flash, and eMMC, etc.) containing computer-usable program code.

[0134] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0135] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0137] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0138] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0139] The above provides a detailed description of the SDN networking automated testing method and the SDN networking automated testing device provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An automated testing method for SDN networking, characterized in that, Applied to an execution host, which is communicatively connected to an SDN controller and a server, wherein the server is a server with Flask service containers deployed, the method includes: Pull the target test case from the distributed version control system. The distributed version control system stores at least one automated test case corresponding to the SDN networking version. The target test case contains automated test scripts. Based on the target test case, initialize the SDN networking configuration environment, which includes the SDN controller; Based on the test case requirements of the SDN networking version, determine the automated test scripts corresponding to the test case requirements; The Shell commands corresponding to the automated test script are encapsulated into the Flask service; Package the Flask service into a Docker image and synchronize the Docker image to the server; In the SDN networking environment, based on the Flask service within the Docker image, the Shell command is executed to call the Robotframe-Python framework to run the target test case and output the command results; The output of the command is matched using regular expressions to obtain the matching result, which is the test result. The Flask service encapsulates the Shell commands corresponding to the automated test script.

2. The automated testing method for SDN networking according to claim 1, characterized in that, Before pulling the target test cases from the distributed version control system, the process also includes: The preset keyword-driven framework is invoked to create a test project file, which contains example files. Based on the keyword operations of the preset keyword-driven framework, the target test cases are written in the example file; Update the target test cases to the distributed version control system.

3. The automated testing method for SDN networking according to claim 1, characterized in that, The initialization of the SDN networking configuration environment based on the target test case includes: Based on the target test case, SDN networking configuration information is sent to the SDN controller. The SDN networking configuration information includes target network device information. The SDN networking configuration information is used by the SDN controller to manage the target network devices in the SDN networking configuration environment, so as to open up the traffic path of the target network devices.

4. The automated testing method for SDN networking according to claim 1, characterized in that, Before initializing the SDN networking configuration environment based on the target test case, the process also includes: Based on the network application scenarios of the aforementioned SDN networking version, determine the target network devices that need to be managed; Configure the SDN protocol and connection parameters of the target network device to add the target network device to the SDN controller to form an SDN network; The SDN network is virtualized to generate SDN networking configuration information corresponding to the network application scenario.

5. An automated testing device for SDN networking, characterized in that, An apparatus applied to an execution host, which is communicatively connected to an SDN controller and a server, wherein the server is a server with Flask service containers deployed, the apparatus comprising: The pull module is used to pull target test cases from a distributed version control system, which stores at least one automated test case corresponding to an SDN networking version, and the target test case contains automated test scripts. An initialization module is used to initialize the SDN networking configuration environment based on the target test case, wherein the SDN networking configuration environment includes the SDN controller; The calling module is used to call the Docker image of the server to automatically execute the target test cases and output test results in the SDN network environment according to the Flask service in the Docker image. The Flask service encapsulates the Shell commands corresponding to the automated test script. The second determining module is used to determine the automated test script corresponding to the test case requirements based on the test case requirements of the SDN networking version. The encapsulation module is used to encapsulate the Shell commands corresponding to the automated test scripts into the Flask service; The synchronization module is used to package the Flask service into a Docker image and synchronize the Docker image to the server; The calling module includes: The execution module is used to execute the Shell command based on the Flask service in the Docker image in the SDN networking environment, so as to call the Robotframe-Python framework to run the target test case and output the command output results; The matching module is used to match the output of the command using regular expressions to obtain the matching result, which is the test result.

6. A computer device, characterized in that, include: One or more processors; and One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the computer device to perform the method as described in any one of claims 1-4.

7. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Automatic testing method, system and equipment based on Docker and medium

    CN115525545A

  • Automatic test management system based on RobotFramework

    CN116521529A