Method and device for acquiring switch state information, electronic equipment and storage medium
By acquiring switch status information cached in the BMC at the CPU end and storing it in a local database, the high concurrency problem of the BMC is solved, the system stability and information acquisition efficiency are improved, network latency is reduced, and the user experience is enhanced.
Patent Information
- Application Number
- CN202211519466.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-11-30
AI Technical Summary
In switching devices, excessive status information monitored by the BMC leads to high concurrency, exhausting computing resources and affecting system stability and security.
By calling the interface provided by the BMC through the CPU, the switch status information cached by the BMC can be obtained and stored in the local database, reducing the number of BMC accesses and network communication latency, and reducing the risk of high concurrency.
This reduced the number of BMC accesses, lowered the risk of high concurrency, improved system stability and security, and enhanced the efficiency of information retrieval and user experience.
Smart Images

Figure CN115883495B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of switch technology, and in particular to a method, apparatus, electronic device and storage medium for obtaining switch status information. Background Technology
[0002] With the continuous upgrading of switching equipment, many switches are equipped with a Board Management Controller (BMC) to monitor and manage their operational status in order to better manage them. As data center networks develop, the BMC needs to monitor an increasing amount of switch status information to better execute control policies.
[0003] In some technologies, the SONIC system (Software for Open Networking in the Cloud, an open-source network switch operating system) running on the switch uses a multi-process, constantly polling switch status information. When the BMC (Block Controller) monitors too much switch status information, it may access BMC information nearly a hundred times simultaneously. This is even more serious in chassis-based devices. When a single BMC manages multiple line cards, excessive access can cause high concurrency for the BMC, exhausting computing resources and creating a significant risk of the switch becoming uncontrollable. Summary of the Invention
[0004] The main objective of this application is to provide a method, apparatus, electronic device, and storage medium for obtaining switch status information.
[0005] In a first aspect, embodiments of this application provide a method for obtaining switch status information, applied to a central processing unit (CPU), wherein the CPU is communicatively connected to the baseboard management controller (BMC) of the switch, and the method includes:
[0006] By calling the interface provided by the BMC, the status information of the switch cached by the BMC can be obtained;
[0007] The acquired status information is stored in a local database;
[0008] In response to a status information request, the stored status information is read from the database.
[0009] Optionally, the BMC is used to cache multiple status information of the switch, and the BMC provides an interface for returning at least two status information from the multiple status information at once; obtaining the status information of the switch cached by the BMC by calling the interface provided by the BMC includes:
[0010] Based on the required status information, the corresponding interface is called to obtain the corresponding status information of the BMC cache; wherein, the required status information is at least a portion of the multiple status information.
[0011] Optionally, the interface provided by the BMC includes an interface for obtaining all status information, so that the BMC can return all status information in a single response.
[0012] Optionally, the status information of the switch cached by the BMC can be obtained by calling the interface provided by the BMC, including:
[0013] Enable information synchronization service. Based on the information synchronization service, call the interface provided by the BMC at preset intervals to obtain the status information of the switch cached by the BMC.
[0014] Secondly, embodiments of this application provide another method for obtaining switch status information, applied to the BMC of a switch, wherein the BMC is communicatively connected to the CPU, and the method includes:
[0015] Collect and cache the status information of the switch;
[0016] When the CPU calls the interface provided by the BMC, cached status information is transmitted to the CPU so that the CPU stores the acquired status information in a local database and reads the status information from the database according to the status information call request.
[0017] Optionally, the status information of the switch is collected and cached, including:
[0018] Start the information collection service, and collect the status information of the switch periodically based on the information collection service;
[0019] The collected status information is written to a local custom cache.
[0020] Optionally, based on the information collection service, the status information of the switch is collected periodically, including:
[0021] Based on the information collection service, determine the collection interval corresponding to each type of collection device in at least one type of collection device;
[0022] Based on the acquisition intervals corresponding to each type of acquisition device, status information is periodically obtained from each acquisition device.
[0023] Different acquisition devices are used to obtain different status information of the switch.
[0024] Thirdly, embodiments of this application provide a device for acquiring switch status information, applied to a CPU, wherein the CPU is communicatively connected to the BMC of the switch, and the device includes:
[0025] The acquisition module is used to acquire the status information of the switch cached by the BMC by calling the interface provided by the BMC;
[0026] The storage module is used to store the acquired status information into a local database;
[0027] The reading module is used to read stored status information from the database in response to a status information call request.
[0028] Fourthly, embodiments of this application provide another device for acquiring switch status information, applied to the BMC of a switch, wherein the BMC is communicatively connected to the CPU, and the device includes:
[0029] A collection device is used to collect and cache the status information of the switch;
[0030] The transmission device is used to transmit cached status information to the CPU when the CPU calls the interface provided by the BMC, so that the CPU stores the acquired status information in a local database and reads the status information from the database according to the status information call request.
[0031] Fifthly, embodiments of this application provide an electronic device, including:
[0032] At least one processor; and
[0033] A memory that is communicatively connected to the at least one processor;
[0034] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, cause the electronic device to perform the method described in any of the above aspects.
[0035] Sixthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in any of the above aspects.
[0036] The method, apparatus, electronic device, and storage medium for obtaining switch status information provided in this application can obtain the switch status information cached by the BMC by calling the interface provided by the BMC through the CPU, store the obtained status information in a local database, and read the stored status information from the database in response to a status information call request. This greatly reduces the communication latency for obtaining switch status information, improves the user experience, reduces the access volume of the BMC, reduces the situation where the BMC exhausts computing resources due to high concurrency, and improves the security of the switch. Attached Figure Description
[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0038] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0039] Figure 2 A flowchart illustrating a method for obtaining switch status information provided in an embodiment of this application;
[0040] Figure 3 A flowchart illustrating another method for obtaining switch status information provided in this application embodiment;
[0041] Figure 4 A schematic diagram illustrating the interaction between a CPU and a BMC, provided for an embodiment of this application;
[0042] Figure 5 A schematic diagram of a device for acquiring switch status information provided in an embodiment of this application;
[0043] Figure 6 A schematic diagram of another device for acquiring switch status information provided in an embodiment of this application;
[0044] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0045] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0047] With the continuous development of data center networks, the status information of switches that BMCs need to monitor is increasing in order to better implement management and control strategies. In some technologies, the Platform API design of the SONIC system running on the switch will continuously poll the status information of the switch through multiple processes. In chassis devices, when a BMC manages multiple line cards, under the SONIC Platform API implementation, the system will periodically poll nearly a hundred different information from sensors such as temperature, fan, and power at multiple processes. When multiple CPUs (Central Processing Units) access this fine-grained information at the same time, the BMC needs to respond to nearly a hundred interface call requests at the same time, which can easily cause high concurrency risks. Moreover, since the network communication method itself has a large latency, too many accesses will also increase the data acquisition time.
[0048] In view of this, this application provides a faster and more stable method for accessing switch status information in the BMC. The BMC actively polls the acquisition device and caches the acquired switch status information locally. The CPU retrieves the cached switch status information in the BMC by calling the interface provided by the BMC and stores it in a local database. When the user needs to view the switch status information, they only need to read it from the local database. On the one hand, this reduces the number of times the BMC responds to requests at the same time, reducing the risk of high concurrency in the BMC. On the other hand, changing the information acquisition from network communication to local reading reduces network latency and improves the efficiency of information acquisition.
[0049] Figure 1 This is an application scenario diagram provided for an embodiment of this application. For example... Figure 1As shown, a switch may include M CPUs, a BMC, and N acquisition devices. The M CPUs are CPU1, CPU2, CPU3...CPUN, and the N acquisition devices are acquisition device 1, acquisition device 2, acquisition device 3...acquisition device N. Each CPU has a SONIC system running on it. The BMC acquires the switch status information collected by the N acquisition devices and caches it locally. The SONIC system running on the switch CPU calls the interface on the BMC through the Platform API to obtain the cached status information in the BMC and store it in the local database. When a user needs to check the operating status of the switch, they only need to read the information in the database of the SONIC system.
[0050] In this embodiment, the roles of the BMC and the SONiC system running on the CPU have changed. The BMC no longer passively waits for the Platform API to access its interface and then collects the required switch status information according to the instructions. Instead, it actively obtains the switch information and caches it locally. The SONiC system no longer waits for user viewing instructions but actively accesses the BMC's interface, obtains the cached data in the BMC, and stores it in its local database. This reduces the phenomenon of the BMC responding to too many interface calls at the same time, reduces the risk of high concurrency of the BMC, improves the utilization of CPU and BMC resources, reduces network latency, and improves the stability and reliability of the system.
[0051] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0052] Figure 2 This is a flowchart illustrating a method for obtaining switch status information provided in an embodiment of this application. In this embodiment, the execution entity of the method can be a CPU, which is communicatively connected to the switch's BMC. Optionally, the CPU can communicate with the BMC via network access or bus access. As shown in Figure 2, the method for obtaining switch status information provided in this embodiment may include:
[0053] Step 201: Obtain the status information of the switch cached by the BMC by calling the interface provided by the BMC.
[0054] The BMC can monitor and manage the operating status of the switch, including information such as temperature, voltage, fan status, and power supply.
[0055] After acquiring the status information, the BMC can cache it. Furthermore, the BMC provides an interface, which can be an API, for returning the switch's status information. The CPU can call the corresponding interface to obtain the status information.
[0056] Specifically, the SONiC system's Platform API, running on the CPU, can access the BMC via the IPMI Tool (Intelligent Platform Management Interface Tool) or the RESTful interface network. By calling the BMC's interface, it can obtain the switch status information cached in the BMC. The RESTful interface is a REST (Representational State Transfer) style interface.
[0057] Step 202: Store the obtained status information in the local database.
[0058] Optionally, when the obtained status information comes from different BMC terminals, the format is often not uniform. In order to facilitate maintenance and use, the obtained status information can be formatted according to a custom data structure and written to the local Redis (RemoteDictionary Server) database.
[0059] Step 203: In response to the status information call request, read the stored status information from the database.
[0060] After obtaining the status information, it can be stored in a local Redis database. When a specific status information of the switch needs to be retrieved, it can be read directly from the local Redis database. Specifically, it can be retrieved when a status information retrieval request is received. The triggering timing of the status information retrieval request can be set according to actual needs.
[0061] In one example, the status information retrieval request can be triggered by a user. Optionally, the user terminal can provide an interface for viewing the switch's status information. After the user inputs a command to view the status information on the interface, the user terminal can initiate a status information retrieval request to the CPU. The CPU can then respond to the request, read the status information from the database, and feed it back to the user terminal.
[0062] In another example, the status information retrieval request can be automatically triggered by the system. For instance, it can be configured to check the switch's status information for anomalies at regular intervals and output alarm information when an anomaly occurs. Alternatively, the status information can be fed back to the user terminal at regular intervals.
[0063] In summary, the switch status information acquisition method provided in this embodiment obtains the switch status information cached by the BMC by calling the interface provided by the BMC, stores the acquired status information in a local database, and reads the stored status information from the database in response to a status information access request. This eliminates the need to wait for a user to need to view a specific switch status information before accessing the BMC through the SONiC system, and then for the BMC to retrieve the corresponding status information and transmit it back to the CPU via the corresponding interface. Instead, it transforms the process from passive to active: the BMC actively acquires and caches the switch status information, and the CPU actively retrieves the cached switch status information from the BMC and stores it in the database. When a user needs to view the switch status information, they only need to read the information from the database. This changes the process from obtaining information through network communication to reading local information, significantly reducing the communication latency for acquiring switch status information, improving user experience, reducing the number of BMC accesses, reducing the possibility of the BMC exhausting its computing resources due to high concurrency, and improving switch security.
[0064] Optionally, the BMC is used to cache multiple status information of the switch, and the BMC provides an interface for returning at least two status information from the multiple status information at once; obtaining the status information of the switch cached by the BMC by calling the interface provided by the BMC includes:
[0065] Based on the required status information, the corresponding interface is called to obtain the corresponding status information of the BMC cache; wherein, the required status information is at least a portion of the multiple status information.
[0066] Optionally, the BMC caches multiple status information of the switch. To obtain the switch's temperature information, the SONiC system's Platform API can call the interface provided by the BMC corresponding to the temperature information to retrieve the cached temperature information of the switch. Furthermore, the BMC provides an interface that can return at least two pieces of information at once. For example, calling the BMC's interface A can simultaneously retrieve the most frequently viewed information cached in the BMC, such as temperature and voltage information. Calling the BMC's interface B can simultaneously retrieve all fan-related information cached in the BMC, such as fan speed and fan orientation.
[0067] In this way, on the one hand, the number of times the BMC responds to API calls at the same time can be reduced, thus mitigating the risk of high concurrency in the BMC; on the other hand, the types of information returned by the BMC API can be flexibly configured according to user needs, improving the efficiency of information transmission and enhancing the user experience.
[0068] Optionally, the interface provided by the BMC includes an interface for obtaining all status information, so that the BMC can return all status information in a single response.
[0069] Specifically, the BMC provides an interface that can obtain all status information. For example, calling the BMC's C interface can obtain all status information of the switch.
[0070] In this way, the BMC provides an interface that returns all status information at once, further reducing the number of times the BMC responds to interface calls at the same time, reducing the risk of high concurrency in the BMC, and improving the efficiency of information transmission.
[0071] In practical applications, the BMC can be configured with only one interface to return all status information, which is simple and easy to implement. Alternatively, the BMC can be configured with multiple interfaces, allowing different CPUs to call them according to their own needs, thus providing greater flexibility.
[0072] Optionally, the status information of the switch cached by the BMC can be obtained by calling the interface provided by the BMC, including:
[0073] Enable information synchronization service. Based on the information synchronization service, call the interface provided by the BMC at preset intervals to obtain the status information of the switch cached by the BMC.
[0074] Specifically, the SONIC system on the CPU side enables an information synchronization service. This service can call the interface provided by the BMC at preset intervals to obtain the status information of the switches cached by the BMC. This preset interval can be flexibly configured according to the type of acquisition device and actual needs. For example, it can call the interface on the BMC that can obtain fan speed information every 60 seconds; or call the interface on the BMC that can obtain temperature information every 120 seconds.
[0075] In this way, by setting a preset cycle according to the type of acquisition device and actual needs, the CPU burden can be reduced while ensuring the real-time performance and accuracy of the acquired switch status information, making the CPU resource allocation more reasonable and efficient.
[0076] Figure 3This is a flowchart illustrating another method for obtaining switch status information provided in this application embodiment. In this embodiment, the execution entity of the method can be the switch's BMC, which can communicate with the CPU. As shown in Figure 3, the method for obtaining switch status information provided in this application embodiment may include:
[0077] Step 301: Collect and cache the status information of the switch.
[0078] Step 302: When the CPU calls the interface provided by the BMC, transmit the cached status information to the CPU so that the CPU stores the acquired status information in the local database and reads the status information from the database according to the status information call request.
[0079] Specifically, the BMC can collect the status information of the switch and cache it in the BMC. When the SONiC system's Platform API calls the interface provided by the BMC, the status information is transmitted to the CPU and stored in the SONiC system's built-in Redis database. When the user needs to view the status of the switch, he / she can directly retrieve the corresponding information from the database.
[0080] Optionally, collecting and caching the status information of the switch includes: starting an information collection service, periodically collecting the status information of the switch based on the information collection service, and writing the collected status information into a local custom cache.
[0081] Specifically, the BMC can start an information collection service, which can periodically collect the status information of the switch. The standard for this time interval can be determined according to actual needs. For example, it can poll the switch's acquisition device every 60 seconds to collect all the status information of the switch. Then, the collected status information is stored in a custom cache space on the BMC's local machine. After being accessed by the CPU, the cached status information is sent to the CPU and stored in the CPU's local Redis database.
[0082] By polling the switch's data acquisition device at fixed intervals, the workload of the BMC can be reduced, the risk of high concurrency can be mitigated, and actual needs can be met. This also ensures the real-time performance and accuracy of the switch status information cached in the BMC to a certain extent.
[0083] Optionally, based on the information collection service, the status information of the switch is collected periodically, including: based on the information collection service, determining the collection interval corresponding to each type of collection device in at least one type of collection device; and periodically obtaining status information from each collection device based on the collection interval corresponding to each type of collection device; wherein different collection devices are used to obtain different status information of the switch.
[0084] Specifically, when collecting status information of a switch, different collection intervals can be set according to the type of collection device. For devices that collect information such as fan speed and voltage that changes relatively quickly, the collection interval can be set to be shorter; for devices that collect information such as temperature that changes relatively slowly, the collection interval can be set to be longer.
[0085] In this way, different acquisition intervals can be set for different acquisition devices, which improves the utilization rate of BMC working resources and further enhances the real-time performance and accuracy of the switch status information cached in BMC.
[0086] In summary, the method for obtaining switch status information provided in this embodiment can collect and cache the switch's status information. When the CPU calls the interface provided by the BMC, the cached status information is transmitted to the CPU, enabling the CPU to store the acquired status information in a local database. Based on the status information call request, the CPU reads the status information from the database. This transforms information acquisition via network communication into reading information from a local database, significantly reducing communication latency for obtaining switch status information, improving user experience, reducing BMC access volume, minimizing the possibility of the BMC exhausting its computing resources due to high concurrency, and improving switch security.
[0087] Figure 4 This is a schematic diagram illustrating the interaction between a CPU and a BMC, provided as an embodiment of this application. Figure 4As shown, the BMC (Block Controller) starts an information collection service, periodically polling the status information of the switches on the BMC and writing the collected information into a custom cache space. To reduce the number of RESTful requests the BMC responds to, a standard RESTful interface that returns all information is provided to respond to access requests from one or more CPUs. At any given time, the BMC only needs to respond once to a single CPU. The CPU starts an information synchronization service, periodically accessing the RESTful interface to retrieve the switch status information cached by the BMC. Since the status information obtained from the BMC is not uniformly formatted, to facilitate maintenance and use, the relevant switch status information is formatted according to a custom data structure. Based on the decoupling principle of SONiC, a separate space is allocated in the built-in Redis database to store the formatted data. Simultaneously, the Platform API process can directly call the SONiC built-in database interface to access the corresponding information.
[0088] Information synchronization is achieved by starting corresponding services on both the CPU and BMC sides. Leveraging the decoupling mechanism of SONiC itself, the built-in Redis database resources are utilized to the maximum extent. This optimizes the CPU's access to BMC information from remote network access to local cache access, significantly reducing access time and the performance burden on the BMC side. Comparison with the unoptimized solution shows that the time for polling switch status information using the SONiC Platform API has been reduced from 100 seconds to 0.1 seconds per cycle, greatly reducing latency and improving system stability and reliability. Corresponding to the above method for obtaining switch status information, this application also provides a device for obtaining switch status information. Figure 5 This is a schematic diagram of a device for acquiring switch status information provided in an embodiment of this application. Figure 5 As shown, the device is applied to a CPU, which is connected to the BMC of a switch for communication. The device includes:
[0089] The acquisition module 501 is used to acquire the status information of the switch cached by the BMC by calling the interface provided by the BMC;
[0090] Storage module 502 is used to store the acquired status information into a local database;
[0091] The reading module 503 is used to read stored status information from the database in response to a status information call request.
[0092] Optionally, the BMC is used to cache multiple status information of the switch, and the BMC provides an interface for returning at least two status information from the multiple status information at one time; the acquisition module 501 is specifically used to: call the corresponding interface to obtain the corresponding status information cached by the BMC as needed; wherein, the status information to be obtained is at least a portion of the multiple status information.
[0093] Optionally, the BMC provides an interface for obtaining all status information, so that the BMC can return all status information in a single response.
[0094] Optionally, the acquisition module 501 is specifically used to: enable the information synchronization service, and based on the information synchronization service, call the interface provided by the BMC at preset intervals to obtain the status information of the switch cached by the BMC.
[0095] The switch status information acquisition device provided in this application embodiment can be used to perform the above-described... Figure 2 The technical solutions of the embodiments shown are similar in principle and in effect, and will not be described again here.
[0096] Corresponding to the above-described method for obtaining switch status information, this application embodiment also provides another device for obtaining switch status information. Figure 6 This is a schematic diagram of another device for acquiring switch status information provided in an embodiment of this application. Figure 6 As shown, a BMC (Browser Controller) is applied to a switch, the BMC being communicatively connected to the CPU. The device includes:
[0097] Collection device 601 is used to collect and cache the status information of the switch;
[0098] The transmission device 602 is used to transmit cached status information to the CPU when the CPU calls the interface provided by the BMC, so that the CPU stores the acquired status information in a local database and reads the status information from the database according to the status information call request. Optionally, the collection device 601 is specifically used to: start an information collection service and collect the status information of the switch periodically based on the information collection service;
[0099] The collected status information is written to a local custom cache.
[0100] Optionally, when the collection device 601 periodically collects the status information of the switch based on the information collection service, it is specifically used for:
[0101] Based on the information collection service, determine the collection interval corresponding to each type of collection device in at least one type of collection device;
[0102] Based on the acquisition intervals corresponding to each type of acquisition device, status information is periodically obtained from each acquisition device.
[0103] Different acquisition devices are used to obtain different status information of the switch.
[0104] Another device for acquiring switch status information provided in this application embodiment can be used to perform the above-described... Figure 3 The technical solutions of the embodiments shown are similar in principle and in effect, and will not be described again here.
[0105] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device in this embodiment may include:
[0106] At least one processor 701; and
[0107] Memory 702 communicatively connected to the at least one processor;
[0108] The memory 702 stores instructions that can be executed by the at least one processor 701 to cause the electronic device to perform the method as described in any of the above embodiments.
[0109] Alternatively, the memory 702 can be either standalone or integrated with the processor 701.
[0110] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0111] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in any of the foregoing embodiments.
[0112] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0113] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application.
[0114] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor. The memory may include high-speed RAM, and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk, or optical disc, etc.
[0115] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0116] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.
[0117] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0118] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0120] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for obtaining switch status information, characterized in that, Applied to a central processing unit (CPU), wherein the CPU is communicatively connected to the baseboard management controller (BMC) of a switch, the method includes: Every preset period, the interface provided by the BMC is called to obtain the status information of the switch cached by the BMC; the BMC is used to collect the status information of the switch periodically based on the information collection service and cache multiple status information of the switch; the interface provided by the BMC includes an interface for returning at least two types of status information from the multiple status information at one time, an interface for obtaining all status information, and an interface for obtaining a single type of status information. The acquired status information is stored in a local database; In response to a status information request, the stored status information is read from the database; When the BMC is used to periodically collect the status information of the switch, it is specifically used to determine the collection interval corresponding to each type of collection device in at least one type of collection device based on the information collection service, and to periodically obtain status information from each collection device based on the collection interval corresponding to each type of collection device.
2. The method according to claim 1, characterized in that, The step of calling the interface provided by the BMC to obtain the switch status information cached by the BMC includes: Based on the required status information, the corresponding interface is called to obtain the corresponding status information of the BMC cache; wherein, the required status information is at least a portion of the multiple status information.
3. The method according to any one of claims 1-2, characterized in that, Every preset period, the interface provided by the BMC is invoked to obtain the switch status information cached by the BMC, including: Enable information synchronization service. Based on the information synchronization service, call the interface provided by the BMC at preset intervals to obtain the status information of the switch cached by the BMC.
4. A method for obtaining switch status information, characterized in that, The BMC, applied to a switch and communicatively connected to the CPU, includes the following method: Based on the information collection service, the status information of the switch is collected periodically; The collected status information is written to a local custom cache; When the CPU calls the interface provided by the BMC every preset period, it transmits cached status information to the CPU so that the CPU stores the acquired status information in a local database and reads the status information from the database according to the status information call request. The information collection service periodically collects the status information of the switch, including: Based on the information collection service, determine the collection interval corresponding to each type of collection device in at least one type of collection device; Based on the acquisition intervals corresponding to each type of acquisition device, status information is periodically obtained from each acquisition device. The BMC is used to cache multiple status information of the switch; the interfaces provided by the BMC include an interface for returning at least two types of status information from the multiple status information at one time, an interface for obtaining all status information, and an interface for obtaining a single type of status information.
5. The method according to claim 4, characterized in that, Also includes: Initiate information collection services; Different acquisition devices are used to obtain different status information of the switch.
6. A device for acquiring switch status information, characterized in that, Applied to a CPU, wherein the CPU is communicatively connected to the BMC of a switch, the device includes: The acquisition module is used to call the interface provided by the BMC at preset intervals to acquire the status information of the switch cached by the BMC; the BMC is used to collect the status information of the switch periodically based on the information collection service and cache multiple status information of the switch; the interface provided by the BMC includes an interface for returning at least two types of status information from the multiple status information at one time, an interface for acquiring all status information, and an interface for acquiring a single type of status information. The storage module is used to store the acquired status information into a local database; The reading module is used to read stored status information from the database in response to a status information call request; When the BMC is used to periodically collect the status information of the switch, it is specifically used to determine the collection interval corresponding to each type of collection device in at least one type of collection device based on the information collection service, and to periodically obtain status information from each collection device based on the collection interval corresponding to each type of collection device.
7. A device for acquiring switch status information, characterized in that, A BMC (Browser Controller) is applied to a switch, the BMC being communicatively connected to a CPU, the device comprising: A collection device is used to periodically collect the status information of the switch based on an information collection service; and to write the collected status information into a local custom cache. The transmission device is used to transmit cached status information to the CPU when the CPU calls the interface provided by the BMC every preset period, so that the CPU stores the acquired status information in a local database and reads the status information from the database according to the status information call request. When the collection device periodically collects the status information of the switch based on the information collection service, it is specifically used to: determine the collection interval corresponding to each type of collection device in at least one type of collection device based on the information collection service; and periodically obtain status information from each collection device based on the collection interval corresponding to each type of collection device. The BMC is used to cache multiple status information of the switch; the interfaces provided by the BMC include an interface for returning at least two types of status information from the multiple status information at one time, an interface for obtaining all status information, and an interface for obtaining a single type of status information.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, cause the electronic device to perform the method according to any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Switch external device management method, system, device and storage medium
CN111881070A