Port control method and device, computer equipment and computer readable storage medium

By using software-level port control methods to obtain and parse in-situ status parameters and construct virtual status files, the problem of low efficiency in traditional port control is solved, and efficient and flexible port status management is achieved.

CN121530894APending Publication Date: 2026-02-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411103966.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Traditional port control relies on manual operation, resulting in high time costs, low work efficiency, and difficulty in meeting the flexibility requirements of applications and reproducing network failures.

Method used

By implementing port control at the software level, the in-situ status control parameters of the target port are obtained, a virtual status file is constructed, and the in-situ status change sequence is determined through parsing and processing. The in-situ status information of the port is then modified to simulate hardware plug-in/plug-out operations.

Benefits of technology

The communication connection status of the port can be changed without physical intervention, saving time and costs, improving work efficiency, flexibly adapting to the needs of different application scenarios, and avoiding repeated operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121530894A_ABST
    Figure CN121530894A_ABST
Patent Text Reader

Abstract

The invention relates to a port control method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: in response to a port selection operation triggered for network equipment, determining a selected target port from a plurality of ports contained in the network equipment; in response to a configuration operation for the target port, obtaining an in-place state control parameter of the target port and a virtual state file constructed for the target port; analyzing the in-place state control parameter, and determining an in-place state change sequence matched with the in-place state control parameter; and modifying the in-place state information of the target port in the virtual state file according to the in-place state change sequence. Wherein the in-place state information is used for representing the communication connection state between the target port and the hardware equipment inserted into the target port. By adopting the scheme of the invention, the plugging action of hardware equipment can be simulated in a pure software mode, the time cost can be saved, and the working efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a port control method and device, computer equipment, computer readable storage medium and computer program product. BACKGROUND

[0002] With the rapid development of computer technology, various running communication networks such as telephone communication network, data communication network and computer communication network appear, which are also called as present network. The present network is the infrastructure of information transmission and exchange, and the stability of the present network is crucial to the normal operation of various communication services.

[0003] It is found through research that the abnormality of the port of the network equipment is an important cause of the failure of the present network, so it is necessary to perform module shock stress test on the port before delivery, and it is necessary to reproduce the fault by plugging the hardware of the port or trigger the initialization of the software to restore the data after the problem occurs. In the traditional technology, the control of the port still depends on manual implementation, which brings large time cost and has the problem of low work efficiency. SUMMARY

[0004] Therefore, it is necessary to provide a port control method and device, computer equipment, computer readable storage medium and computer program product capable of improving work efficiency in view of the above technical problems.

[0005] In a first aspect, the present application provides a port control method. The method comprises:

[0006] In response to a port selection operation triggered for a network equipment, determining a selected target port from a plurality of ports contained in the network equipment;

[0007] In response to a configuration operation for the target port, obtaining an in-place state control parameter of the target port and a virtual state file constructed for the target port;

[0008] Performing analysis processing on the in-place state control parameter to determine an in-place state change sequence matched with the in-place state control parameter;

[0009] According to the in-place state change sequence, modifying in-place state information of the target port in the virtual state file; the in-place state information is used to represent a communication connection state between the target port and a hardware equipment plugged in the target port.

[0010] In a second aspect, the present application further provides a port control device. The device comprises:

[0011] The selecting module is configured to determine a selected target port from a plurality of ports included in the network device in response to a port selection operation triggered for the network device.

[0012] The configuring module is configured to acquire an in-place state control parameter of the target port and a virtual state file constructed for the target port in response to a configuration operation for the target port.

[0013] The parameter analyzing module is configured to analyze the in-place state control parameter and determine an in-place state change sequence matched with the in-place state control parameter.

[0014] The information modifying module is configured to modify in-place state information of the target port in the virtual state file according to the in-place state change sequence, wherein the in-place state information is used to represent a communication connection state between the target port and a hardware device plugged in the target port.

[0015] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0016] The selecting module is configured to determine a selected target port from a plurality of ports included in the network device in response to a port selection operation triggered for the network device.

[0017] The configuring module is configured to acquire an in-place state control parameter of the target port and a virtual state file constructed for the target port in response to a configuration operation for the target port.

[0018] The parameter analyzing module is configured to analyze the in-place state control parameter and determine an in-place state change sequence matched with the in-place state control parameter.

[0019] The information modifying module is configured to modify in-place state information of the target port in the virtual state file according to the in-place state change sequence, wherein the in-place state information is used to represent a communication connection state between the target port and a hardware device plugged in the target port.

[0020] In a fourth aspect, the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:

[0021] The selecting module is configured to determine a selected target port from a plurality of ports included in the network device in response to a port selection operation triggered for the network device.

[0022] in response to a configuration operation for the target port, obtaining an in-place state control parameter of the target port and a virtual state file constructed for the target port;

[0023] analyzing the in-place state control parameter to determine an in-place state change sequence matched with the in-place state control parameter;

[0024] modifying, according to the in-place state change sequence, in-place state information of the target port in the virtual state file; the in-place state information is used to represent a communication connection state between the target port and a hardware device plugged in the target port.

[0025] In a fifth aspect, the present application further provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the following steps:

[0026] in response to a port selection operation triggered by a network device, determining a selected target port from a plurality of ports contained in the network device;

[0027] in response to a configuration operation for the target port, obtaining an in-place state control parameter of the target port and a virtual state file constructed for the target port;

[0028] analyzing the in-place state control parameter to determine an in-place state change sequence matched with the in-place state control parameter;

[0029] modifying, according to the in-place state change sequence, in-place state information of the target port in the virtual state file; the in-place state information is used to represent a communication connection state between the target port and a hardware device plugged in the target port.

[0030] The port control method, device, computer device, computer readable storage medium and computer program product described above, in the case of determining the selected target port, obtaining the in-place state control parameter configured for the target port and the virtual state file constructed for the target port, then analyzing the in-place state control parameter to determine the in-place state change sequence matched with the in-place state control parameter, and finally modifying the in-place state information of the target port in the virtual state file according to the in-place state change sequence, on the one hand, it can not be necessary to physically plug in and plug out the hardware device, and the communication connection state between the target port and the hardware device plugged in the target port can be changed by pure software, which is conducive to saving time cost and improving work efficiency; on the other hand, the in-place state control parameter can be flexibly configured for the target port to match the specific needs of the application scenario, thereby avoiding repeated operations due to the inability to meet the application requirements, and further improving work efficiency. Attached Figure Description

[0031] Figure 1 This is a diagram illustrating the application environment of a port control method in one embodiment;

[0032] Figure 2 This is a schematic diagram of the fault distribution of a switch in one embodiment;

[0033] Figure 3 This is a flowchart illustrating a port control method in one embodiment;

[0034] Figure 4 This is a schematic diagram of the port control process in an initial application scenario in one embodiment;

[0035] Figure 5 This is a schematic diagram illustrating the expected state change trend of a target port within a set time period in one embodiment;

[0036] Figure 6 This is a flowchart illustrating the port control method in another embodiment;

[0037] Figure 7 This is a schematic diagram of the network device testing platform in one embodiment;

[0038] Figure 8 This is a schematic diagram illustrating the application process of the port control method in one embodiment;

[0039] Figure 9 This is a structural block diagram of a port control device in one embodiment;

[0040] Figure 10 This is an internal structural diagram of a computer device in one embodiment;

