A configuration distribution method, device, equipment and storage medium

By specifying the core switch in the virtual switching unit, analyze the client request, find the target virtual address and establish a session connection, realize the efficient configuration of multiple network devices in the large network topology environment, solve the complexity and complexity of existing technologies and The issue of safety risk.

CN118869466BActive Publication Date: 2025-01-24INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411312492.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-24
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

In large network topology environments, the prior art requires users to know the management port IP of network equipment in advance, resulting in increased configuration issuance complexity, increased security risks and reduced efficiency.

Method used

By specifying a core switch in the virtual switch unit, receiving the client's configuration request, analysis request to obtain the identification information and configuration information of the target switch, find the target virtual address, establish a virtual network interface session connection, and pass the LLDP protocol under the LLDP protocol Send configuration information.

Benefits of technology

There is no need for users to know the management port IP of the switch to be configured in advance, saving time and labor costs, improving the efficiency of configuration delivery, simplifying the process, reducing the risk of information leakage, and improving security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869466B_ABST
    Figure CN118869466B_ABST
Patent Text Reader

Abstract

The present application discloses a configuration sending method, device, equipment and storage medium, which relates to the field of network technology and is applied to a core switch, including: when receiving a configuration sending request sent by a client, parsing the configuration sending request to obtain identification information and configuration information of a target standby switch to be configured; determining the target standby switch to be configured based on the identification information, and finding a target virtual address corresponding to the MAC address of the target standby switch; establishing a session connection between a virtual network interface located in the core switch and the target standby switch through the target virtual address; creating a data packet containing configuration information according to a first TLV format, and forwarding the data packet to the target standby switch through the virtual network interface based on the LLDP protocol to complete the sending of configuration information. The present application can improve the efficiency of configuration sending, simplify the complexity of the configuration sending process, and reduce the risk of configuration information being leaked.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology, and in particular to a configuration delivery method, device, equipment and storage medium. Background Art

[0002] At present, in a network topology environment, when a network device (such as a virtual switch) needs to be configured, the user is usually required to configure and distribute the corresponding network device according to the management port IP (Internet Protocol) of the network device, that is, the user needs to know the management port IP of the corresponding network device in advance. When multiple network devices in a large network topology environment need to be configured, this method requires to know the management port IPs of all devices to be distributed in advance, and the controller (Controller) distributes the configuration through the Restful (Representational State Transfer) method. However, different controller manufacturers have their own Restful URLs (Uniform Resource Locator), so this method increases the complexity of configuration distribution; in addition, since the configuration needs to be distributed through multiple management port IPs, the security risk of configuration information leakage is increased; and when the configuration is distributed to multiple network devices, the user needs to deploy multiple management port IPs respectively through the command line interface (CLI), which increases the time cost of configuration distribution and reduces the efficiency of configuration distribution. Summary of the invention

[0003] In view of this, the purpose of this application is to provide a configuration delivery method, device, equipment and storage medium, which can save time and labor costs, improve the efficiency of configuration delivery, simplify the complexity of the configuration delivery process, reduce the risk of configuration information being leaked, and improve the security of configuration information. The specific scheme is as follows:

[0004] In a first aspect, the present application discloses a configuration delivery method, which is applied to a core switch in a virtual switch group, wherein the virtual switch group further includes a plurality of standby switches, and the configuration delivery method comprises:

[0005] When receiving the configuration delivery request sent by the client, the configuration delivery request is parsed to obtain the identification information and configuration information of the target standby switch to be delivered with the configuration;

[0006] Determine the target standby switch to be configured and delivered based on the identification information, and search the local database for a target virtual address corresponding to the MAC address of the target standby switch;

[0007] A session connection is established between the virtual network interface located in the core switch and the target standby switch through the target virtual address, and then a data packet containing the configuration information is created according to the first TLV format, and the data packet is forwarded to the target standby switch through the virtual network interface based on the LLDP protocol to complete the sending of the configuration information.

[0008] Optionally, the first TLV format includes the type of the core switch, the name of the virtual switch group, and the length of the name.

[0009] Optionally, the configuration delivery method further includes:

[0010] When receiving information based on the second TLV format sent by any standby switch in the virtual switch group, acquiring the MAC address of any standby switch to obtain the first address; the second TLV format includes the type of the standby switch, the name of the virtual switch group, and the length of the name;

[0011] Creating a virtual address corresponding to any standby switch based on the first address to obtain a second address;

[0012] The first address and the second address are mapped, and the mapped first address and the corresponding second address are saved in a local database.

[0013] Optionally, after saving the mapped first address and the corresponding second address in the local database, the method further includes:

