Interface switching method and device, equipment and medium
By acquiring the level signals and interface configuration information of the AP device, and combining them with hardware signals and configuration information, automatic switching of the optical WAN port is realized, solving the problems of cumbersome operation and high misjudgment rate in the existing technology, and improving the automatic switching capability of the device.
Patent Information
- Application Number
- CN202511699737.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-10
AI Technical Summary
The interface switching of existing dual-mode photoelectric AP devices relies on software management, which makes operation cumbersome and makes it difficult to achieve reliable automatic switching.
By acquiring the target level signal and WAN interface configuration information of the AP wireless access point device, and combining the hardware signal and configuration information, the optical module status and interface type are determined, enabling automatic interface switching.
It achieves accurate and automatic interface switching, reduces the false judgment rate, reduces business interruption time, and improves the versatility and deployment convenience of the equipment.
Smart Images

Figure CN121509855A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and in particular to an interface switching method, device, equipment and medium. BACKGROUND
[0002] With the popularization of optical communication technology, network access scenarios are increasingly diversified. In order to meet the flexible access requirements in different deployment environments, a WAN port supporting both optical fiber and copper cable has become an important capability of an AP device. This support of optical and electrical dual modes can enable the same device to flexibly adapt to optical port direct connection in a data center or electrical port access in an enterprise or home, greatly improving the versatility and deployment convenience of the device.
[0003] At present, the mainstream scheme for realizing optical and electrical dual modes is a non-Combo scheme, which adopts independent optical and electrical port designs, has low hardware cost and simple structure, and is the mainstream choice in low-cost scenarios. However, this scheme relies on software to manage the states and switching of the two independent interfaces, and there are problems such as cumbersome operation in software switching, which makes it difficult to realize reliable automatic switching of the interfaces in applications.
[0004] Therefore, on the basis of the hardware of the non-Combo scheme, there is an urgent need for a method capable of realizing the automatic switching function of the optical and electrical WAN port. SUMMARY
[0005] The present application provides an interface switching method, device, equipment and medium, which can realize automatic switching of the interface.
[0006] To achieve the above-mentioned purpose, the present application adopts the following technical scheme: In a first aspect, the present application provides an interface switching method, comprising: obtaining a target level signal of an AP wireless access point device and WAN wide area network interface configuration information; determining an optical module state based on the target level signal, and determining an interface type based on the WAN interface configuration information; wherein the optical module state includes an in-place state and an out-of-place state; and the interface type includes an electrical WAN interface and an optical WAN interface; determining an interface switching action of the AP device based on the optical module insertion state and the interface type.
[0007] In one embodiment, determining the interface switching action of the AP device based on the optical module insertion state and the interface type comprises: in a case where the optical module insertion state is the in-place state and the interface type is the optical WAN interface, the interface switching action of the AP device is not to switch; in a case where the optical module insertion state is the in-place state and the interface type is the electrical WAN interface, the interface switching action of the AP device is to switch; When the optical module is not inserted and the interface type is optical WAN interface, the interface switching action of the AP device is switching. When the optical module is not inserted and the interface type is electrical WAN interface, the AP device's interface switching action is not to switch.
[0008] In one embodiment, determining the optical module state based on the target level signal includes: When the target level signal is low, the optical module insertion state is determined to be in place. When the target level signal is high, the optical module insertion status is determined to be out of place.
[0009] In one embodiment, determining the interface type based on WAN interface configuration information includes: Extract preset fields from the WAN interface configuration information; If the value of the preset field is the first preset value, the interface type is determined to be an electrical WAN interface; If the value of the preset field is the second preset value, the interface type is determined to be an optical WAN interface.
[0010] In one embodiment, acquiring the level signal of the AP wireless access point device and the WAN wide area network interface configuration information includes: The grounding status of the conductive structure in the optical module interface of the AP device is detected to obtain the target level signal; Based on preset commands, obtain WAN interface configuration information.
[0011] In one embodiment, it includes: Based on a preset detection period, the system acquires the level signal and WAN interface configuration information; the detection period is shorter than the port loop detection period.
[0012] In one embodiment, the interface switching action includes: Write the identifier of the target device tree file into the startup parameters of the AP device; wherein, the target device tree file includes a first device tree file for configuring the optical WAN interface or a second device tree file for configuring the electrical WAN interface; Control the AP device to restart, load the corresponding device tree configuration based on the identifier in the startup parameters, and thus complete the WAN interface switching.
[0013] Secondly, this application provides an interface switching device, comprising: The acquisition module is used to acquire the target level signal and WAN interface configuration information of the AP wireless access point device; The determination module is used to determine the optical module status based on the target level signal and the interface type based on the WAN interface configuration information; wherein, the optical module status includes in-position and out-of-position status; the interface type includes electrical WAN interface and optical WAN interface; The switching module is used to determine the interface switching action of the AP device based on the optical module insertion status and interface type.
[0014] Thirdly, this application provides a computing device, including a memory and a processor; The memory stores one or more computer programs, the one or more computer programs including instructions; when the instructions are executed by the processor, the computing device performs the method as described in any one of the first aspects.
[0015] Fourthly, this application provides a computer-readable storage medium for storing a computer program for performing the method as described in any one of the first aspects.
[0016] Fifthly, this application provides a computer program product comprising one or more computer instructions, wherein when the computer instructions are executed by a computer, the computer performs the method as described in any one of the first aspects.
[0017] As can be seen from the above technical solution, this application has at least the following beneficial effects: In this application, by acquiring the target level signal and WAN interface configuration information of the AP wireless access point device, a data foundation is provided for subsequent determination of the current interface type. Furthermore, based on the target level signal, the status of the optical module is determined to be either in-situ or out-of-situ, and based on the WAN interface configuration information, the interface type is determined to be either an electrical WAN interface or an optical WAN interface, accurately grasping the current interface status of the AP device. Consequently, based on the optical module insertion status and interface type, the interface switching action of the AP device can be determined. This solution introduces a target level signal to provide a basis for accurately determining the optical module status; furthermore, by combining it with WAN interface configuration information, it achieves accurate determination of the current interface connection status, ultimately realizing automatic interface switching.
[0018] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description
[0019] Figure 1 This is an application environment diagram of an interface switching method provided in the embodiments of this application; Figure 2 This is a flowchart illustrating an interface switching method provided in an embodiment of this application; Figure 3 This is a structural block diagram of an interface switching device provided in an embodiment of this application; Figure 4 This is an internal structural diagram of a computer device provided in the embodiments of the application. Detailed Implementation
[0020] The terms "first," "second," and "third," etc., used in this application specification and accompanying drawings are used to distinguish different objects, not to limit a specific order.
[0021] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0022] To make the technical solution of this application clearer and easier to understand, the application scenarios of the technical solution of this application are described below with reference to the accompanying drawings. Figure 1 As shown, this figure is an application environment diagram provided by an embodiment of this application.
[0023] In this application scenario, terminal 102 accesses the Internet through AP device 104, and terminal 102 can access the status of network resources provided by AP device 104.
[0024] To make the technical solution of this application clearer and easier to understand, the following describes how this method is applied in the above-mentioned application scenario. Figure 1 Taking AP device 104 as an example, this application describes an interface switching method provided in its embodiments. Figure 2 As shown in the figure, this figure is a flowchart illustrating an interface switching method provided in an embodiment of this application.
[0025] S201. Obtain the target level signal and WAN interface configuration information of the AP wireless access point device.
[0026] One possible approach is to detect the grounding status of the conductive structure in the optical module interface of an AP device to obtain a target level signal; and to acquire WAN interface configuration information based on a preset instruction.
[0027] Optionally, based on a preset detection period, the level signal and WAN interface configuration information are acquired; wherein the detection period is shorter than the port loop detection period.
[0028] Among them, AP (Access Point) wireless access point devices, or APs for short, are network devices that convert wired network signals into wireless signals, allowing wireless terminals such as mobile phones and computers to access the network. They are components for building wireless local area networks. The AP device needs to support optical and electrical WAN port switching to adapt to different wide area network access scenarios.
[0029] The target level signal refers to the electrical signal state (high level / low level) used to determine whether the optical module is in place. It is an important basis for detecting the presence of the optical module. When the optical module is inserted, its shell grounds the conductive structure of the AP optical module interface, and the detection device recognizes a low level. When the optical module is not inserted, the conductive structure is not grounded, and the detection device recognizes a high level.
[0030] The WAN (Wide Area Network Port) is the physical / logical interface through which an AP device connects to a wide area network. It is divided into two types: electrical WAN (which transmits electrical signals via a network cable, and the interface is mostly of type RJ45) and optical WAN (which transmits optical signals via optical fiber, and requires the use of an optical module). The type of the interface needs to be identified through its configuration information.
[0031] The conductive structure in the optical module interface is a metal or conductive component inside the optical module interface of the AP device used to cooperate with the optical module to realize grounding detection. It is the hardware basis for level signal detection. When the optical module is inserted, its shell contacts the conductive structure and grounds it, triggering a low-level signal. When not inserted, the structure remains ungrounded and outputs a high-level signal.
[0032] Preset commands refer to commands predefined in the AP device system for reading WAN port configuration information, such as the ethtool command, which can extract key configuration information such as the Supported ports field (distinguishing between electrical / optical interfaces) and bus address of the WAN port.
[0033] The preset detection period refers to the time interval set by the system for periodically acquiring level signals and WAN port configuration information, such as 100 milliseconds by default. Its purpose is to ensure the real-time detection of interface status.
[0034] The port loop detection cycle refers to the time interval used by network devices such as switches to detect whether there is a network loop (such as signal loop caused by incorrect network cable connection) in the port. The default cycle is 1-10 seconds, which is a reference for setting the detection cycle of AP devices.
[0035] For example, the dedicated physical slot / interface structure designed on the AP device to accommodate optical modules has a cavity, conductive contacts, and positioning components that match the shape of the optical module. From a hardware perspective, the optical module can be directly plugged into this interface. After insertion, not only can optical signals be transmitted through the interface, but its metal casing will also contact the preset conductive structure inside the interface and ground it, thereby triggering the AP device system to detect the target level signal. That is, this interface is the carrier for the physical connection, signal transmission, and presence detection between the optical module and the AP device, and it is also the hardware foundation for optical WAN port access to the wide area network.
[0036] When the optical module is inserted, its metal casing contacts the conductive structure, grounding the structure. The AP device system's detection device recognizes a low-level signal (this is the target level signal for the optical module being in place). When the optical module is not inserted, the conductive structure remains ungrounded, and the detection device recognizes a high-level signal (this is the target level signal for the optical module not being in place). The target level signal is obtained through this hardware detection action. Subsequently, the AP device system executes a preset ethtool command (such as ethtool eth0) to read the WAN interface configuration information, including "Supported" used to distinguish the interface type. The "ports" field (e.g., "TP" for electrical WAN ports, "Fiber" for optical WAN ports) and the WAN port bus address (which can be used for comparison and verification with a pre-stored address database) are used to obtain WAN interface configuration information. Simultaneously, to ensure real-time interface status detection and avoid conflicts with switch loop detection, the AP device system will periodically repeat the operations of "detecting the grounding status of conductive structures and obtaining level signals" and "calling preset instructions to obtain WAN interface configuration information" according to a preset detection cycle (default 100 milliseconds, which is less than the typical 1-10 second port loop detection cycle of switches). This captures real-time states such as optical module insertion / removal and WAN port type changes. The detection cycle can be dynamically adjusted through a configuration file to adapt to different switch parameters, ensuring timely interface switching decisions and network stability.
[0037] S202. Determine the optical module status based on the target level signal, and determine the interface type based on the WAN interface configuration information.
[0038] One possible approach is to determine that the optical module insertion state is in place when the target level signal is low, and to determine that the optical module insertion state is not in place when the target level signal is high.
[0039] The insertion status of the optical module can also be verified based on the storage information of the optical module.
[0040] Furthermore, preset fields are extracted from the WAN interface configuration information; if the value of the preset field is the first preset value, the interface type is determined to be an electrical WAN interface; if the value of the preset field is the second preset value, the interface type is determined to be an optical WAN interface.
[0041] The bus address of the WAN interface can also be obtained and compared with a pre-stored interface address database to verify the interface type.
[0042] The optical module status refers to the connection status between the optical module and the AP device, including two categories: in-place status (the optical module has been inserted into the optical module interface of the AP device) and out-of-place status (the optical module has not been inserted or has not been correctly inserted into the interface).
[0043] WAN interface configuration information is a set of parameters stored in the AP device system that describes the attributes of the WAN port, including interface type, bus address, speed, and other information, and is used to identify the specific type of WAN port.
[0044] The stored information of the optical module is its own working status data stored locally inside the optical module, such as whether the module is operating normally and whether the connection is stable. It can be read through the IIC (Inter-Integrated Circuit Interface) interface for secondary verification of the accuracy of the optical module's in-situ status.
[0045] Predefined fields are specific fields that are predefined in the WAN interface configuration information and are used to distinguish the interface type, such as the Supported ports field read by the ethtool command.
[0046] The first preset value and the second preset value correspond to specific values of the preset fields; for example, the first preset value is "TP (Twisted Paired)" to identify the electrical WAN interface; the second preset value is "Fiber" to identify the optical WAN interface.
[0047] The bus address of the WAN interface is a unique address identifier for the WAN port on the hardware bus of the AP device. It is the hardware attribute information that distinguishes different WAN ports (optical WAN port, electrical WAN port).
[0048] The pre-stored interface address library is a set of standard bus addresses corresponding to optical WAN ports and electrical WAN ports that are pre-stored in the AP device system. It is used to compare with the actual obtained WAN port bus address to verify the interface type judgment result.
[0049] The optical module status includes in-position and out-of-position states.
[0050] Interface types include electrical WAN interfaces and optical WAN interfaces.
[0051] For example, when a low-level target signal is detected, the optical module is determined to be in place, meaning it has been inserted into the AP device's optical module interface. When a high-level target signal is detected, the optical module is determined to be out of place, meaning it has not been inserted or has not been correctly inserted into the interface. To ensure accurate judgment, the system also reads the optical module's stored information through the IIC interface to perform a secondary verification of the initially determined optical module insertion status. Subsequently, the system processes the WAN interface configuration information to determine the interface type. For example, it first extracts a preset field (Supported ports field) from the WAN interface configuration information. If the field value is the first preset value "TP", the interface type is determined to be an electrical WAN interface. If the field value is the second preset value "Fiber", the interface type is determined to be an optical WAN interface. To further improve the reliability of identification, the system also obtains the current WAN interface's bus address and compares it with the pre-stored interface address database (including the standard bus address of the optical WAN port and the standard bus address of the electrical WAN port) to verify whether the interface type determined based on the preset field is accurate. Finally, the system completes the determination of the optical module status and the reliable identification of the WAN interface type.
[0052] S203. Based on the optical module insertion status and interface type, determine the interface switching action of the AP device.
[0053] One possible implementation is that, when the optical module is inserted in place and the interface type is an optical WAN interface, the AP device's interface switching action is no switching; when the optical module is inserted in place and the interface type is an electrical WAN interface, the AP device's interface switching action is switching; when the optical module is not inserted in place and the interface type is an optical WAN interface, the AP device's interface switching action is switching; and when the optical module is not inserted in place and the interface type is an electrical WAN interface, the AP device's interface switching action is no switching.
[0054] Write the identifier of the target device tree file into the startup parameters of the AP device; wherein, the target device tree file includes a first device tree file for configuring the optical WAN interface or a second device tree file for configuring the electrical WAN interface; control the AP device to restart, so as to load the corresponding device tree configuration based on the identifier in the startup parameters, thereby completing the WAN interface switching.
[0055] The target device tree file is a file based on the Linux kernel architecture used to define the hardware configuration of AP devices. Specifically, it includes a dedicated device tree file adapted to optical WAN interfaces or a dedicated device tree file adapted to electrical WAN interfaces. It is the core carrier for implementing interface hardware parameter configuration and driver loading.
[0056] The first device tree file is a subclass of the target device tree file, specifically used to configure the hardware parameters of the optical WAN interface, such as the optical port driver model, optical signal transmission rate, and optical interface bus address. After loading, the AP device can enable the optical WAN port function.
[0057] The second device tree file is a subclass of the target device tree file, specifically used to configure the hardware parameters of the electrical WAN interface, such as the electrical port RJ45 driver, electrical signal transmission rate, and electrical interface bus address. After loading, the AP device can enable the electrical WAN port function.
[0058] The startup parameters of an AP device are configuration parameters stored in the AP device's bootenv, i.e., startup environment variables, which guide the device startup process. The core parameter is config_name, whose value is the identifier of the target device tree file, which determines the hardware configuration file loaded when the device starts.
[0059] For example, firstly, based on the determined optical module insertion status and WAN interface type, a preset logic determines whether to perform an interface switching action. When the optical module is in place and the current interface type is an optical WAN interface, it is determined that the user's access intention is met, and the interface switching action is not performed. When the optical module is in place but the current interface is an electrical WAN interface, it is determined that the optical module access requirement needs to be adapted, and the switching action is performed. When the optical module is not in place but the current interface is an optical WAN interface, it is determined that the optical port has no actual access conditions, and the switching action is performed. When the optical module is not in place and the current interface is an electrical WAN interface, it is determined that the access requirement without the module is met, and the switching action is not performed. If it is determined that a switching action needs to be performed, the AP device system will further determine the target device tree file. If switching to the optical WAN port is required, the first device tree file is selected; if switching to the electrical WAN port is required, the second device tree file is selected. The identifier of the target device tree file is written into the bootenv startup parameter, i.e., the config_name parameter, of the AP device. Subsequently, the AP device system controls the AP device to execute an automatic restart command. After the device enters the boot process, it reads the target device tree file identifier stored in the bootenv boot parameters during the uboot stage, loads the corresponding device tree configuration from the file library of the pre-compiled Linux kernel image, and after the kernel completes initialization, it enables the corresponding WAN interface driver and hardware parameters according to the loaded device tree file, and finally completes the WAN interface switching.
[0060] It should be noted that the process involves acquiring the target level signal and WAN interface configuration information of the AP wireless access point device; determining the optical module status based on the target level signal and the interface type based on the WAN interface configuration information; and determining the AP device's interface switching action based on the optical module insertion status and interface type. This establishes a two-dimensional decision-making basis combining hardware signals and configuration information, providing a unified technical framework for subsequent accurate detection and automatic switching. It avoids misjudgments in switching due to a single detection dimension and fragmented decision-making logic, thus solving the pain point of lacking standards for detection and decision-making.
[0061] By determining the switching actions of the optical module's insertion status and interface type under different combinations, the resource waste of using inefficient electrical ports when the optical module is in place is avoided, and the service interruption caused by the optical port running idle after the optical module is removed is prevented. This ensures that the switching decision fully matches the user's access intention and solves the problem of switching triggering without a basis.
[0062] By determining whether the optical module is inserted in a low or high level based on the target signal level, the system avoids misidentification caused by signal interference through a strong correlation between the grounding status and the signal level at the hardware level. At the same time, combined with the verification of the optical module's stored information, a dual verification of hardware signals and module self-test is formed, which greatly reduces the false judgment rate of optical module detection, solves the problem of unreliable optical module status identification, and provides accurate hardware status basis for switching decisions.
[0063] By clearly extracting preset fields and matching field values, and by calling the system's underlying configuration information, a standardized interface type identification method is established to avoid misjudgments caused by manual identification or non-standard instructions. Combined with the verification logic of bus address comparison, the accuracy of interface type identification is further improved, solving the problem of the lack of a reliable method for WAN port type identification.
[0064] By clearly defining the specific implementation paths for obtaining level signals by detecting the grounding status of conductive structures and obtaining WAN interface configuration information based on preset instructions (the former can be achieved through the existing optical module interface conductive structure of the AP device without additional hardware; the latter reads the configuration through the general "ethtool" instruction without the need for customized tools), the solution utilizes the original hardware resources of the equipment to reduce costs and reduces technical differences between manufacturers through standardized testing methods. This solves the problems of inconsistent testing methods and difficulty in implementation, making it easier for the solution to be promoted on a large scale.
[0065] By explicitly designing the detection cycle to be shorter than the port loop detection cycle, the AP device ensures that the entire process of status detection, switching decision, and interface switching is completed before the switch determines a loop, avoiding port shutdown caused by switching delays. At the same time, it supports dynamic adjustment of the detection cycle, which can adapt to the loop detection parameters of different brands of switches, solving the problems of fixed detection cycles and poor compatibility, ensuring network stability in different deployment scenarios, and avoiding service interruptions.
[0066] By explicitly writing the target device tree identifier into the startup parameters, automatically restarting, and loading the corresponding configuration, a fully automated switching process is implemented. No manual intervention is required for DTS file selection and parameter configuration. The system can automatically match the first / second device tree file based on the switching decision, pass configuration instructions through startup parameters, and automatically load the corresponding interface configuration after restarting. The entire process requires no manual operation, and the time for restarting and loading the device tree is much shorter than the time spent on manual configuration, which greatly reduces business interruption time and solves the problems of cumbersome switching and long business interruptions.
[0067] The aforementioned interface switching method, by acquiring the target voltage level signal and WAN interface configuration information of the AP wireless access point device, provides a data foundation for subsequent determination of the current interface type. Furthermore, based on the target voltage level signal, it determines whether the optical module is in place or not, and based on the WAN interface configuration information, it determines whether the interface type is an electrical WAN interface or an optical WAN interface, accurately grasping the current interface status of the AP device. Consequently, based on the optical module insertion status and interface type, the interface switching action of the AP device can be determined. This solution, by introducing a target voltage level signal, provides a basis for accurately determining the optical module status; furthermore, by combining it with WAN interface configuration information, it achieves accurate determination of the current interface connection status, ultimately realizing automatic interface switching.
[0068] The above text combined Figures 1 to 2 The interface switching method provided in the embodiments of this application has been described in detail. The apparatus and device provided in the embodiments of this application will be described below with reference to the accompanying drawings.
[0069] like Figure 3 As shown, this figure is a structural block diagram of an interface switching device 600 provided in an embodiment of this application. The interface switching device 600 includes: an acquisition module 601, a determination module 602, and a switching module 60, wherein: The acquisition module 601 is used to acquire the target level signal and WAN interface configuration information of the AP wireless access point device; The determination module 602 is used to determine the optical module status based on the target level signal and to determine the interface type based on the WAN interface configuration information; wherein, the optical module status includes in-position status and out-of-position status; and the interface type includes electrical WAN interface and optical WAN interface. The switching module 603 is used to determine the interface switching action of the AP device based on the optical module insertion status and interface type.
[0070] In one embodiment, the switching module 603 is specifically used for: When the optical module is inserted in place and the interface type is optical WAN interface, the AP device's interface switching action is not to switch. When the optical module is inserted in the in-place state and the interface type is electrical WAN interface, the interface switching action of the AP device is switching. When the optical module is not inserted and the interface type is optical WAN interface, the interface switching action of the AP device is switching. When the optical module is not inserted and the interface type is electrical WAN interface, the AP device's interface switching action is not to switch.
[0071] In one embodiment, the determining module 602 is specifically used for: When the target level signal is low, the optical module insertion state is determined to be in place. When the target level signal is high, the optical module insertion status is determined to be out of place.
[0072] In one embodiment, the determining module 602 is specifically used for: Extract preset fields from the WAN interface configuration information; If the value of the preset field is the first preset value, the interface type is determined to be an electrical WAN interface; If the value of the preset field is the second preset value, the interface type is determined to be an optical WAN interface.
[0073] In one embodiment, the acquisition module 601 is specifically used for: The grounding status of the conductive structure in the optical module interface of the AP device is detected to obtain the target level signal; Based on preset commands, obtain WAN interface configuration information.
[0074] In one embodiment, the acquisition module 601 is specifically used for: Based on a preset detection period, the system acquires the level signal and WAN interface configuration information; the detection period is shorter than the port loop detection period.
[0075] In one embodiment, the switching module 603 is specifically used for: Write the identifier of the target device tree file into the startup parameters of the AP device; wherein, the target device tree file includes a first device tree file for configuring the optical WAN interface or a second device tree file for configuring the electrical WAN interface; Control the AP device to restart, load the corresponding device tree configuration based on the identifier in the startup parameters, and thus complete the WAN interface switching.
[0076] The interface switching device 600 according to the embodiments of this application can correspondingly execute the method described in the embodiments of this application, and the other operations and / or functions of each module / unit of the interface switching device 600 are respectively for implementing Figure 2 For the sake of brevity, the corresponding processes of each method in the illustrated embodiments will not be described in detail here.
[0077] This application also provides a computing device. This computing device can be a local computing device or an application server.
[0078] like Figure 4 As shown in the figure, this is an internal structural diagram of a computing device provided in an embodiment of this application. The computing device 700 includes a bus 701, a processor 702, a communication interface 703, and a memory 704. The processor 702, the memory 704, and the communication interface 703 communicate with each other via the bus 701.
[0079] The 701 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0080] The processor 702 can be any one or more of the following processors: central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP), or digital signal processor (DSP).
[0081] The communication interface 703 is used for communication with external devices.
[0082] Memory 704 may include volatile memory, such as random access memory (RAM). Memory 704 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0083] The memory 704 stores executable code, and the processor 702 executes the executable code to perform the aforementioned interface switching method.
[0084] Specifically, in achieving Figure 3 In the case of the illustrated embodiment, and Figure 3 When the modules or units of the interface switching device described in the embodiment are implemented by software, the execution... Figure 3 The software or program code required for the functions of each module / unit can be partially or wholly stored in memory 704. Processor 702 executes the program code corresponding to each unit stored in memory 704 and performs the aforementioned interface switching method.
[0085] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the aforementioned interface switching method.
[0086] This application also provides a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application are generated.
[0087] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0088] When the computer program product is executed by a computer, the computer performs any of the aforementioned interface switching methods. The computer program product can be a software installation package; when any of the aforementioned interface switching methods is required, the computer program product can be downloaded and executed on the computer.
[0089] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0090] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.
Claims
1. An interface switching method, characterized in that, The method includes: Obtain the target signal level and WAN interface configuration information of the AP wireless access point device; Based on the target level signal, the optical module status is determined, and based on the WAN interface configuration information, the interface type is determined; wherein, the optical module status includes in-position and out-of-position states; the interface type includes electrical WAN interface and optical WAN interface; Based on the optical module insertion status and interface type, the interface switching action of the AP device is determined.
2. The method according to claim 1, characterized in that, The step of determining the interface switching action of the AP device based on the optical module insertion status and interface type includes: When the optical module is inserted in place and the interface type is an optical WAN interface, the interface switching action of the AP device is not to switch. When the optical module is inserted in place and the interface type is an electrical WAN interface, the interface switching action of the AP device is switching. When the optical module is not inserted and the interface type is an optical WAN interface, the interface switching action of the AP device is switching. When the optical module is not inserted and the interface type is an electrical WAN interface, the interface switching action of the AP device is not to switch.
3. The method according to claim 1, characterized in that, Determining the optical module status based on the target level signal includes: When the target level signal is low, the optical module insertion state is determined to be in place. When the target level signal is high, the optical module insertion state is determined to be in an off-position state.
4. The method according to claim 1, characterized in that, The process of determining the interface type based on WAN interface configuration information includes: Extract preset fields from the WAN interface configuration information; If the value of the preset field is a first preset value, the interface type is determined to be an electrical WAN interface; If the value of the preset field is the second preset value, the interface type is determined to be an optical WAN interface.
5. The method according to claim 1, characterized in that, The acquisition of the AP wireless access point device's signal level and WAN wide area network interface configuration information includes: The grounding status of the conductive structure in the optical module interface of the AP device is detected to obtain the target level signal; Based on preset commands, obtain WAN interface configuration information.
6. The method according to claim 1, characterized in that, The method further includes: Based on a preset detection period, level signals and WAN interface configuration information are acquired; wherein the detection period is shorter than the port loop detection period.
7. The method according to claim 1, characterized in that, The interface switching action includes: Write the identifier of the target device tree file into the startup parameters of the AP device; wherein, the target device tree file includes a first device tree file for configuring the optical WAN interface or a second device tree file for configuring the electrical WAN interface; The AP device is restarted to load the corresponding device tree configuration based on the identifier in the startup parameters, thereby completing the WAN interface switching.
8. An interface switching device, characterized in that, The device includes: The acquisition module is used to acquire the target level signal and WAN interface configuration information of the AP wireless access point device; The determination module is used to determine the optical module status based on the target level signal, and to determine the interface type based on the WAN interface configuration information; wherein, the optical module status includes an in-position status and an out-of-position status; and the interface type includes an electrical WAN interface and an optical WAN interface. The switching module is used to determine the interface switching action of the AP device based on the insertion status and interface type of the optical module.
9. A computing device, characterized in that, Including memory and processor; The memory stores one or more computer programs, the one or more computer programs including instructions; when the instructions are executed by the processor, the computing device performs the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method as described in any one of claims 1 to 7.