[0041] Figure 11 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0043] The port control method provided in this application embodiment can be applied to, for example, Figure 1The application environment shown. The application environment can include network device 102 and control terminal 104. Among them, the network device 102 communicates with the control terminal 104 through the network. The communication network can be a wired network or a wireless network. Therefore, the network device 102 and the control terminal 104 can be directly or indirectly connected through wired or wireless communication. For example, the network device 102 can be indirectly connected with the control terminal 104 through a wireless access point, or the network device 102 is directly connected with the control terminal 104 through the Internet, which is not limited in the present application.

[0044] Among them, the control terminal 104 can be integrated inside the network device 102, or can be a separate device from the network device 102. The network device 102 is a special hardware device used to connect various servers, personal computers, application terminals and other nodes to each other to form an information communication network, which can specifically include switches, routers, hubs, etc. The control terminal 104 can be a terminal or a server when it is a separate device. Among them, the terminal includes but is not limited to various desktop computers, notebook computers, smart phones, tablet computers, Internet of Things devices or portable wearable devices, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Basic cloud computing services such as platform. The control terminal 104 integrated inside the network device 102 can be a hardware module of the Board Support Package (BSP). Among them, the board support package is a layer between the mainboard hardware and the driver layer program in the operating system, which belongs to a part of the operating system. The main purpose of BSP is to support the operating system and provide a function package for the upper driver program to access the hardware device register, so that it can better run on the hardware motherboard. In embedded system software, BSP contains all the hardware-related codes, and its basic idea is to isolate the embedded operating system from the specific hardware platform, encapsulate all hardware-related codes, and provide a virtual hardware platform to the operating system. In this way, the operating system can run on this virtual hardware platform, interact with BSP through a set of defined programming interfaces, and access the real hardware through BSP.

[0045] The port control method in this application can be applied in the field of cloud technology based on CDN (Content Delivery Network), such as cloud live streaming, cloud video on demand, or cloud conferencing, etc. In other words, this method can be applied to network transmission application scenarios of cloud technology.

[0046] A CDN is an intelligent virtual network built on top of the existing network. Relying on edge servers deployed in various locations, it uses a central platform's load balancing, content distribution, and scheduling modules to allow users to access content from the nearest server, reducing network congestion and improving user access response speed and hit rate. Content delivery network nodes are placed in multiple locations on different networks. These nodes dynamically transmit content to each other, optimizing user download behavior and thereby reducing bandwidth costs for content providers, improving user download speeds, and enhancing system stability. The number of nodes required for a content delivery network varies depending on demand, potentially reaching tens of thousands of servers depending on the size of the target audience.

[0047] As described in the background section, network device port malfunctions are a significant cause of network failures. Taking a switch as an example... Figure 2 The diagram shows the fault distribution of a switch, with the physical layer exhibiting the highest proportion of failures. When the physical layer of a switch malfunctions, common symptoms include ports becoming abnormally inactive, sudden status interruptions, or periodic oscillations. These external manifestations can trigger related issues in the system software or firmware, requiring large-scale module oscillation stress testing before delivery, reproducing problems after they occur in the live network, and restoring the software data state by re-initializing the software through firmware unplugging and plugging after a problem occurs. All of these processes rely on port control. In traditional technologies, port control largely depends on manual plugging and unplugging, which not only consumes a lot of manpower, leading to high time costs and low efficiency, but also results in insufficient oscillation stress testing intensity, difficulty in reproducing problems in the live network, and slow convergence time for abnormal faults.

[0048] Based on this, the application provides a port control method, which realizes the control of the in-place state of the port in a pure software manner, so that the plug-in action of the network port and module can be simulated without physical intervention. Specifically, in the process of port control, the control terminal 104 can determine the selected target port from the multiple ports included in the network device in response to the port selection operation triggered for the network device; in response to the configuration operation of the target port, the in-place state control parameter of the target port and the virtual state file constructed for the target port are obtained; the in-place state control parameter is analyzed and processed to determine the in-place state change sequence matched with the in-place state control parameter; and the in-place state information of the target port in the virtual state file is modified according to the in-place state change sequence. The in-place state information is used to represent the communication connection state between the target port and the hardware device plugged into the target port. It can be understood that by using the method of the application, on the one hand, the communication connection state between the target port and the hardware device plugged into the target port can be changed without physically plugging in and out the hardware device, which can save time and improve work efficiency; on the other hand, the in-place state control parameter can be flexibly configured for the target port to match the specific needs of the application scenario, thereby avoiding repeated operations due to the inability to meet the application requirements, and further improving work efficiency.

[0049] In one embodiment, as shown in Figure 3 , a port control method is provided, which can be executed by a computer device. In this embodiment, the method is applied to the control terminal in Figure 1 for example, which includes the following steps:

[0050] Step S302, in response to the port selection operation triggered for the network device, the selected target port is determined from the multiple ports included in the network device.

[0051] The network device is a special hardware device used to connect various servers, personal computers, application terminals and other nodes to each other to form an information communication network, and can specifically include switches, routers, hubs and the like. The network device usually includes multiple ports. The port selection operation refers to the operation of selecting the target port from the multiple ports included in the network device. The target port refers to the port that needs to be controlled in place. The number of target ports is not unique, and can be one or multiple.

[0052] Specifically, the developer can trigger the port selection operation for the network device by interacting with the control terminal, so that the control terminal can determine the selected target port from the multiple ports included in the network device in response to the port selection operation.

[0053] In a specific embodiment, the control terminal can acquire the device identifier of the network device, and determine the ports included in the network device according to the device identifier, and then display a port selection page for each port. Thus, the developer can select the target port to be controlled in the port selection page. That is, the developer can select the target port through a graphical user interface (GUI). Optionally, the port selection page can include a selection control corresponding to each port, and the control terminal can determine the port corresponding to the triggered selection control as the selected target port in response to a triggering operation on the selection control. The specific manner of triggering the selection control can be clicking, touching, dragging, or box selection, and the like, which is not limited herein. Optionally, the developer can complete the port selection operation of multiple target ports by box selecting multiple selection controls.

[0054] In a specific embodiment, the developer can input a script to the control terminal through a command-line interface (CLI), and trigger a port selection operation on the network device through a port selection field included in the script. Thus, the control terminal can determine the port indicated by the port selection field as the selected target port in response to the port selection operation.

[0055] In step S304, the in-situ state control parameter of the target port and the virtual state file constructed for the target port are acquired in response to the configuration operation on the target port.

[0056] The in-situ state control parameter of the target port refers to parameter information for controlling the in-situ state of the target port. The in-situ state of the target port refers to the communication connection state between the target port and the hardware device plugged in the target port. In this application, the in-situ state control of the target port is specifically used to simulate the physical plug-in and plug-out action of the hardware device. The specific content of the in-situ state control parameter is not unique. Optionally, the in-situ state control parameter can include the plug-in and plug-out frequency, the plug-in and plug-out duration, the duration of insertion or extraction in each plug-in and plug-out cycle, and the like, and can also include the plug-out time, the insertion time, and the like. In actual application, the in-situ state control parameter can also be configured in combination with the software running state to accurately reproduce the fault scenario in the network device running process. For example, the in-situ state control parameter can also include the running state of the program associated with the target port at the time of plug-in or plug-out. The running state of the program can refer to the program running to a certain logical node or a certain line of code, and the logical node can be an assignment node, a calculation node, or a storage node, and the like.