[0014] After a preset time has passed, determining whether new information based on the second TLV format sent by any of the standby switches is received;

[0015] If no new information based on the second TLV format sent by any standby switch is received, the first address and the second address corresponding to any standby switch in the local database are deleted.

[0016] Optionally, the configuration delivery method further includes:

[0017] When receiving information based on a third TLV format sent by other switches outside the virtual switch group, acquiring a MAC address of the other switch to obtain a third address; the third TLV format includes a type of the other switch;

[0018] Creating a virtual address corresponding to the other switch based on the third address to obtain a fourth address;

[0019] The third address and the fourth address are mapped, and the mapped third address and the corresponding fourth address are saved in a local database.

[0020] Optionally, the configuration delivery method further includes:

[0021] Information based on the first TLV format is sent to the standby switch in the virtual switch group and other switches outside the virtual switch group according to a preset period, so that the standby switch in the virtual switch group and the other switches save the MAC address of the core switch and the corresponding management port IP of the virtual network interface in their own databases.

[0022] Optionally, after establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address, the method further includes:

[0023] The receiving system returns a first file descriptor for a conversation with the target standby switch, and obtains a second file descriptor for a conversation with the client;

[0024] The first file descriptor and the second file descriptor are bound, and the bound first file descriptor and the second file descriptor are saved in the local database.

[0025] Optionally, after the sending of the configuration information is completed, the method further includes:

[0026] When receiving a configuration completion response returned by the target standby switch after performing a configuration operation based on the configuration information, reading the configuration completion response based on the first file descriptor to obtain the configuration completion response;

[0027] The second file descriptor bound to the first file descriptor is searched from the local database, and the configuration completion response is forwarded to the client based on the second file descriptor.

[0028] Optionally, the reading the configuration completion response based on the first file descriptor to obtain the configuration completion response includes:

[0029] Detecting whether there is a file descriptor corresponding to the current target standby switch in the local database;

[0030] If the local database contains a file descriptor corresponding to the current target standby switch, the file descriptor corresponding to the current target standby switch is obtained from the local database to obtain the first file descriptor, and the configuration completion response is read based on the first file descriptor to obtain the configuration completion response;

[0031] If the local database does not contain a file descriptor corresponding to the current target standby switch, the configuration completion response is discarded.

[0032] Optionally, forwarding the data packet to the target standby switch through the virtual network interface based on the LLDP protocol includes:

[0033] Writing the data packet into a local first character device through the virtual network interface, so as to transmit the data packet to a local first application program according to characters;

[0034] The received data packet is forwarded to the second application in the target standby switch through the first application and the preset tunnel based on the LLDP protocol.

[0035] Optionally, after the sending of the configuration information is completed, the method further includes:

[0036] The data packet is sent to a second character device located in the target standby switch through the first application program, so as to forward the data packet to a virtual network interface located in the target standby switch according to the character, and the data packet is sent to a second application program in the target standby switch through the virtual network interface in the target standby switch, so as to parse the data packet, obtain the configuration information, and perform corresponding configuration operations on the target standby switch based on the configuration information.

[0037] Optionally, establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address includes:

[0038] Obtaining a file descriptor of a current session between the client and the core switch to obtain a third file descriptor;

[0039] Detecting whether there is a file descriptor bound to the third file descriptor in the local database;

[0040] If there is no file descriptor bound to the third file descriptor in the local database, establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address;

[0041] If there is a file descriptor bound to the third file descriptor in the local database, the step of creating a data packet containing the configuration information in the first TLV format is triggered.

[0042] In a second aspect, the present application discloses a computer program product, including a computer program / instruction, which implements the aforementioned configuration delivery method when executed by a processor.

[0043] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the processor implements the aforementioned configuration delivery method when executing a computer program stored in the memory.

[0044] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned configuration delivery method is implemented.