[0057] The virtual state file is used to adjust and record the in-place state of the target port. The virtual state file is a readable and writable file. That is, the control terminal can determine the in-place state of the target port by reading the virtual state file, and the control terminal can change the in-place state of the target port by writing the virtual state file.

[0058] Specifically, in one aspect, the developer can configure the in-place state control parameter of the target port by interacting with the control terminal, so as to trigger the configuration operation of the target port. Further, the control terminal can obtain the state control parameter configured for the target port in response to the configuration operation. In another aspect, the control terminal can construct a virtual state file for the target port in order to control the in-place state. It should be noted that the construction time of the virtual state file is not unique. For example, the control terminal can construct the virtual state file corresponding to each port in advance before the port selection operation is triggered, or can construct the virtual state file for the target port after the selected target port is determined.

[0059] Further, the relationship between the port and the virtual state file can be one-to-one or many-to-one. Taking the case of constructing the virtual state file after the target port is determined as an example. In the case of multiple selected target ports, the control terminal can construct a corresponding virtual state file for each target port, or can construct one virtual state file for multiple target ports.

[0060] Step S306: The in-place state control parameter is parsed and processed to determine the in-place state change sequence matched with the in-place state control parameter.

[0061] The in-place state change sequence is used to represent the change of the in-place state information in a period of time. The in-place state change sequence can include a plurality of expected state information or state change information arranged in sequence. Optionally, the in-place state change sequence can be represented as: K1, K2, K3 ……, wherein K i represents the expected state information or the state change information. Optionally, the in-place state change sequence can be represented as: (t1, Q1) (t2, Q2) (t3, Q3) ……, wherein t i represents the target node; Q i represents the state change information corresponding to the target node. The target node can be represented by time or program running state.

[0062] Specifically, the control end can parse the in-situ state control parameter, determine the change of the expected in-situ state, and then obtain the in-situ state change sequence matched with the in-situ state control parameter. The specific manner of parsing the in-situ state control parameter to obtain the in-situ state change sequence is not unique. Taking the case where the in-situ state change sequence is represented as "(t1, Q1) (t2, Q2) (t3, Q3)…" as an example.

[0063] In a specific implementation, the control end can determine the parameter type to which the in-situ state control parameter belongs, and screen a target sequence template matched with the parameter type from a plurality of candidate sequence templates pre-configured. The target sequence template includes a plurality of pending parameters and defines the association between the pending parameters and the state control parameter. Then, the control end determines the parameter value of the pending parameter according to the state control parameter and the association between the pending parameter and the state control parameter, and assigns the value to the pending parameter according to the determined parameter value, to obtain the in-situ state change sequence matched with the in-situ state control parameter.

[0064] The parameter type to which the in-situ state control parameter belongs can be a frequency type, a time type, or a running state type, etc. The in-situ state control parameter of the frequency type can include the plug-in frequency, the plug-in duration, the duration of insertion or plug-out in each plug-in cycle, etc. The in-situ state control parameter of the time type can include the plug-out time, the plug-in time, etc. The in-situ state control parameter of the running state type can include the running state of the program associated with the target port when the hardware device is plugged out or plugged in. Taking the time type as an example, the corresponding target sequence template can be represented as: (t1, 1→0) (t2, 0→1) (t3, 1→0)…, where 0 represents the disconnection of the communication connection between the hardware device and the target port, which is used to simulate the in-situ state of the target port when the hardware device is plugged out; 1 represents the establishment of the communication connection between the hardware device and the target port, which is used to simulate the in-situ state of the target port when the hardware device is plugged in; "→" represents the change; t i For the pending parameter, i is an odd number corresponding to the plug-out time, and i is an even number corresponding to the plug-in time. The control end assigns the value to t i Accordingly, the in-situ state change sequence matched with the in-situ state control parameter can be obtained.

[0065] In one specific implementation, the control end can perform state change analysis based on the in-place state control parameter, determine target nodes whose expected in-place states have changed relative to the previous moment, and then determine the in-place state change sequence matching the in-place state control parameter according to the state change of each target node respectively. As described above, the target node can be represented by time or program running state. Taking the case where the target node is represented by time as an example. Exemplarily, in the case where the in-place state control parameter includes the plug frequency, the plug number, and the duration of unplugging in each plug cycle, the control end can determine, according to the in-place state control parameter, a plurality of target nodes (t1, t1+△t, t2, t2+△t……,t 2n ), where t j+1 is the time difference between t j , representing a cycle, which is the reciprocal of the plug frequency;△t represents the duration of unplugging in a plug cycle; and n is the plug number. Then, the control end determines the in-place state change sequence matching the in-place state control parameter according to the state change of each target node respectively, which can be represented as: (t1,1→0) (t1+△t,0→1) (t2, 1→0) (t2+△t,0→1)……(t 2n ,0→1).

[0066] Step S308: modifying the in-place state information of the target port in the virtual state file according to the in-place state change sequence.

[0067] The in-place state information is used to represent the communication connection state between the target port and the hardware device plugged in the target port.

[0068] Specifically, after determining the in-place state change sequence of the target port, the control end can modify the in-place state information of the target port in the virtual state file according to the in-place state change sequence, so as to change the communication connection state between the target port and the hardware device plugged in the target port. It should be noted that in the case where a plurality of target ports correspond to one virtual state file, the virtual state file can contain the in-place state information of each target port. In this case, the control end can analyze and process the in-place state control parameter of each target port respectively, determine the in-place state change sequence matching the in-place state control parameter of the target port, and then modify the in-place state information of the target port in the virtual state file according to the in-place state change sequence, so as to realize in-place state control for a plurality of target ports.

[0069] It can be understood that when a plurality of sequentially arranged expected state information is included in the in-place state change sequence, the duration of the expected in-place state (i.e., the expected communication connection state) represented by each expected state information can be fixed (for example, t0), in which case the control end compares the in-place state information in the virtual state file with the expected state information of the next period with t0 as the period, if they are consistent, the in-place state information in the virtual state file does not need to be modified in the next period, if they are inconsistent, the in-place state information in the virtual state file is modified to the expected state information of the next period.

[0070] Optionally, at the beginning of the construction of the virtual state file, the initial in-place state information in the virtual state file can be set to be consistent with the physical plugging state of the target port. That is, the initial in-place state information in the virtual state file represents that a communication connection is established between the hardware device and the target port, which is used to simulate the in-place state of the target port when the hardware device is inserted. After completing the last modification of the in-place state information according to the in-place state change sequence, the control end can determine whether the current in-place state information in the virtual state file is consistent with the initial in-place state information, if they are inconsistent, the current in-place state information is modified to the initial in-place state information, to ensure that the target port can be normally used without port control.

[0071] In the above port control method, after determining the selected target port, the in-place state control parameter configured for the target port and the virtual state file constructed for the target port are obtained, and then the in-place state change sequence matched with the in-place state control parameter is determined by analyzing and processing the in-place state control parameter, and finally the in-place state information of the target port in the virtual state file is modified according to the in-place state change sequence, on the one hand, it can change the communication connection state between the target port and the hardware device plugged in the target port through pure software without physical plugging of the hardware device, which is beneficial to save time cost and improve work efficiency; on the other hand, the in-place state control parameter can be flexibly configured for the target port to match the specific needs of the application scenario, thereby avoiding repeated operations due to the inability to meet the application requirements, which is beneficial to further improve the work efficiency.