[0045] It can be seen that the present application is applied to the core switch in the virtual switch group, and the virtual switch group also includes multiple standby switches. When a configuration sending request sent by a client is received, the configuration sending request is first parsed to obtain the identification information and configuration information of the target standby switch to be configured, and then the target standby switch to be configured is determined based on the identification information, and the target virtual address corresponding to the MAC address of the target standby switch is searched from the local database, and then a session connection is established between the virtual network interface located in the core switch and the target standby switch through the target virtual address, and then a data packet containing the configuration information is created according to the first TLV format, and the data packet is forwarded to the target standby switch through the virtual network interface based on the LLDP protocol to complete the sending of the configuration information. The present application pre-specifies a core switch in the virtual switch group, through which a configuration request for any standby switch in the virtual switch group sent by a client can be received, and the received configuration request is parsed to obtain the identification information and configuration information of the target standby switch to be configured, and then the target standby switch to be configured is determined based on the identification information, and then the target virtual address corresponding to the MAC address (i.e., physical address) of the target standby switch is searched from the local database, and a session connection between the virtual network interface in the core switch and the target standby switch is established through the target virtual address, and after the session connection is established, a data packet containing the configuration information is created in a preset TLV format, and the data packet is sent through the virtual network interface. The interface sends the data packet to the target standby switch based on the LLDP protocol. It can be seen that when the present application sends the configuration, the user does not need to know the management port IP of the switch to be configured in advance. The user only needs to input the identification information of the corresponding device and send the configuration to different standby switches through a core switch. Therefore, the time cost and manpower cost of manual configuration sending are saved, thereby improving the efficiency of configuration sending. In addition, compared with the traditional method of sending the configuration according to the management port IP of all switches and through the Restful interface, the present application simplifies the complexity of the configuration sending process. At the same time, all standby switches can be configured through only one core switch, thereby reducing the risk of configuration information leakage and improving the security of configuration information. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0047] Figure 1 A flow chart of a configuration delivery method disclosed in this application;

[0048] Figure 2 A schematic diagram of a specific virtual switch group structure disclosed in this application;

[0049] Figure 3 A schematic diagram of a specific TLV format disclosed in this application;

[0050] Figure 4 A schematic diagram of a specific virtual switch group structure disclosed in this application;

[0051] Figure 5 A flow chart of a specific configuration delivery method disclosed in this application;

[0052] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] The present application embodiment discloses a configuration delivery method, which is applied to a core switch in a virtual switch group, wherein the virtual switch group also includes multiple standby switches. Figure 1 As shown, the method includes:

[0055] Step S11: when receiving a configuration delivery request sent by the client, the configuration delivery request is parsed to obtain identification information and configuration information of the target standby switch to which the configuration is to be delivered.

[0056] It should be pointed out that the configuration delivery scheme proposed in this application can be specifically applied to the core switch (i.e., Spine switch) in the virtual switch group (VSG, Virtual Switch Group) of a large network topology, and the virtual switch group also includes multiple standby switches (i.e., Member switches). Among them, the core switch has the characteristics of high bandwidth and low latency, and provides horizontal high-speed data transmission and forwarding functions. It can be directly connected to a single or multiple standby switches when the configuration is delivered, and the core switch can establish a remote communication connection with the client in advance through Telnet (Teletype Network, a simple text-based network protocol) or SSH (Secure Shell) protocol.

[0057] In this embodiment, when the core switch in the virtual switch group receives a configuration delivery request sent by a client, the configuration delivery request is first parsed to obtain the identification information of the target standby switch to be configured and the specific configuration information for the target standby switch, such as data flow information in the data flow forwarding scenario. The identification information includes but is not limited to the device code, SN number (Serial Number, device serial number) and other information of the target standby switch, as long as it can uniquely represent the standby switch.

[0058] Step S12: determining the target standby switch to be configured and delivered based on the identification information, and searching the local database for a target virtual address corresponding to the MAC address of the target standby switch.

[0059] In this embodiment, after the configuration delivery request is parsed to obtain the identification information and configuration information of the target standby switch to be delivered, the target standby switch to be delivered is further determined based on the identification information, and then the target virtual address corresponding to the MAC address (i.e., Media Access Control Address, also called physical address) of the target standby switch is searched from the local database (DB, Data base).

[0060] In this embodiment, the Keepalive mechanism is used to maintain the communication connection between the core switch and other switches, so as to avoid the connection being cut off due to long-term lack of data transmission. Specifically, when receiving information based on the second TLV format sent by any standby switch in the virtual switch group, the MAC address of any standby switch is obtained to obtain the first address; the second TLV format includes the type of the standby switch, the name of the virtual switch group and the length of the name; based on the first address, a virtual address corresponding to any standby switch is created to obtain the second address; the first address and the second address are mapped, and the mapped first address and the corresponding second address are saved in the local database. In this embodiment, the physical address and the corresponding virtual address of the standby switch in the virtual switch group are stored in the local database in advance, so that when the configuration is sent, the physical address and the virtual address corresponding to the corresponding standby switch can be directly found from the local database, so as to establish a session connection with the corresponding standby switch through the virtual address, and after the session connection is established, the corresponding configuration information is sent to the standby switch to establish the connection. This method not only realizes the automatic configuration sending, but also improves the efficiency and accuracy of the configuration sending. Specifically, when receiving information based on the second TLV (Type / Length / Value) format sent by any standby switch in the virtual switch group, first obtain the MAC address of any standby switch to obtain the corresponding first address, then create a virtual address corresponding to any standby switch based on the above first address (i.e., physical address) to obtain the corresponding second address, then create a mapping relationship between the above first address and the above second address, and save the two mapped addresses to the local database. It should be noted that the second TLV format specifically includes the type of the standby switch (i.e., the type of Member switch, such as MS), the name of the virtual switch group (e.g., Group1), and the length of the name (i.e., Group1) (e.g., string length). In a specific implementation manner, the virtual address of the Member switch (i.e., the standby switch) may be composed of the last three digits of the MAC address. For example, when the physical address MAC1 of the Member switch 1 (i.e., the standby switch 1) is aa:aa:bb:bb:cc:cc, the corresponding virtual address Virtual IP1 is 10.187.204.204; for another example, when the physical address MAC2 of the Member switch 2 (i.e., the standby switch 2) is bb:cc:dd:dd:ee:ee, the corresponding virtual address Virtual IP2 is 10.221.238.238.