[0072] In one embodiment, modifying the in-place state information of the target port in the virtual state file according to the in-place state change sequence comprises: determining, based on the in-place state change sequence, a target node having a state information modification requirement, and initial in-place information and updated in-place information corresponding to the target node; for each target node, if the target node is matched at the current time and the initial in-place information corresponding to the target node is consistent with the current in-place information in the virtual state file, the current in-place information is modified to the updated in-place information corresponding to the target node.

[0073] wherein the in-situ state change sequence comprises a plurality of target nodes with in-situ state information modification requirements, and initial in-situ information and updated in-situ information corresponding to the target nodes. Taking the in-situ state change sequence "(t1, 1→0) (t2, 0→1) (t3, 1→0)…" as an example, t i For the target nodes with in-situ state information modification requirements, the left side of "→" is the initial in-situ information corresponding to the target nodes, and the right side of "→" is the updated in-situ information corresponding to the target nodes. The target nodes can be represented by time or by program running state. In the case of representing the target nodes by time, the current time matches the target nodes, which means that the current time is consistent with the time indicated by the target nodes. In the case of representing the target nodes by program running state, the current time matches the target nodes, which means that the program running state corresponding to the current time is consistent with the program running state indicated by the target nodes.

[0074] Specifically, the control end can determine, from the in-situ state change sequence, the target nodes with in-situ state information modification requirements, and the initial in-situ information and updated in-situ information corresponding to the target nodes. Then, for each target node, it is judged whether the current time matches the target node according to the current time or the program running state corresponding to the current time. If the current time does not match the target node, the in-situ state information is not modified, but the next round of judgment is continued. If the current time matches the target node, the current in-situ information of the target port is read from the virtual state file of the target port, and it is further judged whether the initial in-situ information corresponding to the target node is consistent with the current in-situ information in the virtual state file. If the initial in-situ information corresponding to the target node is consistent with the current in-situ information in the virtual state file, the current in-situ information is modified to the updated in-situ information corresponding to the target node. If the initial in-situ information corresponding to the target node is inconsistent with the current in-situ information in the virtual state file, and the target node is the first node in the in-situ state change sequence, it indicates that the current in-situ information in the virtual state file cannot meet the control requirements of the in-situ state change sequence. At this time, the control end can terminate the port control action and output error information to remind the R&D personnel to troubleshoot errors.

[0075] In the embodiment, in the case that the current time matches the target node and the initial in-situ information corresponding to the target node is consistent with the current in-situ information in the virtual state file, the current in-situ information is modified to the updated in-situ information corresponding to the target node, which can ensure the accuracy of the port control result.

[0076] In one embodiment, the port control method further comprises: obtaining a port control script configured for the network device; in the case that the port control script contains a port selection field, triggering a port selection operation for the network device.

[0077] The script is an executable file written in a script language according to a certain format. The script language can be Python, javascript, script, or the like. The port selection field is a field defined in advance for port selection.

[0078] Specifically, the developer can input a port control script for network device configuration to the control end through a command-line interface (CLI). The control end can obtain the port control script and detect whether the port control script contains a pre-defined port selection field. If the port control script contains the port selection field, a port selection operation for the network device is triggered, and the port indicated by the port selection field is determined as the selected target port in response to the port selection operation.

[0079] In this embodiment, the port selection operation for the network device is triggered by the script, which can automatically perform the port selection operation and reduce the number of human-computer interactions, thereby further improving work efficiency.

[0080] In one embodiment, the port control method further includes triggering a configuration operation for the target port if the port control script contains a parameter configuration field. In this embodiment, obtaining the in-place state control parameter of the target port includes reading field information corresponding to the parameter configuration field from the port control script, and performing parameter conversion on the field information to determine the in-place state control parameter configured for the target port.

[0081] The parameter configuration field is a field defined in advance for configuring the in-place state control parameter of the target port. The field information corresponding to the parameter configuration field is the specific in-place state control parameter configured for the target port. For example, the parameter configuration field can be ${} or set, without limitation.

[0082] In actual application, the R&D personnel can trigger the port selection operation for the network device and the configuration operation for the target port through the port control script. Specifically, in the case that the selected target port is determined based on the port control script, the control end can further detect whether the pre-defined parameter configuration field is included in the port control script. If the parameter configuration field is included in the port control script, the configuration operation for the target port is triggered, and further, in response to the configuration operation, the field information corresponding to the parameter configuration field is read from the port control script, and the parameter conversion is performed on the field information according to the corresponding relationship between the field information and the in-place state control parameter, to determine the in-place state control parameter configured for the target port. For example, in the case that the field information corresponding to the parameter configuration field includes "frequency=24Hz", since "frequency" corresponds to the plug frequency, it can be determined that the in-place state control parameter configured for the target port includes the plug frequency of 24Hz.

[0083] In the embodiment, the configuration operation for the target port is triggered through the script, and the parameter configuration for multiple target ports can be completed in batches, which is beneficial to further reduce the number of human-computer interactions and improve the work efficiency.

[0084] In one embodiment, the port control method further includes: obtaining the driving state of the target port from the driving file of the target port; and in the case that the driving state is normal, constructing the virtual state file for the target port.

[0085] The driving file refers to a file used to record the driving state of the target port. The driving state refers to the physical connection state between the port and the external hardware device. Unlike the virtual state file, the driving file is a readable but non-writable file. That is, the control end can perform the read operation on the driving file to obtain the driving state of the target port, but cannot change the driving state of the target port by performing the write operation on the driving file. Further, the driving state can include normal driving and abnormal driving. In the case of normal driving, it is indicated that the target port is plugged with a hardware device and can be used. If the in-place state of the port is not further limited, the network device can perform data interaction with the plugged hardware device through the target port. In the case of abnormal driving, it is indicated that the target port is not plugged with a hardware device and is currently in an unusable state. Even if the in-place state of the port is not limited, the network device cannot perform data interaction with the external hardware device through the target port.

[0086] The in-place status information of the target port is contained in the virtual status file. It can be understood that the in-place status information of the target port in the virtual status file is an initial information at the beginning of the construction of the virtual status file, which is recorded as initial in-place status information. Optionally, at the beginning of the construction of the virtual status file, the control end can set the initial in-place status information in the virtual status file to be consistent with the physical plugging state of the target port. That is, the initial in-place status information in the virtual status file represents that the communication connection between the hardware device and the target port is established, which is used to simulate the in-place status of the target port when the hardware device is plugged in.

[0087] In actual application, the BSP (Board Support Package) driver can determine the physical connection state between the target port and the external hardware device according to the CPLD (Complex Programmable Logic Device) state of the target port, generate the driving information representing the physical connection state, and update to the driving file. That is, in the case that the hardware device connected to the target port is physically plugged in or unplugged, the driving state of the target port will be updated. Specifically, the control end can read the driving state of the target port from the driving file of the target port, and then construct the virtual status file for the target port in the case that the driving state is normal, representing that the target port and the external hardware device have established an effective physical connection.

[0088] In the embodiment, the driving state of the target port is obtained from the driving file of the target port, and the virtual status file for the target port is constructed in the case that the driving state is normal, which can ensure that the port control is performed in the case that the target port and the hardware device have established an effective physical connection, thereby ensuring the effectiveness of the port control operation and being beneficial to further improve the work efficiency.

[0089] In one embodiment, the port control method further comprises: reading the in-place status information of the target port from the virtual status file; and determining and executing a target program associated with the communication connection state according to the communication connection state represented by the in-place status information.