[0061] For details, see Figure 2As shown, the virtual switch group includes two standby switches, namely standby switch 1 and standby switch 2. The two standby switches send information in the second TLV format to the core switch in the virtual switch group according to a preset period, wherein the second TLV format includes MS (0x02), 0x00, 0x06 and Group1, MS (0x02) indicates the type of the standby switch (i.e., the role of the switch, Virtual Switch Role), 0x00 indicates the reserved field (Reserved), 0x06 indicates the name length of the virtual switch group (Virtual Switch Group Name Length), and Group1 indicates the name of the virtual switch group (Virtual Switch Group Name). When the core switch receives the information sent by each standby switch, it saves the MAC address and the corresponding virtual address of the corresponding standby switch into the local database.

[0062] Also, see Figure 3 As shown, in addition to the above content, the second TLV format may also include TLV header information (ie, TLV header), such as TLV type=127, TLV string information length, etc., and Figure 3 The byte size occupied by each part is also marked, such as TLV type=127 occupies 7 bits.

[0063] Furthermore, after saving the mapped first address and the corresponding second address in the local database, the method may also include: after a preset time, determining whether new information based on the second TLV format sent by any standby switch is received; if new information based on the second TLV format sent by any standby switch is not received, deleting the first address and the second address corresponding to any standby switch in the local database. It should be noted that when any standby switch in the virtual switch group sends information based on the second TLV format to the core switch, it can be sent regularly according to a preset sending cycle, and after a preset time (i.e., a preset cycle), the core switch will determine whether new information based on the second TLV format sent by any standby switch is received. If the new information based on the second TLV format sent by any standby switch is not received, it indicates that any standby switch may be abnormal or removed from the virtual switch group. At this time, all information related to any standby switch recorded in the local database can be deleted, that is, the first address and the second address corresponding to any standby switch are deleted from the local database. In this way, the information in the database can be updated in time, which not only saves the storage space of the local database, but also avoids the subsequent search and matching of useless address information when searching for address information, thereby improving the efficiency of address information search, and then improving the efficiency of overall configuration delivery.

[0064] It should be pointed out that not only any standby switch in the virtual switch group can send TLV format information to the core switch according to a preset time period, but also other switches outside the virtual switch group can send TLV format information to the core switch in the virtual switch group according to a preset sending period. Specifically, when receiving information based on the third TLV format sent by other switches outside the virtual switch group, the MAC address of the other switch is obtained to obtain a third address; the third TLV format includes the type of the other switch; based on the third address, a virtual address corresponding to the other switch is created to obtain a fourth address; the third address is mapped to the fourth address, and the mapped third address and the corresponding fourth address are saved in the local database. For details, see Figure 2As shown, other switches outside the virtual switch group can be used as candidate switches (candidate switch) to send information in the third TLV format to the core switch according to a preset time period, wherein the third TLV format includes CaS (0x03), 0x00, 0x00 and None, CaS (0x03) indicates the type of other switches (i.e., candidate switch), the first 0x00 indicates a reserved field (Reserved), the first 0x00 indicates that the name length of the virtual switch group is 0, and None indicates that it is not grouped. Among them, the way in which other switches join the virtual switch group can be implemented manually, for example, by manually configuring the name of the virtual switch group (Group1) to add other switches to the virtual switch group. Furthermore, when the core switch receives the information sent by the candidate switch, the MAC address and the corresponding virtual address of the corresponding candidate switch are saved in the local database.