[0090] In actual application, the developer can deploy one or more application programs for the target port according to actual application requirements. The application program may, for example, be a test program, a power-on / off control program or a system program, etc. In the process of performing port control on the target port, the control end can read the in-place status information of the target port from the virtual status file, and further determine a target program matched with the communication connection state from the application programs according to the communication connection state represented by the in-place status information, and execute the target program.

[0091] For example,Figure 4 As shown, in the initialization application scenario, the deployed application programs can include the power-on control program and the power-off control program. In this scenario, the control end can read the in-place state information of the target port from the virtual state file in real time, and determine the communication connection state represented by the in-place state information. When the communication connection state represented by the in-place state information is disconnected, the control end can determine the power-off control program as the target program, and execute the power-off control program; when the communication connection state represented by the in-place state information is connected, the control end can determine the power-on control program as the target program, and execute the power-on control program. Thus, through two modifications of the in-place state information, one power-off and re-power-on can be completed, and the initialization for the target port can be realized.

[0092] Optionally, a corresponding trigger condition can also be configured for each application program, which can be represented by the in-place state information. Thus, after obtaining the in-place state information, the control end can send the in-place state information to the respective API interface (Application Programming Interface, i.e. application programming interface) of each application program to trigger and execute the target program that meets the condition.

[0093] In the above embodiments, while the in-place state information in the virtual state file is modified, the corresponding target program is also determined and executed according to the in-place state information read from the virtual state file in real time, which can automatically realize the testing and verification for the target port, and is beneficial to further improve the work efficiency.

[0094] In one embodiment, the port control method further includes configuring a corresponding priority for the driver file and the virtual state file. In the case of this embodiment, reading the in-place state information of the target port from the virtual state file includes: reading the in-place state information of the target port from the virtual state file when the priority of the virtual state file is higher than the priority of the driver file.

[0095] As described above, the driver file includes the driver information for representing the physical connection state between the target port and the external hardware device. If the in-place state of the target port is not further controlled by the virtual state file, the driver information can also be used to represent the communication connection state between the target port and the external hardware device. To further improve the accuracy of port control and avoid interference of the driver information on the port control process, the control end can configure a corresponding priority for the driver file and the virtual state file, and read the information according to the priority.

[0096] Specifically, the control terminal can read the in-situ status information of the target port from the virtual state file when the virtual state file has a higher priority than the driver file. This means that the in-situ status of the target port can be controlled purely through software without manual plugging or unplugging. Alternatively, the control terminal can read the driver information of the target port from the driver file when the driver file has a higher priority than the virtual state file, and determine the in-situ status information that matches the driver information. In this case, the port's in-situ status is no longer controlled through software; instead, data interaction can be performed directly based on the physical connection status between the target port and the hardware device.

[0097] In this embodiment, corresponding priorities are configured for the driver file and the virtual state file respectively. When the priority of the virtual state file is higher than that of the driver file, the on-state information of the target port is read from the virtual state file. This enables a fast switch between the test state and the normal use state, which is beneficial to further improve the working efficiency of the port control process.

[0098] In a specific implementation, the port control method also includes either of the following two: deleting the virtual state file when the operation and maintenance project to which the target program belongs is completed; or modifying the priority of the virtual state file to be lower than the priority of the driver file when the operation and maintenance project to which the target program belongs is completed.

[0099] Specifically, maintenance projects can refer to port testing projects, port fault reproduction and diagnosis projects, system automatic recovery projects, etc. In particular, once the maintenance project for the target program is completed, the target port needs to switch from test mode back to normal usage mode. The control panel can prevent the virtual state file from affecting the use of the target port by deleting it or changing its priority to be lower than that of the driver file.

[0100] In this embodiment, once the operation and maintenance project to which the target program belongs is completed, deleting the virtual state file, or modifying the priority of the virtual state file to be lower than that of the driver file, can prevent the virtual state file from affecting the use of the target port and help to further improve the accuracy of port control.

[0101] In one embodiment, parsing the in-situ state control parameters to determine the in-situ state change sequence that matches the in-situ state control parameters includes: performing state change analysis based on the in-situ state control parameters to determine the target nodes whose in-situ state is expected to change relative to the previous time; and determining the in-situ state change sequence that matches the in-situ state control parameters based on the state change corresponding to each target node.

[0102] Specifically, the control unit can perform state change analysis based on the in-situ state control parameters to determine the target node whose in-situ state is expected to change relative to the previous moment. This target node can be characterized by time or by the program's running state.

[0103] Taking the case of target nodes represented by time as an example, if the in-situ state control parameters include the insertion / removal frequency, the number of insertions / removals, and the duration of removal within each insertion / removal cycle, the control terminal can determine multiple target nodes (t1, t1+Δt, t2, t2+Δt…,t) whose in-situ state is expected to change relative to the previous time step based on the in-situ state control parameters. 2n ), where t j+1 With t j The time difference between them represents one cycle, which is the reciprocal of the insertion / removal frequency; Δt represents the duration of insertion / removal within one insertion / removal cycle; n is the number of insertions / removals.

[0104] Taking the case where the target node is represented by the program's running state as an example, the in-situ state control parameters can include the running state of the program associated with the target port when it is unplugged, for example, when the program is unplugged when it reaches the assignment node. In this case, the control terminal can determine the assignment code from the program code of the program associated with the target port, and then determine the target node whose in-situ state is expected to change relative to the previous moment, which is the assignment node corresponding to when the program reaches the assignment code.

[0105] After the target node is determined, the control terminal can further determine the state change corresponding to each target node. Then, by sorting and integrating the state changes, a sequence of in-situ state changes that matches the in-situ state control parameters is obtained.

[0106] In the above embodiments, state change analysis is performed based on the in-situ state control parameters to determine the target nodes whose in-situ state is expected to change relative to the previous moment. Then, based on the state change corresponding to each target node, an in-situ state change sequence matching the in-situ state control parameters is determined, so that the in-situ state change sequence can directly indicate subsequent information modifications, which is beneficial to further improve work efficiency.

[0107] In one specific embodiment, the target node is represented by time. In this embodiment, the target node whose expected state change is relative to the previous moment is determined by performing state change analysis based on the in-situ state control parameters. This includes: performing in-situ state analysis based on the in-situ state control parameters to determine the expected state change trend of the target port within a set time period; and determining the target moment within the set time period in which the expected state change is relative to the previous moment, according to the expected state change trend, which is the target node.

[0108] The set duration refers to a time span of port control based on the configured in-place state control parameter. For example, if the in-place state control parameter indicates 100 times of plugging and unplugging experiments on the target port, the product of the plugging period and the number of plugging and unplugging is the set duration; for another example, if the in-place state control parameter indicates the influence of the test plugging on the program associated with the target port, the time span corresponding to the program running process is the set duration. The expected state change trend is used to represent the expected in-place state change trend of the target port over time within the set duration. The expected state change trend can be represented by a curve or a two-dimensional array containing time and expected state information.

[0109] Specifically, the control end can analyze the in-place state based on the in-place state control parameter to determine the expected state change trend of the target port within the set duration. Then, the control end determines the target time at which the expected in-place state changes relative to the previous time within the set duration by analyzing the expected state change trend. For example, as shown in FIG. 6, if the in-place state control parameter includes the plugging frequency, the number of plugging and unplugging, and the duration of unplugging in each plugging period, the control end can determine the expected state change trend of the target port within the set duration according to the in-place state analysis based on the in-place state control parameter. Among them, the insertion corresponds to the in-place state, and the removal corresponds to the out-of-place state. Then, according to the expected state change trend, the target time t1, t2, t3, t4, and t5 at which the expected in-place state changes relative to the previous time within the set duration is determined, that is, a plurality of target nodes. Figure 5