[0065] In addition, after receiving the information in TLV format sent by the switches inside and outside the virtual switch group, the core switch can also exchange information with the corresponding adjacent switches according to a preset time period, so that the adjacent switches can record the address information of the core switch in the local database. Specifically, according to the preset period, the core switch sends information based on the first TLV format to the standby switch in the virtual switch group and other switches outside the virtual switch group, so that the standby switch in the virtual switch group and the other switches can save the MAC address of the core switch and the corresponding management port IP of the virtual network interface in their own databases. For example, see Figure 4 As shown, the core switch in the virtual switch group sends information in the first TLV format to the standby switch in the virtual switch group and the candidate switch outside the virtual switch group according to a preset period, wherein the first TLV format specifically includes the type of the core switch (SS (0x01)), the name of the virtual switch group (Group1) and the length of the name (0x06) and the reserved field (0x00); further, when the standby switch and the candidate switch receive the information sent by the core switch, the MAC address of the core switch and the corresponding management port IP of the virtual network interface (such as 10.0.0.1) are saved in their own databases; wherein the virtual network interface represents the interface of the virtual network device, such as Linux's TAP (a virtual network device in the operating system kernel) interface or TUN (Network TUNnel, a virtual network device in the operating system kernel) interface.

[0066] Step S13: Establish a session connection between the virtual network interface located in the core switch and the target standby switch through the target virtual address, then create a data packet containing the configuration information according to the first TLV format, and forward the data packet to the target standby switch through the virtual network interface based on the LLDP protocol to complete the distribution of the configuration information.

[0067] In this embodiment, after finding the target virtual address corresponding to the MAC address of the target standby switch from the local database, the management port IP of its own virtual network interface is obtained, and the virtual network interface is determined based on the management port IP, and then a session connection between its own virtual network interface and the target standby switch is established through the target virtual address, and then a data packet containing the configuration information is created according to the first TLV format, and then the data packet is sent to the target standby switch corresponding to the current configuration sending request through its own virtual network interface and based on the LLDP protocol (Link Layer Discovery Protocol), thereby completing the sending of configuration information. Further, when the target standby switch receives the data packet, it can decompress it to obtain specific configuration information, and then perform corresponding configuration operations based on the configuration information.

[0068] In this embodiment, after the session connection between the virtual network interface located in the core switch and the target standby switch is established through the target virtual address, it specifically includes: receiving the first file descriptor for the session with the target standby switch returned by the system, and obtaining the second file descriptor for the session with the client; binding the first file descriptor and the second file descriptor, and saving the bound first file descriptor and the second file descriptor to the local database. In this embodiment, after the session connection between the virtual network interface and the target standby switch is created, two-way communication between the client and the standby switch can be achieved through Socket. For example, the first file descriptor (Fd, File Descriptor) for the session with the target standby switch returned by the system, such as memberFd, indicates that the TCP session between the core switch and the member switch is established through a virtual address (i.e., virtual IP), and then obtaining the second file descriptor for the session with the client, such as clientFd, indicates that the client and the core switch are having a session through telnet TCP, and then binding the two file descriptors, and saving the bound two file descriptors to the local database. For example, the bound file descriptor clientFd ↔ Spine ↔ memberFd is saved in the local database of the Spine switch. By reading the instruction from clientFd, the instruction can be forwarded to memberFd. Then, memberFd will transmit the response back to the Spine switch and forward it to clientFd.

[0069] Specifically, forwarding the data packet to the target standby switch based on the LLDP protocol through the virtual network interface may include: writing the data packet to a local first character device through the virtual network interface to transmit the data packet to a local first application according to characters; forwarding the received data packet to a second application in the target standby switch through the first application and a preset tunnel and based on the LLDP protocol. In this embodiment, the data packet can be written to a local character device (i.e., fd: / dev / net / tun) of the core switch through the virtual network interface (i.e., TUN interface 10.0.0.1) in the core switch, so that the data packet is transmitted to the local application (Application) in units of characters, and then, through the application (Application) in the core switch and a preset tunnel (such as a TCP tunnel or a UDP (User Datagram Protocol) tunnel), and based on the LLDP protocol, the received data packet is forwarded to the application (Application) in the target standby switch, so that the data packet is processed accordingly, such as decompression, to obtain specific configuration information. It should be pointed out that the core switch and the backup switch have the same structure and are connected via Ethernet. When sending and receiving, corresponding compression and decompression operations will be performed.

[0070] It should be pointed out that when the virtual network interface is a TUN interface, the format of the data packet is an IP data packet. When the virtual network interface is a TUN interface, the format of the data packet is an Ethernet data packet, such as an ARP (Address Resolution Protocol) data packet or an ICMP (Internet Control Message Protocol) data packet.