[0110] In the above embodiments, the expected state change trend of the target port within the set duration is first determined, and then the target time at which the expected in-place state changes relative to the previous time within the set duration is determined according to the expected state change trend, which can further ensure the accuracy of the target node, and thus ensure the matching degree of the in-place state change sequence determined based on the target node and the in-place state control parameter.

[0111] In one specific embodiment, determining the in-place state change sequence matched with the in-place state control parameter according to the state change corresponding to each target node includes: for each target node, determining in-place state change information representing the state change of the target node relative to the previous node; and determining the in-place state change sequence matched with the in-place state control parameter based on the in-place state change information corresponding to each target node.

[0112] The in-place state change information is natural language information used to represent the state change. The in-place state change information can include the in-place state before the change and the in-place state after the change. For example, the in-place state change information can be "from in-place state to out-of-place state", or "from out-of-place state to in-place state". ​

[0113] Specifically, the control terminal can determine, for each target node, in-situ state change information representing a state change of the target node relative to a previous node, and then convert the natural language description of the in-situ state change information into computer language description of the state change information according to a pre-set mapping relationship, to obtain state change information corresponding to each target node respectively, and then sequentially sort the target nodes to construct an in-situ state change sequence matching the in-situ state control parameter. The mapping relationship between the in-situ state change information and the state change information may, for example, be that "in-situ state" is mapped to "1" and "non-in-situ state" is mapped to "0".

[0114] In the above embodiment, the in-situ state change sequence matching the in-situ state control parameter is determined based on the in-situ state change information corresponding to each target node, and the processing process is relatively simple, which can further improve work efficiency.

[0115] In one embodiment, as shown in Figure 6 A port control method is provided, which can be executed by a computer device, which can be a terminal or a server. In this embodiment, the method includes the following steps:

[0116] Step S601: Obtain a port control script configured for a network device;

[0117] Step S602: In the case where the port control script contains a port selection field, trigger a port selection operation for the network device;

[0118] Step S603: In response to the port selection operation triggered for the network device, determine a selected target port from a plurality of ports contained in the network device based on the port selection field;

[0119] Step S604: In the case where the port control script contains a parameter configuration field, trigger a configuration operation for the target port;

[0120] Step S605: In response to the configuration operation for the target port, read field information corresponding to the parameter configuration field from the port control script, and perform parameter conversion on the field information to determine an in-situ state control parameter configured for the target port;

[0121] Step S606: Obtain a driving state of the target port from a driving file of the target port, and in the case where the driving state is normal driving, construct a virtual state file for the target port;

[0122] The virtual state file contains in-situ state information of the target port; the in-situ state information is used to represent a communication connection state between the target port and a hardware device plugged into the target port.

[0123] Step S607, based on the in-place state control parameter, analyzing the in-place state, determining the expected state change trend of the target port within the set time length;

[0124] Step S608, according to the expected state change trend, determining the target time at which the expected in-place state changes relative to the previous time within the set time length;

[0125] Step S609, for each target time, determining in-place state change information representing the state change of the target time relative to the previous time;

[0126] Step S610, based on the in-place state change information corresponding to each target time respectively, determining the in-place state change sequence matched with the in-place state control parameter;

[0127] Step S611, for each target time, in the case that the current time matches the target time, and the initial in-place information corresponding to the target time is consistent with the current in-place information in the virtual state file, modifying the current in-place information to the updated in-place information corresponding to the target node;

[0128] Step S612, reading the in-place state information of the target port from the virtual state file;

[0129] Step S613, according to the communication connection state represented by the in-place state information, determining and executing the target program associated with the communication connection state;

[0130] Step S614, in the case that the operation and maintenance project to which the target program belongs is completed, deleting the virtual state file of the target port.

[0131] By using the above port control method, on the one hand, it is not necessary to physically plug and unplug the hardware device, and the communication connection state between the target port and the hardware device connected to the target port can be changed by pure software, which is beneficial to save time cost and improve work efficiency; on the other hand, the in-place state control parameter can be flexibly configured for the target port to match the specific needs of the application scenario, thereby avoiding repeated operations due to the inability to meet the application requirements, and further improving the work efficiency.

[0132] The port control method provided in the present application can be applied to the integration scene, fault reproduction and diagnosis scene, and system automatic recovery scene of the automatic test platform of the existing network.

[0133] In a specific embodiment, the technical solution of the present application is applied to the integration scenario of an automatic test platform in a live network. Specifically, the technical solution of the present application is integrated into an existing network device test platform, which can provide an automatic simulation of plugging and unplugging. A test engineer can configure a test script through a graphical user interface (GUI) or a command line interface (CLI), specify a target port and a module (for example, a hardware device connected to the port) to be simulated, and set relevant test parameters (i.e., in-place status control parameters such as plugging and unplugging frequency and duration). Thus, a virtual status file for the target port can be constructed, and the in-place status information of the target port in the virtual status file can be modified according to a sequence of in-place status changes matching the in-place status control parameters, so as to simulate plugging and unplugging of the target port. Further, when a new network device or software update is developed and deployed, a test team can systematically verify the robustness and fault recovery capability of the device through simulation of plugging and unplugging.

[0134] In a specific embodiment, the technical solution of the present application is applied to the integration scenario of an automatic test platform in a live network. Specifically, the technical solution of the present application is integrated into an existing network device test platform, which can provide an automatic simulation of plugging and unplugging. A test engineer can configure a test script through a graphical user interface (GUI) or a command line interface (CLI), specify a target port and a module (for example, a hardware device connected to the port) to be simulated, and set relevant test parameters (i.e., in-place status control parameters such as plugging and unplugging frequency and duration). Thus, a virtual status file for the target port can be constructed, and the in-place status information of the target port in the virtual status file can be modified according to a sequence of in-place status changes matching the in-place status control parameters, so as to simulate plugging and unplugging of the target port. Further, when a new network device or software update is developed and deployed, a test team can systematically verify the robustness and fault recovery capability of the device through simulation of plugging and unplugging.

[0135] In addition, using the simulation of plugging and unplugging provided by the present application, a network administrator can regularly test the fault recovery process and configuration of the network to ensure that the backup system and failover mechanism work as expected when a physical fault actually occurs. At the same time, when an abnormality occurs in a live network, the method provided by the present application can be used to complete a power-off and re-power-on through two modifications of in-place status information, to implement initialization of the target port, thereby reducing a part of manual intervention, which is particularly crucial for ensuring business continuity and data integrity.

[0136] In one embodiment, the port control method provided by the present application can be integrated into a network device test platform, so that the in-place state of a target port can be dynamically updated by software simulation and a virtual file system without relying on sensors or hardware interrupts. This method significantly reduces the dependence on hardware, reduces the cost and complexity of the system, and improves the flexibility of testing and maintenance. Further, through a user interface or an API, a developer can perform remote port control on a network device to complete corresponding testing on this basis, which is particularly effective for large-scale deployment and automated testing.