[0071] Further, after the configuration information is sent, the method may further include: sending the data packet to the second character device located in the target standby switch through the first application program, so as to forward the data packet to the virtual network interface located in the target standby switch according to the character, and sending the data packet to the second application program in the target standby switch through the virtual network interface in the target standby switch, so as to parse the data packet to obtain the configuration information, and perform corresponding configuration operations on the target standby switch based on the configuration information. In this embodiment, after the configuration information is sent, the data packet may be sent to the character device (such as fd: / dev / net / tun) of the target standby switch through the application program in the core switch, so that the character device forwards the data packet to the virtual network interface (such as TUN interface 10.0.0.2) located in the target standby switch according to the character, and sending the data packet to the application program (Application) in the target standby switch through the virtual network interface (10.0.0.2), so as to parse the data packet to obtain specific configuration information, and then perform corresponding configuration operations on the target standby switch based on the configuration information.

[0072] In a specific implementation, after the sending of the configuration information is completed, it may also include: when receiving a configuration completion response returned by the target standby switch after performing a configuration operation based on the configuration information, reading the configuration completion response based on the first file descriptor to obtain the configuration completion response; searching the local database for the second file descriptor bound to the first file descriptor, and forwarding the configuration completion response to the client based on the second file descriptor. In this embodiment, after the core switch completes the sending of the configuration information, when receiving a configuration completion response returned by the target standby switch after performing a configuration operation based on the configuration information, it may read the configuration completion response from the first file descriptor (i.e., memberFd), then search the local database for the second file descriptor (i.e., clientFd) bound to the above-mentioned first file descriptor (i.e., memberFd), and then forward the configuration completion response to the client based on the bound second file descriptor (i.e., clientFd), so that the client knows that the current configuration sending process has been completed.

[0073] Specifically, the reading of the configuration completion response based on the first file descriptor to obtain the configuration completion response may include: detecting whether there is a file descriptor corresponding to the current target standby switch in the local database; if there is a file descriptor corresponding to the current target standby switch in the local database, obtaining the file descriptor corresponding to the current target standby switch from the local database to obtain the first file descriptor, and reading the configuration completion response based on the first file descriptor to obtain the configuration completion response; if there is no file descriptor corresponding to the current target standby switch in the local database, discarding the configuration completion response. In this embodiment, firstly detect whether there is a file descriptor corresponding to the current target standby switch in the local database. If there is, it indicates that a session connection has been established between the client, the core switch and the target standby switch. At this time, the file descriptor corresponding to the current target standby switch (i.e., memberFd) can be directly obtained from the local database, and then the configuration completion response can be read from memberFd; if there is no file descriptor corresponding to the current target standby switch, it indicates that the session connection has not been established, and the received configuration completion response can be discarded.

[0074] It can be seen that the embodiment of the present application is applied to the core switch in the virtual switch group, and the virtual switch group also includes multiple standby switches. When a configuration sending request sent by a client is received, the configuration sending request is first parsed to obtain the identification information and configuration information of the target standby switch to be configured, and then the target standby switch to be configured is determined based on the identification information, and the target virtual address corresponding to the MAC address of the target standby switch is searched from the local database, and then a session connection is established between the virtual network interface located in the core switch and the target standby switch through the target virtual address, and then a data packet containing the configuration information is created according to the first TLV format, and the data packet is forwarded to the target standby switch through the virtual network interface based on the LLDP protocol to complete the sending of the configuration information. In the embodiment of the present application, a core switch is pre-specified in the virtual switch group, through which a configuration sending request for any standby switch in the virtual switch group sent by the client can be received, and the received configuration sending request is parsed to obtain the identification information and configuration information of the target standby switch to be configured, and then the target standby switch to be configured is determined based on the identification information, and then the target virtual address corresponding to the MAC address (i.e., physical address) of the target standby switch is searched from the local database, and a session connection between the virtual network interface in the core switch and the target standby switch is established through the target virtual address, and after the session connection is established, a data packet containing the configuration information is created in a preset TLV format, and the virtual network interface is sent to the virtual network interface. Based on the LLDP protocol, the data packet is sent to the target standby switch. It can be seen that in the embodiment of the present application, when sending configuration, the user does not need to know the management port IP of the switch to be configured in advance. It only needs to input the identification information of the corresponding device and implement the configuration sending for different standby switches through a core switch. Therefore, the time cost and manpower cost of manual configuration sending are saved, thereby improving the efficiency of configuration sending. In addition, compared with the traditional method of sending configuration according to the management port IP of all switches and through the Restful interface, the embodiment of the present application simplifies the complexity of the configuration sending process. At the same time, all standby switches can be configured through only one core switch, thereby reducing the risk of configuration information leakage and improving the security of configuration information.

[0075] The present application embodiment discloses a specific configuration delivery method, which is applied to a core switch in a virtual switch group, wherein the virtual switch group also includes multiple standby switches. Figure 5 As shown, the method includes:

[0076] Step S21: when receiving a configuration delivery request sent by the client, the configuration delivery request is parsed to obtain identification information and configuration information of the target standby switch to which the configuration is to be delivered.

[0077] Step S22: Determine the target standby switch to be configured and delivered based on the identification information, and search the local database for a target virtual address corresponding to the MAC address of the target standby switch.

[0078] Step S23: Acquire the file descriptor of the current session between the client and the core switch to obtain a third file descriptor.

[0079] In this embodiment, after searching the local database for the target virtual address corresponding to the MAC address of the target standby switch, the file descriptor of the current session between the client and the core switch is obtained to obtain a third file descriptor (such as clientFd).

[0080] Step S24: Detect whether there is a file descriptor bound to the third file descriptor in the local database.

[0081] Next, it is detected whether there is a file descriptor bound to the third file descriptor (such as clientFd) in the local database.

[0082] Step S25: If there is no file descriptor bound to the third file descriptor in the local database, a session connection is established between the virtual network interface in the core switch and the target standby switch through the target virtual address.

[0083] In this embodiment, if there is no file descriptor bound to the third file descriptor (such as clientFd) in the local database, it indicates that a session connection has not been established between the current client, the core switch and the target standby switch. At this time, a session connection between the virtual network interface and the target standby switch can be established through the target virtual address corresponding to the target standby switch.

[0084] Step S26: If there is a file descriptor bound to the third file descriptor in the local database, a data packet containing the configuration information is created according to the first TLV format, and the data packet is forwarded to the target standby switch through the virtual network interface based on the LLDP protocol to complete the distribution of the configuration information.

[0085] In this embodiment, if there is a file descriptor bound to the third file descriptor (such as clientFd) in the local database, it indicates that a session connection has been established between the current client, the core switch and the target standby switch. At this time, a data packet containing the configuration information can be created in the first TLV format, and the data packet can be sent to the target standby switch through the virtual network interface based on the LLDP protocol.

[0086] For more specific processing procedures of the above steps S21 and S22, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0087] It can be seen that the embodiment of the present application is applied to the core switch in the virtual switch group. When receiving the configuration sending request sent by the client, the configuration sending request is parsed to obtain the identification information and configuration information of the target standby switch to be configured, and then the target standby switch to be configured is determined based on the identification information, and the target virtual address corresponding to the MAC address of the target standby switch is searched from the local database, and then the file descriptor of the current session between the client and the core switch is obtained to obtain the third file descriptor, and it is detected whether there is a file descriptor bound to the third file descriptor in the local database. If not, a session connection between the virtual network interface located in the core switch and the target standby switch is established through the target virtual address. If it exists, a data packet containing the configuration information is created in the first TLV format, and the data packet is forwarded to the target standby switch through the virtual network interface based on the LLDP protocol to complete the sending of the configuration information. It can be seen that when the embodiment of the present application issues the configuration through the core switch in the virtual switch group, it first detects whether there is a file descriptor for the client to have a conversation with the core switch in the local database. If it exists, the configuration is directly issued. If it does not exist, a session connection is established first and then the configuration is issued. By detecting the file descriptor, it is possible to avoid repeated establishment of session connections. Furthermore, when the embodiment of the present application issues the configuration, the user does not need to know the management port IP of the switch to be configured in advance. It only needs to enter the identification information and specific configuration information of the corresponding device, thereby saving the time and labor costs of manual configuration issuance and improving the efficiency of configuration issuance. In addition, configuration issuance through a core switch can go through a relatively hidden network segment, thereby reducing the risk of configuration information being leaked and improving the security of configuration information.

[0088] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0089] Figure 6 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the configuration delivery method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0090] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0091] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0092] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the configuration delivery method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0093] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the configuration delivery method disclosed above. The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, and will not be repeated here.

[0094] Furthermore, an embodiment of the present application also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the configuration delivery method disclosed above.

[0095] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0096] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0097] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0098] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0099] The above is a detailed introduction to a configuration delivery method, device, equipment and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A configuration delivery method, characterized in that: Applied to a core switch in a virtual switch group, the virtual switch group further comprising a plurality of standby switches, the configuration delivery method comprising: When receiving the configuration delivery request sent by the client, the configuration delivery request is parsed to obtain the identification information and configuration information of the target standby switch to be delivered with the configuration; Determine the target standby switch to be configured and delivered based on the identification information, and search the local database for a target virtual address corresponding to the MAC address of the target standby switch; Establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address, then creating a data packet containing the configuration information according to the first TLV format, and forwarding the data packet to the target standby switch through the virtual network interface based on the LLDP protocol to complete the sending of the configuration information; The step of establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address includes: obtaining a file descriptor for a current session between the client and the core switch to obtain a third file descriptor; detecting whether there is a file descriptor bound to the third file descriptor in a local database; if there is no file descriptor bound to the third file descriptor in the local database, establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address; and if there is a file descriptor bound to the third file descriptor in the local database, triggering the step of creating a data packet containing the configuration information in a first TLV format.