[0137] In one specific embodiment, as shown in Figure 7 the network device test platform can include a network management control system and a network operating system. The network management control system can include an authority control unit and an instruction issuing unit. The authority control unit is responsible for managing user sessions and authorities to ensure that only authorized users can perform simulation operations, which is suitable for network operation personnel. The instruction issuing unit is responsible for receiving user simulation instructions and scheduling state issuing configurations according to the instruction content to simulate the in-place state of the port. The network operating system can include a user operation interface. The user operation interface is used to provide a graphical interface for users to configure and start simulation tasks. The interface allows users to select target ports, configure in-place state control parameters, and start simulation plug-in programs and main programs. The interface also provides log and history recording functions, and users can view past simulation operations and their results. The network operating system is suitable for direct use by developers.

[0138] Further, the simulation plug-in program is responsible for generating and updating the in-place state information of the target port. It simulates various in-place states by modifying virtual state files (such as / tmp / .sff_present_[index]), which are transparent to other parts of the system, i.e., other system components treat these files as hardware signal sources. The main program of the network operating system can sense the change in the in-place state of the port caused by the running of the simulation plug-in program, and perform software self-repairing according to the simulation plug-in state.

[0139] In one embodiment, as shown in Figure 8As shown, during the main program running process, the in-place state of the specified port associated with the main program needs to be obtained. Specifically, if the simulation plug-in program is not currently called, i.e., the simulation plug-in function is not enabled, the actual port in-place state is directly obtained. For example, the drive state read from the drive file is taken as the actual port in-place state, i.e., the port actual state. If the simulation plug-in program is currently called, i.e., the simulation plug-in function is enabled, it can be further determined whether the specified port has a simulation in-place state. The simulation in-place state is represented by the in-place state information of the port in the virtual state file. If the specified port does not have a simulation in-place state, the port actual state is directly obtained; if the specified port has a simulation in-place state, the in-place state information of the specified port is obtained from the virtual state file, and the simulation in-place state represented by the in-place state information is determined.

[0140] Further, during the calling process of the simulation plug-in program, simulation plug-in configuration needs to be performed, i.e., the target port for simulation plug-in and the in-place state control parameter configuration for the target port are selected. That is, if the selected target port includes the specified port, it means that the specified port has a simulation in-place state. After the configuration is completed, the simulation plug-in function can be enabled for the target port, and the configuration of the port simulation state is realized by modifying the in-place state information of the target port in the virtual state file. After the simulation task is completed, the simulation plug-in function can be closed. The closing function can be, for example, deleting the virtual state file corresponding to the target port.

[0141] The technical solution of the present application can bring multiple significant benefits, which are of great significance for improving the test efficiency of network equipment, reducing operation and maintenance costs, enhancing system stability and reliability, and improving fault recovery time. The main advantages and benefits of the technical solution of the present application at least include:

[0142] 1. Improve test efficiency and accuracy

[0143] The present application greatly improves the efficiency of the test process by simulating the plug-in operation of the network equipment port through software. Compared with the traditional physical plug-in test, the software simulation does not require manual intervention and can quickly and repeatedly perform a large number of tests to ensure that each test under different operating conditions and configurations is consistent. This method improves the accuracy of the test because it eliminates variables that may be introduced due to improper human operation.

[0144] 2. Reduce operation and maintenance costs

[0145] Traditional physical testing methods not only consume time but also can cause hardware wear and tear, especially in scenarios where frequent plugging and unplugging are required to test the stability of the equipment. The software simulation method provided by the present application does not require physical operation, so it can significantly reduce hardware wear and tear and maintenance costs. In addition, by automating the test scripts, the network operation and maintenance team can perform more complex or more frequent tests without increasing additional labor costs.

[0146] 3. Enhancing system stability and reliability

[0147] The technical solution of the present application can simulate the behavior of network modules under various normal and abnormal conditions, helping network administrators to discover and repair potential stability problems in a timely manner. By regularly running simulated plugging and unplugging tests, it can ensure that network equipment can run stably in real operating environments and prevent possible failures in advance.

[0148] 4. Improving fault recovery time

[0149] The present application can not only be used for regular equipment testing, but also can simulate specific fault conditions that may be encountered in the live network, helping the technical team to develop and verify the fault recovery process. By simulating the specific conditions when a fault occurs, system administrators can better understand the causes of the fault and optimize the fault recovery strategy and process. This directly contributes to reducing the average repair time (Mean Time Between Failures, MTTR) of the system and improving the overall availability of services.

[0150] 5. Supporting large-scale deployment and management

[0151] Due to the high configurability and automation capability of the technical solution of the present application, it is particularly suitable for device management and testing in large-scale network environments. The scalability of the system ensures that even thousands of network ports can be managed effectively. In addition, by integrating into existing network management frameworks, tests can be deployed and run seamlessly without the need for large-scale modification of existing infrastructure.

[0152] Through these beneficial effects, the technical solution of the present application can significantly improve the management and maintenance efficiency of network equipment, providing strong support for data centers, cloud service providers and other enterprises that rely on high-stability network facilities. Further, the port control method provided by the present application can be deployed in a cloud computing system, with remote server port control to support simulation and testing of network equipment, which can further reduce local hardware requirements and improve the flexibility and scalability of testing. Machine learning algorithms can also be used to predict the failure and behavior of network equipment, and the test process and equipment maintenance can be optimized by simulating the prediction results.

[0153] It should be understood that although each step in the flowchart involved in each embodiment as described above is shown in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless explicitly stated herein, there is no strict order limitation for the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowchart involved in each embodiment as described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately or alternately executed with at least part of other steps or steps or stages in other steps.

[0154] Based on the same inventive concept, the embodiments of the present application also provide a port control device for implementing the above-mentioned port control method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more port control device embodiments provided below can refer to the limitations of the port control method described above, which will not be repeated here.

[0155] In one embodiment, as shown in Figure 9 A port control device is provided, comprising: a selection module 901, a configuration module 902, a parameter analysis module 903, and an information modification module 904, wherein:

[0156] The selection module 901 is configured to determine a selected target port from a plurality of ports contained in a network device in response to a port selection operation triggered for the network device;

[0157] The configuration module 902 is configured to obtain an in-place state control parameter of the target port and a virtual state file constructed for the target port in response to a configuration operation for the target port;

[0158] The parameter analysis module 903 is configured to analyze the in-place state control parameter and determine an in-place state change sequence matched with the in-place state control parameter;

[0159] The information modification module 904 is configured to modify in-place state information of the target port in the virtual state file according to the in-place state change sequence; the in-place state information is used to represent a communication connection state between the target port and a hardware device connected to the target port.

[0160] In an embodiment, the parameter analysis module 903 comprises: a target node determination unit configured to determine target nodes for which the expected in-place state changes with respect to the previous time according to the state change analysis based on the in-place state control parameter; and a sequence construction unit configured to determine the in-place state change sequence matching the in-place state control parameter according to the state change of each target node.

[0161] In an embodiment, the target node is characterized by time. In the case of this embodiment, the target node determination unit is specifically configured to determine the expected state change trend of the target port within a set time period according to the in-place state analysis based on the in-place state control parameter, and determine the target time for which the expected in-place state changes with respect to the previous time according to the expected state change trend.

[0162] In an embodiment, the sequence construction unit is specifically configured to determine, for each target node, in-place state change information characterizing the state change of the target node with respect to the previous node, and determine the in-place state change sequence matching the in-place state control parameter based on the in-place state change information corresponding to each target node.