2. The configuration delivery method according to claim 1, characterized in that: The first TLV format includes the type of the core switch, the name of the virtual switch group, and the length of the name.

3. The configuration delivery method according to claim 1, characterized in that: Also includes: When receiving information based on the second TLV format sent by any standby switch in the virtual switch group, acquiring the MAC address of any standby switch to obtain the first address; the second TLV format includes the type of the standby switch, the name of the virtual switch group, and the length of the name; Creating a virtual address corresponding to any standby switch based on the first address to obtain a second address; The first address and the second address are mapped, and the mapped first address and the corresponding second address are saved in a local database.

4. The configuration delivery method according to claim 3, characterized in that: After the mapped first address and the corresponding second address are saved in the local database, the method further includes: After a preset time has passed, determining whether new information based on the second TLV format sent by any of the standby switches is received; If no new information based on the second TLV format sent by any standby switch is received, the first address and the second address corresponding to any standby switch in the local database are deleted.

5. The configuration delivery method according to claim 4, characterized in that: Also includes: When receiving information based on a third TLV format sent by other switches outside the virtual switch group, acquiring a MAC address of the other switch to obtain a third address; the third TLV format includes a type of the other switch; Creating a virtual address corresponding to the other switch based on the third address to obtain a fourth address; The third address and the fourth address are mapped, and the mapped third address and the corresponding fourth address are saved in a local database.

6. The configuration delivery method according to claim 5, characterized in that: Also includes: Information based on the first TLV format is sent to the standby switch in the virtual switch group and other switches outside the virtual switch group according to a preset period, so that the standby switch in the virtual switch group and the other switches save the MAC address of the core switch and the corresponding management port IP of the virtual network interface in their own databases.

7. The configuration delivery method according to claim 1, characterized in that: After establishing a session connection between the virtual network interface in the core switch and the target standby switch through the target virtual address, the method further includes: The receiving system returns a first file descriptor for a conversation with the target standby switch, and obtains a second file descriptor for a conversation with the client; The first file descriptor and the second file descriptor are bound, and the bound first file descriptor and the second file descriptor are saved in the local database.

8. The configuration delivery method according to claim 7, characterized in that: After the configuration information is sent, the method further includes: When receiving a configuration completion response returned by the target standby switch after performing a configuration operation based on the configuration information, reading the configuration completion response based on the first file descriptor to obtain the configuration completion response; The second file descriptor bound to the first file descriptor is searched from the local database, and the configuration completion response is forwarded to the client based on the second file descriptor.

9. The configuration delivery method according to claim 8, characterized in that: The step of reading the configuration completion response based on the first file descriptor to obtain the configuration completion response includes: Detecting whether there is a file descriptor corresponding to the current target standby switch in the local database; If the local database contains a file descriptor corresponding to the current target standby switch, the file descriptor corresponding to the current target standby switch is obtained from the local database to obtain the first file descriptor, and the configuration completion response is read based on the first file descriptor to obtain the configuration completion response; If the local database does not contain a file descriptor corresponding to the current target standby switch, the configuration completion response is discarded.

10. The configuration delivery method according to claim 1, characterized in that: The step of forwarding the data packet to the target standby switch based on the LLDP protocol through the virtual network interface includes: Writing the data packet into a local first character device through the virtual network interface, so as to transmit the data packet to a local first application program according to characters; The received data packet is forwarded to the second application in the target standby switch through the first application and the preset tunnel based on the LLDP protocol.

11. The configuration delivery method according to claim 10, characterized in that: After the configuration information is sent, the method further includes: The data packet is sent to a second character device located in the target standby switch through the first application program, so as to forward the data packet to a virtual network interface located in the target standby switch according to the character, and the data packet is sent to a second application program in the target standby switch through the virtual network interface in the target standby switch, so as to parse the data packet, obtain the configuration information, and perform corresponding configuration operations on the target standby switch based on the configuration information.

12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the configuration delivery method according to any one of claims 1 to 11 is implemented.

13. An electronic device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the configuration sending method as described in any one of claims 1 to 11 is implemented.

14. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the configuration delivery method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Switches and switch systems

    CN102281195A

  • Equipment deployment configuration method and device, electronic equipment and storage medium

    CN113507388A