[0163] In an embodiment, the port control device further comprises a file construction module configured to: obtain the drive state of the target port from the drive file of the target port; construct a virtual state file for the target port in the case where the drive state is normal; and the virtual state file contains the in-place state information of the target port.

[0164] In an embodiment, the port control device further comprises a program execution module configured to: read the in-place state information of the target port from the virtual state file; and determine and execute the target program associated with the communication connection state according to the communication connection state characterized by the in-place state information.

[0165] In an embodiment, the port control device further comprises a priority configuration module configured to configure corresponding priorities for the drive file and the virtual state file. In the case of this embodiment, the program execution module is specifically configured to read the in-place state information of the target port from the virtual state file in the case where the priority of the virtual state file is higher than the priority of the drive file.

[0166] In an embodiment, the priority configuration module is further configured to modify the priority of the virtual state file to be lower than the priority of the drive file in the case where the operation and maintenance project to which the target program belongs is completed.

[0167] In an embodiment, the port control device further comprises a file deletion module configured to delete the virtual state file in the case where the operation and maintenance project to which the target program belongs is completed.

[0168] In one embodiment, the information modification module 904 is specifically used to: determine the target node with a state information modification requirement, as well as the initial and updated in-situ information corresponding to the target node, based on the in-situ state change sequence; for each target node, if it matches the target node at the current time and the initial in-situ information corresponding to the target node is consistent with the current in-situ information in the virtual state file, modify the current in-situ information to the updated in-situ information corresponding to the information modification node.

[0169] In one embodiment, the port control device further includes: a script acquisition module for acquiring a port control script configured for the network device; and a port selection operation triggering module for triggering a port selection operation for the network device if the port control script contains a port selection field.

[0170] In one embodiment, the port control device further includes a configuration operation triggering module, used to trigger a configuration operation for a target port when the port control script includes parameter configuration fields. In this embodiment, the configuration module 902 is specifically used to: read field information corresponding to the parameter configuration fields from the port control script; perform parameter conversion on the field information to determine the in-situ status control parameters configured for the target port.

[0171] Each module in the aforementioned port control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0172] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The database stores the data involved in the above-described method embodiments. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a port control method.

[0173] In one embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram thereof can be as shown in FIG. 1. Figure 11 The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to perform wired or wireless communication with external terminals. The wireless communication can be achieved through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer program is executed by the processor to implement a port control method. The display unit of the computer device is configured to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, a trackball or a touchpad arranged on the shell of the computer device, or an external keyboard, a touchpad or a mouse, etc.

[0174] Those skilled in the art can understand that Figure 10 The structure shown in FIG. 1 or 11 is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0175] In one embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the above-mentioned method embodiments.

[0176] In one embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps of the above-mentioned method embodiments.

[0177] In one embodiment, a computer program product is provided, which includes a computer program. The computer program is executed by a processor to implement the steps of the above-mentioned method embodiments.

[0178] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of the region and area. Moreover, the object can choose not to authorize the object information and related data, and can refuse or can conveniently refuse to push information, etc.

[0179] In the present application, in the process of collecting and processing related data in the example application, the informed consent or separate consent of the personal information subject should be strictly obtained according to the requirements of the relevant regional laws and regulations, and the subsequent data use and processing behavior should be carried out within the scope of authorization of laws and regulations and personal information subjects.

[0180] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0181] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.

[0182] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A port control method, characterized by, The method comprises: determining a selected target port from a plurality of ports contained in a network device in response to a port selection operation triggered for the network device; acquiring an in-place state control parameter of the target port and a virtual state file constructed for the target port in response to a configuration operation for the target port; performing parsing processing on the in-place state control parameter to determine an in-place state change sequence matched with the in-place state control parameter; modifying in-place state information of the target port in the virtual state file according to the in-place state change sequence; the in-place state information is used to represent a communication connection state between the target port and a hardware device plugged in the target port.

2. The method of claim 1, wherein, The parsing processing on the in-place state control parameter to determine the in-place state change sequence matched with the in-place state control parameter comprises: performing state change analysis based on the in-place state control parameter to determine target nodes whose expected in-place states change relative to a previous moment; determining the in-place state change sequence matched with the in-place state control parameter according to state changes respectively corresponding to each of the target nodes.

3. The method of claim 2, wherein, The target nodes are represented by time; The performing state change analysis based on the in-place state control parameter to determine target nodes whose expected in-place states change relative to a previous moment comprises: performing in-place state analysis based on the in-place state control parameter to determine an expected state change trend of the target port within a set time length; determining a target moment at which an expected in-place state changes relative to a previous moment according to the expected state change trend within the set time length.

4. The method of claim 2, wherein, The determining the in-place state change sequence matched with the in-place state control parameter according to state changes respectively corresponding to each of the target nodes comprises: determining in-place state change information representing a state change of each of the target nodes relative to a previous node; determining the in-place state change sequence matched with the in-place state control parameter based on the in-place state change information respectively corresponding to each of the target nodes.

5. The method of claim 1, wherein, The method further comprises: acquiring a driving state of the target port from a driver file of the target port; constructing a virtual state file for the target port in a case where the driving state is normal; the virtual state file contains in-place state information of the target port.

6. The method of claim 5, wherein, The method further comprises: reading the in-place state information of the target port from the virtual state file; determining and executing a target program associated with a communication connection state represented by the in-place state information according to the communication connection state.

7. The method of claim 6, wherein, The method further comprises: configuring corresponding priorities for the driver file and the virtual state file respectively; The reading the in-place state information of the target port from the virtual state file comprises: reading the in-place state information of the target port from the virtual state file in a case where the priority of the virtual state file is higher than the priority of the driver file.

8. The method of claim 7, wherein, The method further comprises any one of the following two items: In a case where the target program belongs to a completed operation and maintenance project, the virtual state file is deleted; In a case where the target program belongs to a completed operation and maintenance project, the priority of the virtual state file is modified to be lower than the priority of the driver file.

9. The method according to any one of claims 1 to 8, characterized in that, The method further comprises: Based on the in-situ state change sequence, determining a target node with a state information modification requirement, and initial in-situ information and updated in-situ information corresponding to the target node; For each target node, in a case where the target node is matched at a current time, and the initial in-situ information corresponding to the target node is consistent with current in-situ information in the virtual state file, the current in-situ information is modified to the updated in-situ information corresponding to the target node.

10. The method according to any one of claims 1 to 8, characterized in that, The method further comprises: Obtaining a port control script configured for a network device; In a case where the port control script contains a port selection field, triggering a port selection operation for the network device.

11. The method of claim 10, wherein, The method further comprises: In a case where the port control script contains a parameter configuration field, triggering a configuration operation for the target port; The method further comprises: Reading field information corresponding to the parameter configuration field from the port control script; Performing parameter conversion on the field information to determine in-situ state control parameters configured for the target port.

12. A port control device, characterized by The apparatus comprises: A selection module configured to determine a selected target port from a plurality of ports included in a network device in response to a port selection operation triggered for the network device; A configuration module configured to obtain in-situ state control parameters of the target port and a virtual state file constructed for the target port in response to a configuration operation for the target port; A parameter analysis module configured to analyze the in-situ state control parameters to determine an in-situ state change sequence matched with the in-situ state control parameters; An information modification module configured to modify in-situ state information of the target port in the virtual state file according to the in-situ state change sequence; the in-situ state information is used to represent a communication connection state between the target port and a hardware device connected to the target port.

13. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 11.

14. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 11.

15. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 11.