A switch tunnel creation method, device, equipment, medium and product
By obtaining the switch's tunnel creation request and verifying the tunnel configuration file, creating VXLAN tunnels according to the tunnel mode, and configuring the destination address in different scenarios, the resource waste problem caused by the lack of flexible mode selection in the existing technology is solved, and the performance of the nos system is improved.
Patent Information
- Application Number
- CN202411536431.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The existing technology lacks flexible mode selection when creating VXLAN tunnels, resulting in waste of resources and affects the performance of the nos system.
By obtaining the switch's tunnel creation request, obtain the tunnel configuration file and verify its rationality for the tunnel configuration parameters. If the conditions are met, create a tunnel according to the tunnel mode and configure the destination address in different scenarios to ensure the correctness of data transmission.
It realizes flexible mode selection when creating VXLAN tunnels, avoids resource waste and improves the performance of the nos system.
Smart Images

Figure CN119052088B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment, medium and product for creating a switch tunnel. Background Art
[0002] In the current network environment, the creation of virtual extensible LAN (VXLAN) tunnels on switches of the network operating system (NOS) system is usually done in a relatively simple way, without clearly distinguishing the tunnel creation modes. When creating VXLAN tunnels, they are generally configured in the traditional way, without fully considering the optimal use of resources and the specific needs in different scenarios.
[0003] The existing technology lacks flexible mode selection when creating a VXLAN tunnel, which easily causes waste of VXLAN tunnel resources and thus affects the performance of the nos system. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method, device, equipment, medium and product for creating a switch tunnel to solve the problem that the prior art lacks flexible mode selection when creating a VXLAN tunnel, which easily causes waste of VXLAN tunnel resources and thus affects the performance of the NOS system.
[0005] In a first aspect, an embodiment of the present invention provides a method for creating a switch tunnel, the method comprising:
[0006] Obtaining a tunnel creation request for the switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel;
[0007] Obtain a tunnel configuration file, and verify the tunnel configuration file against the tunnel configuration parameters to determine whether a tunnel creation condition is currently met;
[0008] If the tunnel creation condition is met, the tunnel mode is obtained based on the tunnel configuration parameters, and the tunnel is created according to the creation strategy corresponding to the tunnel mode;
[0009] If the tunnel is successfully created, the destination addresses in different scenarios are obtained, and the created tunnel is configured using the destination addresses to ensure that data in different scenarios is correctly transmitted in the tunnel.
[0010] Further, the checking the tunnel configuration file to determine whether the tunnel configuration parameters currently meet the tunnel creation condition includes:
[0011] Obtaining a source address and a tunnel mode from the tunnel configuration parameters;
[0012] Using the source address, querying from the tunnel configuration file whether there is a matching creation record, to obtain a first query result;
[0013] Determine whether a tunnel creation condition is currently met based on the first query result.
[0014] Further, the determining whether the tunnel creation condition is currently met based on the query result includes:
[0015] If the first query result is that there is a matching creation record, and the tunnel mode in the creation record matched by the source address is consistent with the tunnel mode in the tunnel configuration parameter, it is determined that the tunnel creation condition is currently met;
[0016] If the first query result is that there is no matching creation record, it is determined that the tunnel creation condition is not currently met.
[0017] Further, the step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes:
[0018] If the tunnel mode is a shared mode, the source address is used to query whether there is a matching target key name from a pre-created dictionary structure to obtain a second query result, wherein the dictionary structure includes multiple key-value pairs, the key name in each key-value pair is a preset source address, and the key value is a tunnel start configuration parameter;
[0019] A corresponding tunnel creation operation is performed according to the second query result to obtain the tunnel.
[0020] Further, the step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes:
[0021] If the second query result is that there is a target key name matching the source address, obtaining the corresponding target tunnel start configuration parameter from the key-value pair where the target key name is located;
[0022] The tunnel is obtained by performing a tunnel creation operation using the target tunnel start configuration parameters.
[0023] Further, the step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes:
[0024] If the second query result is that there is no target key name matching the source address, calling a first application programming interface function of the software abstract interface to create a tunnel mapping table;
[0025] Creating a point-to-multipoint type tunnel initiator using the tunnel mapping table and the source address;
[0026] Creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end;
[0027] The tunnel initiator and the tunnel terminator are used to construct the tunnel.
[0028] Further, the step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes:
[0029] If the tunnel mode is exclusive mode, obtain the currently created tunnel mapping table;
[0030] Creating a point-to-multipoint type tunnel initiator using the tunnel mapping table and the source address;
[0031] Recording a first correspondence between the tunnel initiator and the tunnel mapping table, and initializing a reference count corresponding to the first correspondence to 0;
[0032] Creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end;
[0033] Recording a second correspondence between the tunnel termination end and the tunnel mapping table, and initializing a reference count corresponding to the second correspondence to 0;
[0034] Verifying the first corresponding relationship and the second corresponding relationship;
[0035] If the first correspondence relationship and the second correspondence relationship are verified to be successful, the first correspondence relationship and the second correspondence relationship are stored, and the tunnel initiator and the tunnel terminator are used to construct the tunnel.
[0036] Further, the step of creating a point-to-multipoint type tunnel initiator by using the tunnel mapping table and the source address includes:
[0037] Obtaining target configuration information associated with the tunnel contained in the tunnel mapping table;
[0038] Passing the source address and the target configuration information as parameters into a first application programming interface function of a software abstract interface;
[0039] The first application programming interface function is called to determine a starting position according to the source address, and the target configuration information is used to configure a plurality of communication addresses pointed to by the starting position to obtain the tunnel initiator.
[0040] Further, the step of creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end includes:
[0041] Passing the initiator information of the tunnel initiator as a parameter into the second application programming interface function of the software abstract interface;
[0042] The second application programming interface function is called to create a point-to-multipoint type tunnel termination end according to the initiator information.
[0043] Further, the obtaining of destination addresses in different scenarios and configuring the created tunnel using the destination addresses includes:
[0044] Obtain remote tunnel routes created in different scenarios, and obtain destination addresses specified by the remote tunnel routes;
[0045] The first application programming interface function is called to configure the tunnel according to the destination address to obtain a configured tunnel, so that data is transmitted between the source address and the destination address through the configured tunnel.
[0046] Furthermore, the method further comprises:
[0047] Obtain a tunnel deletion request, wherein the tunnel deletion request carries the tunnel to be deleted;
[0048] Determine the tunnel mode of the tunnel to be deleted, and perform a corresponding tunnel deletion operation based on a deletion policy corresponding to the tunnel mode.
[0049] In a second aspect, an embodiment of the present invention provides a device for creating a switch tunnel, the device comprising:
[0050] An acquisition module, configured to acquire a tunnel creation request for a switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel;
[0051] A verification module, used to obtain a tunnel configuration file, and verify whether the tunnel configuration file meets the tunnel configuration parameters to determine whether the tunnel creation condition is currently met;
[0052] A creation module, configured to obtain a tunnel mode based on the tunnel configuration parameters if the tunnel creation condition is met, and create a tunnel according to a creation strategy corresponding to the tunnel mode;
[0053] The processing module is used to obtain the destination address in different scenarios if the tunnel is successfully created, and configure the created tunnel using the destination address to ensure that the data in different scenarios is correctly transmitted in the tunnel.
[0054] In a third aspect, an embodiment of the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0055] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof.
[0056] In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes at least one instruction, and the at least one instruction is stored in a computer-readable storage medium. The processor of the server reads the at least one instruction from the computer-readable storage medium, and the processor executes the at least one instruction, so that the server loads and executes to implement the operations performed by the above method.
[0057] This application first obtains a tunnel creation request for the switch, which includes the tunnel configuration parameters of the virtual extensible LAN tunnel, so that the parameters can be set according to different needs. Then, obtain the tunnel configuration file and verify whether the tunnel configuration parameters meet the creation conditions to ensure the rationality of the creation. If the conditions are met, the tunnel is created according to the corresponding creation strategy based on the tunnel mode in the tunnel configuration parameters. Different tunnel modes (such as exclusive or shared) are distinguished here, so that there is a flexible mode selection when creating a VXLAN tunnel. If the tunnel is successfully created, the destination address in different scenarios is obtained and the tunnel is configured to ensure that the data is correctly transmitted in the tunnel in different scenarios. In this way, when creating a VXLAN tunnel, the appropriate mode can be selected according to the actual situation, avoiding resource waste and improving the performance of the nos system. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 is a flow chart of a method for creating a switch tunnel according to some embodiments of the present invention;
[0060] Figure 2 is a schematic diagram of a NOS system according to some embodiments of the present invention;
[0061] Figure 3 is a flow chart of a method for creating a switch tunnel according to some embodiments of the present invention;
[0062] Figure 4is a flow chart of a method for creating a switch tunnel according to some embodiments of the present invention;
[0063] Figure 5 is a structural block diagram of a switch tunnel creation device according to an embodiment of the present invention;
[0064] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0066] According to an embodiment of the present invention, a method, apparatus, device, medium and product for creating a switch tunnel are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0067] In this embodiment, a method for creating a switch tunnel is provided. Figure 1 A method for creating a switch tunnel according to an embodiment of the present invention is as follows: Figure 1 As shown, the method includes:
[0068] Step S101: obtaining a tunnel creation request for a switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel.
[0069] In the embodiment of the present application, in the nos system (such as Figure 2As shown in the figure, in order to effectively manage the VXLAN tunnel resources of the switch, when the tunnel creation operation is performed, the system will obtain a tunnel creation request for the switch. This request contains the key tunnel configuration parameters of the virtual extensible LAN tunnel. These parameters play a decisive role in accurately creating a VXLAN tunnel that meets specific needs. These may include the source address, which clarifies the starting location of data transmission; the tunnel type, different types are suitable for different scenarios and have different performance characteristics; especially important is the tunnel mode, users can specify exclusive or shared mode when creating a VXLAN tunnel according to different tunnel technologies. In this way, in the nos system, the appropriate tunnel mode can be selected according to actual needs, thereby minimizing the waste of VXLAN tunnel resources while meeting the needs as much as possible, thereby improving the overall performance of the nos system.
[0070] Step S102, obtaining a tunnel configuration file, and verifying the tunnel configuration file against tunnel configuration parameters to determine whether tunnel creation conditions are currently met.
[0071] In an embodiment of the present application, the tunnel configuration file is checked for tunnel configuration parameters to determine whether the tunnel creation conditions are currently met, including: obtaining the source address and tunnel mode from the tunnel configuration parameters; using the source address to query the tunnel configuration file whether there is a matching creation record to obtain a first query result; based on the first query result, determining whether the tunnel creation conditions are currently met.
[0072] First, the source address and tunnel mode are extracted from the tunnel configuration parameters contained in the tunnel creation request. The source address specifies the starting location of the tunnel data, while the tunnel mode (such as shared mode or exclusive mode) determines the tunnel usage and resource allocation strategy.
[0073] Next, the extracted source address is used to query the tunnel configuration file. The purpose of this query is to see if there is a creation record that matches the source address. If a record related to the source address is found in the tunnel configuration file, the first query result will be obtained. This result may indicate that the tunnel corresponding to the source address has already been partially configured or has been created before.
[0074] In an embodiment of the present application, whether the tunnel creation conditions are currently met is determined based on the query results, including: if the first query result is that there is a matching creation record, and the tunnel mode in the creation record matching the source address is consistent with the tunnel mode in the tunnel configuration parameters, then it is determined that the tunnel creation conditions are currently met; if the first query result is that there is no matching creation record, then it is determined that the tunnel creation conditions are currently not met.
[0075] Specifically, if the first query result indicates that there is a creation record that matches the source address in the tunnel configuration file, then it will be further checked whether the tunnel mode in the record is consistent with the tunnel mode in the current tunnel configuration parameters. This is because the tunnel mode determines important characteristics such as how the tunnel is used and the resource allocation strategy. If the two are consistent, it means that the existing tunnel configuration is compatible with the new request, and further operations can be performed on this basis or the process of creating the tunnel can continue. So in this case, it is determined that the tunnel creation conditions are currently met. For example, there is already a record with a source address of A in the tunnel configuration file, and its tunnel mode is shared mode, and the source address in the new tunnel creation request is also A, and the tunnel mode is also shared mode, then the tunnel creation conditions are met.
[0076] If the first query result is that there is no matching creation record, it means that no information related to the source address of the current request is found in the tunnel configuration file. In this case, due to the lack of necessary basic configuration or the inability to determine whether it is compatible with the existing tunnel configuration, it is determined that the tunnel creation conditions are not met at present. For example, a new tunnel is to be created with source address B, but there is no record of source address B in the tunnel configuration file. At this time, it is not certain whether the creation conditions can be met, so it is considered that they are not met.
[0077] Step S103: If the tunnel creation condition is met, a tunnel mode is obtained based on the tunnel configuration parameters, and a tunnel is created according to a creation strategy corresponding to the tunnel mode.
[0078] In the embodiment of the present application, creating a tunnel according to the creation strategy corresponding to the tunnel mode includes the following steps A1-A2:
[0079] Step A1, if the tunnel mode is a shared mode, the source address is used to query whether there is a matching target key name from a pre-created dictionary structure to obtain a second query result, wherein the dictionary structure includes multiple key-value pairs, the key name in each key-value pair is a preset source address, and the key value is a tunnel start configuration parameter.
[0080] Specifically, when the tunnel mode is determined to be shared mode, the system will perform the following operations. First, the current source address is used to query in a pre-created dictionary structure. This dictionary structure is a special data structure that consists of multiple key-value pairs. The key name in each key-value pair is a preset source address, representing a different tunnel starting point. The key value is the tunnel starting configuration parameter, which may include some initial settings related to tunnel creation, such as a specific port number, protocol version and other information. By comparing the current source address with the key name in the dictionary structure, the system attempts to find out whether there is a matching target key name, thereby obtaining the second query result. The purpose of this query is to determine whether, in shared mode, there is already a partial tunnel configuration related to the current source address, so that these configurations can be reused to speed up the tunnel creation process or share resources.
[0081] Step A2: Perform a corresponding tunnel creation operation according to the second query result to obtain a tunnel.
[0082] Specifically, according to the second query result, the system will perform the corresponding tunnel creation operation to obtain the tunnel. If the second query result shows that there is a matching target key name, it means that there are already tunnel start configuration parameters corresponding to the current source address in the dictionary structure. In this case, the system can perform further operations based on these existing configuration parameters, which may include reusing part of the configuration, adjusting parameters to adapt to new needs, etc., and then complete the creation of the tunnel. For example, the reference count can be increased to indicate that the tunnel configuration is used in more places, or the tunnel can be expanded according to information such as the new destination address. If the second query result is that there is no matching target key name, the system may need to adopt a different creation strategy, such as calling a specific API function to create a tunnel from scratch, or obtaining the necessary configuration information from other places to initialize the tunnel. Ultimately, through these operations, the system can successfully create a tunnel to meet the data transmission needs in the network.
[0083] In an embodiment of the present application, a tunnel is created according to a creation strategy corresponding to the tunnel mode, including: if the second query result is that there is a target key name that matches the source address, then obtaining the corresponding target tunnel starting configuration parameters from the key-value pair where the target key name is located; and using the target tunnel starting configuration parameters to perform a tunnel creation operation to obtain the tunnel.
[0084] First, check the second query result. If the second query result indicates that there is a target key name that matches the source address, this means that the key-value pair corresponding to the current source address is found in the pre-created dictionary structure. This dictionary structure plays a role in storing and managing the tunnel start configuration parameters during the tunnel creation process. Once it is determined that there is a matching target key name, the corresponding target tunnel start configuration parameters are obtained from the key-value pair where the target key name is located. These parameters are stored during the previous tunnel creation or configuration process and may include various information related to the tunnel, such as specific network protocol settings, port allocations, security parameters, etc. The purpose of obtaining these parameters is to reuse or refer to these existing configurations in the current tunnel creation process to improve the efficiency and accuracy of tunnel creation.
[0085] The tunnel creation operation is performed using the obtained target tunnel start configuration parameters. This operation may involve calling a specific software interface, configuring network devices, or executing a series of commands to establish a tunnel connection. The system will make specific settings and adjustments based on these parameters to ensure that the tunnel can be established in the expected manner. For example, configure the network switch or router according to the parameters, establish a virtual tunnel connection, set the tunnel's source address, destination address, transmission protocol, etc. Ultimately, through these operations, a tunnel is obtained, allowing data to be transmitted securely and efficiently through the tunnel in the network.
[0086] In an embodiment of the present application, a tunnel is created according to a creation strategy corresponding to the tunnel mode, including: if the second query result is that there is no target key name matching the source address, calling the first application programming interface function of the software abstract interface to create a tunnel mapping table; using the tunnel mapping table and the source address to create a point-to-multipoint type tunnel initiator; creating a point-to-multipoint type tunnel terminator based on the tunnel initiator; and constructing a tunnel by connecting the tunnel initiator and the tunnel terminator.
[0087] If the second query result shows that there is no target key name that matches the source address, this means that the tunnel start configuration parameters corresponding to the current source address cannot be found in the pre-created dictionary structure. In this case, a different tunnel creation strategy needs to be adopted. Since there is no ready-made configuration that can be reused, it is necessary to call the first application programming interface (API) function of the software abstraction interface (SAI) to create a tunnel mapping table. The tunnel mapping table is a data structure used to store and manage tunnel-related information, such as the mapping relationship between the source address and the destination address, the configuration parameters of the tunnel, etc. By creating a tunnel mapping table, a basic data storage and management framework is provided for the subsequent tunnel creation process.
[0088] Create a point-to-multipoint (p2mp) tunnel initiator using the tunnel mapping table just created and the current source address. The tunnel initiator is the starting point of the tunnel communication and is responsible for initiating data transmission. The point-to-multipoint type means that this tunnel initiator can communicate with multiple destination addresses. During the creation process, the system will make configuration adjustments based on the source address and the information in the tunnel mapping table to ensure that the tunnel initiator can correctly point to multiple possible destination addresses and prepare for data transmission.
[0089] Create a point-to-multipoint type tunnel terminator based on the already created tunnel initiator. The tunnel terminator is the receiving end of the tunnel communication and is responsible for receiving data from the tunnel initiator. Similarly, the point-to-multipoint type tunnel terminator can receive data from tunnel initiators with multiple source addresses. During the creation process, the system will configure it according to the information of the tunnel initiator to ensure that the tunnel terminator can correctly establish a connection with the tunnel initiator to achieve data reception and transmission.
[0090] Finally, the tunnel initiator and the tunnel terminator are combined to build a complete tunnel. In this way, a communication channel from the source address to multiple destination addresses is established, allowing data to be transmitted in this tunnel. This tunnel can be used to achieve efficient data communication and resource sharing in the network.
[0091] It should be noted that in shared mode, multiple tunnels with the same source address can reuse the same tunnel mapping table (tunnelmap) and the tunnel initiation (tunnel_initiation) and tunnel termination (tunneltermination) of the point-to-multipoint (p2mp) type. The tunnel mapping table is used to define the mapping relationship of the tunnel to ensure that the source address and the destination address are correctly associated. In order to ensure the correct transmission of data, all mapping relationships in the tunnel mapping table cannot conflict. For each destination address, a corresponding point-to-point (p2p) type tunnel initiation will be created. This design can improve resource utilization and management efficiency. Multiple tunnels share the same resource configuration to achieve communication from the same source address to multiple destination addresses.
[0092] Step S104, if the tunnel is successfully created, the destination addresses in different scenarios are obtained, and the created tunnel is configured using the destination addresses to ensure that the data in different scenarios is correctly transmitted in the tunnel.
[0093] In an embodiment of the present application, if the tunnel creation result is successful, a series of operations will be performed to ensure that data in different scenarios can be correctly transmitted in the tunnel. First, the destination address in different scenarios needs to be obtained. For example, the destination address will be determined when a remote tunnel route is created in a virtual network (vnet), when a tunnel remote end is specified in a static VXLAN, and when an EVPNVXLAN receives a type3 route. These different scenarios may have different requirements and methods to determine the destination address, but the ultimate goal is to clarify the transmission direction of the data in the tunnel. After obtaining the destination address, the destination address is used to configure the tunnel that has just been successfully created. This may include setting the destination address in the configuration parameters of the tunnel, adjusting the routing rules of the tunnel to point to the destination address, or performing some specific protocol settings based on the characteristics of the destination address. Through these configuration operations, the tunnel can adapt to the data transmission requirements in different scenarios, ensuring that data can be accurately transmitted from the source address through the tunnel to the destination address, and achieving efficient and reliable data communication.
[0094] This application first obtains a tunnel creation request for the switch, which includes the tunnel configuration parameters of the virtual extensible LAN tunnel, so that the parameters can be set according to different needs. Then, obtain the tunnel configuration file and verify whether the tunnel configuration parameters meet the creation conditions to ensure the rationality of the creation. If the conditions are met, the tunnel is created according to the corresponding creation strategy based on the tunnel mode in the tunnel configuration parameters. Different tunnel modes (such as exclusive or shared) are distinguished here, so that there is a flexible mode selection when creating a VXLAN tunnel. If the tunnel is successfully created, the destination address in different scenarios is obtained and the tunnel is configured to ensure that the data is correctly transmitted in the tunnel in different scenarios. In this way, when creating a VXLAN tunnel, the appropriate mode can be selected according to the actual situation, avoiding resource waste and improving the performance of the nos system.
[0095] Figure 3 A method for creating a switch tunnel according to an embodiment of the present invention is as follows: Figure 3 As shown, the method includes:
[0096] Step S201: obtaining a tunnel creation request for a switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel.
[0097] In an embodiment of the present application, when a virtual extensible local area network (VXLAN) tunnel needs to be created in a network, the system obtains a tunnel creation request for a specific switch. This request contains key tunnel configuration parameters for the virtual extensible local area network tunnel. These parameters are essential for accurately creating a VXLAN tunnel that meets specific needs. For example, tunnel configuration parameters may include a source address (rcip), which determines the starting point of tunnel data transmission; a tunnel type (tunneltype), different tunnel types differ in performance and applicable scenarios; a tunnel mode (modetype), such as shared mode or exclusive mode, which determines how the tunnel is used and the resource allocation strategy. By obtaining this tunnel creation request, the system can understand the specific requirements for creating a tunnel and provide necessary information input for the subsequent tunnel creation process.
[0098] Step S202: Obtain a tunnel configuration file, and verify the tunnel configuration file against tunnel configuration parameters to determine whether tunnel creation conditions are currently met.
[0099] In the embodiment of the present application, first, the system obtains a tunnel configuration file. This file stores various configuration information and historical records related to the tunnel. Then, the system uses the tunnel configuration file to verify the tunnel configuration parameters in the tunnel creation request. Specifically, the system extracts the source address and the tunnel mode from the tunnel configuration parameters. Next, the source address is used to query whether there is a matching creation record from the tunnel configuration file to obtain a first query result. If the first query result shows that there is a matching creation record, and the tunnel mode in the record is consistent with the tunnel mode in the tunnel configuration parameter, then it is determined that the tunnel creation condition is currently met. For example, there is already a record in the tunnel configuration file with a source address of a specific value, and the tunnel mode is the same as the tunnel mode of the current request, indicating that the tunnel can be created on this basis or some parameter adjustments can meet the requirements. If the first query result is that there is no matching creation record, then it is determined that the tunnel creation condition is not met at present, and other creation strategies need to be adopted or more configuration information needs to be obtained to meet the creation condition. Through this verification process, the system can ensure that there will be no conflicts or incompatibilities when creating a tunnel, thereby ensuring the smooth progress of tunnel creation.
[0100] Step S203: If the tunnel creation condition is met, a tunnel mode is obtained based on the tunnel configuration parameters, and a tunnel is created according to a creation strategy corresponding to the tunnel mode.
[0101] In the embodiment of the present application, creating a tunnel according to the creation strategy corresponding to the tunnel mode includes the following steps B1-B7:
[0102] Step B1: If the tunnel mode is the exclusive mode, obtain the currently created tunnel mapping table.
[0103] Specifically, if the tunnel mode is determined to be exclusive mode, the system first needs to obtain the currently created tunnel mapping table. The tunnel mapping table is a data structure used to store and manage information related to the tunnel, such as the mapping relationship between the source address and the destination address, the configuration parameters of the tunnel, etc. In the exclusive mode, this tunnel mapping table will provide important basic information for the subsequent tunnel creation process.
[0104] Step B2: Create a point-to-multipoint type tunnel initiator using the tunnel mapping table and the source address.
[0105] Specifically, a point-to-multipoint type tunnel initiator is created using a tunnel mapping table and a source address, including: obtaining target configuration information associated with the tunnel contained in the tunnel mapping table; passing the source address and the target configuration information as parameters to a first application programming interface function of a software abstract interface; calling the first application programming interface function to determine a starting position based on the source address, and using the target configuration information to configure multiple communication addresses pointed to by the starting position, to obtain a tunnel initiator.
[0106] A point-to-multipoint type tunnel initiator is created using a tunnel mapping table and a source address. First, the target configuration information associated with the tunnel contained in the tunnel mapping table is obtained. These target configuration information include various tunnel-related parameters, such as network protocol settings, port allocations, security parameters, etc. The source address and target configuration information are passed as parameters to the first application programming interface (API) function of the software abstract interface. This API function is a function specifically used to create a tunnel initiator. By passing in the source address and target configuration information, the function can perform specific operations based on these parameters.
[0107] After calling the first application programming interface function, the function determines the starting position based on the source address. This starting position is the location identifier of the tunnel initiator in the network. Then, the target configuration information is used to configure the multiple communication addresses pointed to by the starting position. In a point-to-multipoint type tunnel, the tunnel initiator needs to be able to communicate with multiple destination addresses. Therefore, through the target configuration information, the function can associate and configure the starting position with multiple communication addresses to obtain the tunnel initiator. This tunnel initiator will serve as the starting point of data transmission and is responsible for initiating data transmission to multiple destination addresses.
[0108] Step B3: record the first corresponding relationship between the tunnel initiator and the tunnel mapping table, and initialize the reference count corresponding to the first corresponding relationship to 0.
[0109] Record the first correspondence between the tunnel initiator and the tunnel mapping table, and initialize the reference count corresponding to the first correspondence to 0. The purpose of this step is to establish the association between the tunnel initiator and the tunnel mapping table so that it can be managed and maintained according to this correspondence in the future. The reference count is initialized to 0, indicating that no other object currently references this correspondence, and the reference count may be increased with subsequent operations.
[0110] Step B4: creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end.
[0111] In an embodiment of the present application, a point-to-multipoint type tunnel terminator is created based on a tunnel initiator, including: passing the initiator information of the tunnel initiator as a parameter to a second application programming interface function of the software abstract interface; calling the second application programming interface function to create a point-to-multipoint type tunnel terminator according to the initiator information.
[0112] Step B5: record the second corresponding relationship between the tunnel termination end and the tunnel mapping table, and initialize the reference count corresponding to the second corresponding relationship to 0.
[0113] First, the initiator information of the tunnel initiator is passed as a parameter to the second application programming interface function of the software abstract interface. This initiator information contains the key features and configuration parameters of the tunnel initiator. Then, the second application programming interface function is called, which creates a point-to-multipoint type tunnel terminator according to the passed initiator information. This means that the creation of the tunnel terminator is based on the information of the tunnel initiator to ensure that the two can work together to achieve data transmission between multiple source addresses and destination addresses.
[0114] Step B6, verifying the first corresponding relationship and the second corresponding relationship.
[0115] The second correspondence between the tunnel terminator and the tunnel mapping table is recorded, and the reference count corresponding to the second correspondence is initialized to 0. Similar to step B3, this step is to establish the association between the tunnel terminator and the tunnel mapping table and initialize the reference count to prepare for subsequent management and use.
[0116] Step B7: If the first correspondence relationship and the second correspondence relationship are verified, the first correspondence relationship and the second correspondence relationship are stored, and a tunnel is constructed using the tunnel initiator and the tunnel terminating end.
[0117] If the first correspondence and the second correspondence are verified, the first correspondence and the second correspondence are stored, and the tunnel is constructed using the tunnel initiator and the tunnel terminator. If the verification is passed, it means that the correspondence between the tunnel initiator and the tunnel terminator and the tunnel mapping table is correct, and these correspondences can be stored for subsequent query and use. Then, a complete tunnel is constructed using the tunnel initiator and the tunnel terminator, so that data can be transmitted in this tunnel, realizing a point-to-multipoint communication mode.
[0118] It should be noted that in exclusive mode, each source address corresponds to an independent tunnel mapping table, a point-to-multipoint type tunnel start end, and a tunnel end end. Unlike shared mode, in exclusive mode, all mapping relationships in any tunnel mapping table can be repeated, and there is no need to ensure uniqueness as in shared mode. Similarly, a corresponding point-to-point type tunnel start end is created for each destination address. The tunnel mode corresponding to a source address is unique, which means that different tunnel modes cannot exist at the same time. Tunnel creation adopts asynchronous mode. Users can return directly after executing tunnel creation in the command line. The application layer will choose different ways to create tunnels according to the tunnel mode. If the conditions of exclusive mode cannot be met, that is, each source address corresponds to an independent and unique tunnel configuration, the status of the tunnel will be marked as failed, indicating that there is a mode conflict. If the conditions are met after a tunnel is deleted, the application layer will try to recreate the tunnel to ensure the correct implementation of exclusive mode.
[0119] Step S204: If the tunnel is successfully created, the destination addresses in different scenarios are obtained, and the created tunnel is configured using the destination addresses to ensure that the data in different scenarios is correctly transmitted in the tunnel.
[0120] In an embodiment of the present application, the destination address in different scenarios is obtained, and the created tunnel is configured using the destination address, including: obtaining the remote tunnel route created in different scenarios, and obtaining the destination address specified by the remote tunnel route; calling the first application programming interface function to configure the tunnel according to the destination address, and obtaining the configured tunnel, so that data can be transmitted between the source address and the destination address through the configured tunnel.
[0121] Specifically, first, in different scenarios, the system will obtain the remote tunnel route that has been created. These scenarios may include creating a remote tunnel route in a virtual network (vnet), specifying the remote end of a tunnel in a static VXLAN, and receiving a type 3 route in an EVPN VXLAN. In these scenarios, the creation of a remote tunnel route usually involves specifying a destination address. Next, the destination address specified by the remote tunnel route is obtained. This destination address clarifies the direction of data transmission in the tunnel, that is, the final location to which the data is to be transmitted. Then, the first application programming interface function is called to configure the tunnel according to the destination address. This API function adjusts and sets the relevant parameters of the tunnel according to the destination address. For example, the routing rules of the tunnel may be set so that data can be accurately transmitted from the source address to the destination address; or the protocol configuration of the tunnel may be adjusted to adapt to a specific network environment and transmission requirements. Finally, a configured tunnel is obtained. Through such a configuration process, it is ensured that data can be efficiently and accurately transmitted between the source address and the destination address through the configured tunnel. This tunnel becomes a communication channel connecting the source address and the destination address, providing a reliable path for data transmission.
[0122] In addition, first of all, a dedicated monitoring module is deployed in the system, which continuously interacts with the established tunnel and collects various data indicators. The data transmission rate is calculated by periodically sending test packets to the tunnel and recording information such as the timestamps of sending and receiving and the number of packets. At the same time, the difference in these timestamps can be used to evaluate the delay. For the monitoring of packet loss rate, it is determined by comparing the total number of packets sent and the number of packets actually received. In addition, the monitoring module will continuously check the connection status of the tunnel, signal strength and other factors to determine the stability and reliability of the tunnel.
[0123] This monitoring module will feed back the collected data transmission rate, delay, packet loss rate, stability and reliability of the tunnel to the control center of the system in real time. The control center will set corresponding thresholds. When the monitored data indicators exceed these thresholds, it indicates that there is a problem with data transmission. If the problem is relatively minor, the system can automatically trigger the process of reconfiguring the tunnel. For example, adjust the bandwidth allocation of the tunnel, optimize the routing selection, or change the parameters of the transmission protocol. If the problem is more serious, the system will send an alert to the network administrator, which can be presented by email, SMS or system pop-up window. After receiving the alert, the network administrator can conduct an in-depth analysis of the problem and take corresponding manual intervention measures, such as manually adjusting the tunnel configuration, checking the hardware problems of the network equipment, or coordinating with other relevant departments to troubleshoot. Through such a monitoring and feedback mechanism, it can be ensured that the transmission of data in the tunnel is always efficient, stable and reliable.
[0124] In an embodiment of the present application, the method also includes: obtaining a tunnel deletion request, wherein the tunnel deletion request carries the tunnel to be deleted; determining the tunnel mode of the tunnel to be deleted, and performing a corresponding tunnel deletion operation based on a deletion policy corresponding to the tunnel mode.
[0125] Specifically, first, the system obtains a tunnel deletion request. This request carries the information of the tunnel to be deleted, which can be used to identify and locate the tunnel to be deleted. For example, it may contain key information such as the tunnel identifier, source address, and destination address, so that the system can accurately find the tunnel to be deleted. Next, the system determines the tunnel mode of the tunnel to be deleted. Tunnel modes are divided into shared mode and exclusive mode. The mode of the tunnel can be determined by analyzing the relevant parameters of the tunnel to be deleted or querying the tunnel configuration file. This step is very important because different tunnel modes correspond to different deletion strategies.
[0126] Shared mode: If the mode of the tunnel to be deleted is shared mode, first check whether there is a point-to-point (p2p) type tunnel initiator (tunnel_initiation). If so, delete all these p2ptunnel_initiations. Then, check the reference count of the point-to-multipoint (p2mp) type tunnel_initiation. If the reference count is not 0, it means that there are other places using this tunnel initiator. At this time, just reduce the reference count by 1 and do nothing else. If the reference count is 0, it means that there are no other places using this tunnel initiator. First delete the corresponding p2mptunneltermination (tunnel termination), then delete tunnel_initiation (tunnel initiator), and finally delete tunnelmap (tunnel mapping table).
[0127] Exclusive mode: When the mode of the tunnel to be deleted is exclusive mode, after the point-to-point (p2p) type tunnel_initiation is deleted, the corresponding p2mptunneltermination (tunnel termination end) is deleted first, then the tunnel_initiation (tunnel initiation end) is deleted, and finally the tunnel_map (tunnel mapping table) is deleted. By executing different deletion strategies according to the tunnel mode, the tunnel deletion operation can be ensured to be safe and efficient, and will not affect the normal operation of other tunnels or systems in use.
[0128] As an example, Figure 4 As shown:
[0129] Step 1: Create a dictionary sip_tunnel_map.
[0130] Create a dictionary data structure named sip_tunnel_map. This dictionary will be used in subsequent steps to store and manage tunnel-related information, such as the correspondence between the source address and the tunnel initiator.
[0131] Step 2: When creating a vxlan tunnel, the command line input is srcip (source address), tunneltype (tunnel type), and modetype (tunnel mode).
[0132] When you need to create a virtual extensible LAN (VXLAN) tunnel, you enter the source address, tunnel type, and tunnel mode in the command line. The source address determines the starting point of the tunnel data transmission; the tunnel type may determine the performance and applicable scenarios of the tunnel; the tunnel mode is divided into shared mode and exclusive mode, which will affect the subsequent creation of tunnels and resource usage.
[0133] Step 3: Check whether the source address in step 2 is in the current vxlan tunnel configuration file. If yes and the tunnel mode is inconsistent with the one entered in step 2, update the tunnel status to "Failed (mode_conflict)"; if they are consistent, update the tunnel status to "Creating".
[0134] The system will check whether there is a record with the same source address as the input in the current VXLAN tunnel configuration file. If it exists, the system will further compare whether the input tunnel mode is consistent with the tunnel mode corresponding to the source address in the configuration file. If they are inconsistent, it means there is a mode conflict, and the tunnel status is updated to "Failed (modeconflict)", indicating that the tunnel creation failed. If they are consistent, it means that the process of creating a tunnel can continue, and the tunnel status is updated to "Creating", indicating that the tunnel is being created.
[0135] Step 4: If the tunnel mode is shared_mode, use the srcip in step 2 to find out whether the key exists in the siptunnel_map in step 1. If not, jump to step 6; if it exists, use the corresponding tunnel_initiation, increase the reference count by 1, and then jump to step 9.
[0136] If the tunnel mode is determined to be shared mode, use the input source address to find the corresponding key in the sip_tunnel_map dictionary. If the key is not found, it means that there is no tunnel resource that can be reused, and you need to jump to step 6 to create a new resource. If the key is found, it means that the existing tunnel initiator (tunnel_initiation) can be reused, and the reference count of this tunnel initiator is increased by 1, indicating that more places are using this resource, and then jump directly to step 9.
[0137] Step 5: If the tunnel mode is exclusive mode, go to steps 7-8.
[0138] If the tunnel mode is exclusive, a series of specific operations are required to create tunnel resources. Specifically, the operations in steps 7 and 8 are performed.
[0139] Step 6: Call sai's apicreate_tunnel_map to create tunnel_map.
[0140] If the corresponding resource cannot be found in the shared mode or a new resource needs to be created in the exclusive mode, call the API create_tunnel_map provided by the software abstraction interface (SAI) to create a tunnel mapping table (tunnelmap). This tunnel mapping table will be used to store and manage the relevant configuration information of the tunnel.
[0141] Step 7: Call sai's apicreate_tunnel to use srcip and tunnel_map to create a p2mp type tunnel_initiation, record the correspondence between tunnel_initiation and tunnel_map, and initialize the reference count to 0.
[0142] Call SAI's API create_tunnel to create a point-to-multipoint (p2mp) tunnel initiator using the input source address and the newly created tunnel mapping table. At the same time, record the correspondence between this tunnel initiator and the tunnel mapping table, and initialize the reference count to 0, indicating that no other place is currently using this resource.
[0143] Step 8: Call sai's apicreate_tunnel_termination to use tunnel_initiation to create a p2mp type tunnel_termination, and record the correspondence between tunnel_initiation and tunnel_termination.
[0144] Call the SAI API create_tunnel_termination and use the tunnel initiator created in the previous step to create a point-to-multipoint type tunnel termination. At the same time, record the corresponding relationship between the tunnel initiator and the tunnel termination so that tunnel resources can be correctly managed and used in subsequent operations.
[0145] Step 9: Update the tunnel status to "Created".
[0146] At this point, the tunnel is created successfully and the tunnel status is updated to "Created", indicating that the tunnel has been successfully created and can be used.
[0147] Step 10: dstip (destination address) is specified when vnet creates a remote tunnel route, static vxlan is specified when the remote end of the tunnel is specified, and evpnvxlan is specified when a type3 route is received.
[0148] The destination address will be specified in different scenarios. For example, when creating a remote tunnel route in a virtual network (vnet), specifying the remote end of a tunnel in a static VXLAN, and when receiving a type 3 route in an EVPN VXLAN, the destination address will be determined. This destination address will be used for subsequent tunnel configuration to ensure that data can be correctly transmitted to the specified location.
[0149] Step 11: Call sai's apicreate_tunnel to create a p2p type tunnel_initiation using the srcip in step 2, the dstip in step 10, and the tunnel_map in step 6.
[0150] Call the SAI API create_tunnel to create a point-to-point (p2p) tunnel initiator using the input source address, the destination address determined in step 10, and the tunnel mapping table created in step 6. This tunnel initiator will be used to communicate with a specific destination address.
[0151] Step 12: According to the correspondence between Vlan and vni, call apicreate_tunnel_map_entry of sai and add it to the tunnelmap in step 6.
[0152] According to the correspondence between the virtual local area network (Vlan) and the virtual network identifier (vni), call the SAI API create_tunnel_map_entry to add the relevant configuration information to the tunnel mapping table created in step 6 to improve the tunnel configuration and ensure that data can be correctly transmitted in different network environments.
[0153] Step 13: When deleting a tunnel in shared mode, you need to delete all p2ptunnel_initiations, then check the reference count of p2mptunnel_initiation. If it is not 0, reduce the reference count by 1 and do nothing. If it is 0, first delete the corresponding p2mp_tunnel_termination, then delete tunnel_initiation, and finally delete tunnel_map.
[0154] When deleting a tunnel in shared mode, first delete all point-to-point tunnel initiators. Then check the reference count of the point-to-multipoint tunnel initiator. If the reference count is not 0, it means that there are other places using this resource. At this time, just reduce the reference count by 1 and do nothing else. If the reference count is 0, it means that there are no other places using this resource. First delete the corresponding point-to-multipoint tunnel terminator, then delete the tunnel initiator, and finally delete the tunnel mapping table to completely release the tunnel resources.
[0155] Step 14: After the exclusive mode p2ptunnel_initiation is deleted, first delete the corresponding p2mptunneltermination, then delete tunnel_initiation, and finally delete tunnelmap.
[0156] When deleting a tunnel in exclusive mode, first delete all point-to-point tunnel initiators, then delete the corresponding point-to-multipoint tunnel terminators, then delete the tunnel initiators, and finally delete the tunnel mapping table to release the tunnel resources in exclusive mode.
[0157] In this embodiment, a switch tunnel creation device is also provided, which is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0158] This embodiment provides a switch tunnel creation device, such as Figure 5 As shown, including:
[0159] The acquisition module 501 is used to acquire a tunnel creation request for a switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel;
[0160] Verification module 502, used to obtain a tunnel configuration file, and verify the tunnel configuration file against tunnel configuration parameters to determine whether tunnel creation conditions are currently met;
[0161] A creation module 503 is used to obtain a tunnel mode based on the tunnel configuration parameters if the tunnel creation condition is met, and create a tunnel according to a creation strategy corresponding to the tunnel mode;
[0162] The processing module 504 is used to obtain the destination addresses in different scenarios if the tunnel is successfully created, and configure the created tunnel using the destination addresses to ensure that the data in different scenarios is correctly transmitted in the tunnel.
[0163] In an embodiment of the present application, the verification module 502 is used to obtain the source address and tunnel mode from the tunnel configuration parameters; use the source address to query whether there is a matching creation record from the tunnel configuration file to obtain a first query result; and determine whether the tunnel creation conditions are currently met based on the first query result.
[0164] In an embodiment of the present application, the verification module 502 is used to determine that the tunnel creation conditions are currently met if the first query result is that there is a matching creation record, and the tunnel mode in the creation record matching the source address is consistent with the tunnel mode in the tunnel configuration parameters; if the first query result is that there is no matching creation record, it is determined that the tunnel creation conditions are not currently met.
[0165] In an embodiment of the present application, a creation module 503 is used to, if the tunnel mode is a shared mode, use the source address to query whether there is a matching target key name from a pre-created dictionary structure to obtain a second query result, wherein the dictionary structure includes multiple key-value pairs, and the key name in each key-value pair is a preset source address, and the key value is a tunnel start configuration parameter; and the corresponding tunnel creation operation is performed according to the second query result to obtain the tunnel.
[0166] In an embodiment of the present application, a creation module 503 is used to obtain the corresponding target tunnel starting configuration parameters from the key-value pair where the target key name is located if the second query result is that there is a target key name that matches the source address; and use the target tunnel starting configuration parameters to perform a tunnel creation operation to obtain the tunnel.
[0167] In an embodiment of the present application, a creation module 503 is used to call the first application programming interface function of the software abstract interface to create a tunnel mapping table if the second query result is that there is no target key name matching the source address; use the tunnel mapping table and the source address to create a point-to-multipoint type tunnel initiator; create a point-to-multipoint type tunnel terminator based on the tunnel initiator; and construct a tunnel by connecting the tunnel initiator and the tunnel terminator.
[0168] In an embodiment of the present application, a creation module 503 is used to obtain a currently created tunnel mapping table if the tunnel mode is an exclusive mode; create a point-to-multipoint type tunnel initiator using the tunnel mapping table and the source address; record a first correspondence between the tunnel initiator and the tunnel mapping table, and initialize a reference count corresponding to the first correspondence to 0; create a point-to-multipoint type tunnel terminator based on the tunnel initiator; record a second correspondence between the tunnel terminator and the tunnel mapping table, and initialize a reference count corresponding to the second correspondence to 0; verify the first correspondence and the second correspondence; if the first correspondence and the second correspondence are verified, store the first correspondence and the second correspondence, and build a tunnel using the tunnel initiator and the tunnel terminator.
[0169] In an embodiment of the present application, the target configuration information associated with the tunnel contained in the tunnel mapping table is obtained; the source address and the target configuration information are passed as parameters to the first application programming interface function of the software abstract interface; the first application programming interface function is called to determine the starting position according to the source address, and the target configuration information is used to configure the multiple communication addresses pointed to by the starting position to obtain the tunnel initiator.
[0170] In an embodiment of the present application, a creation module 503 is used to pass the initiator information of the tunnel initiator as a parameter to the second application programming interface function of the software abstract interface; and call the second application programming interface function to create a point-to-multipoint type tunnel termination end according to the initiator information.
[0171] In an embodiment of the present application, processing module 504 is used to obtain the remote tunnel route created in different scenarios and obtain the destination address specified by the remote tunnel route; call the first application programming interface function to configure the tunnel according to the destination address to obtain the configured tunnel, so that data can be transmitted between the source address and the destination address through the configured tunnel.
[0172] In an embodiment of the present application, the device also includes: a deletion module, which is used to obtain a tunnel deletion request, wherein the tunnel deletion request carries the tunnel to be deleted; determine the tunnel mode of the tunnel to be deleted, and perform a corresponding tunnel deletion operation based on the deletion policy corresponding to the tunnel mode.
[0173] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).
[0174] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0175] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0176] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0177] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0178] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0179] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0180] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for creating a switch tunnel, characterized in that: The method comprises: Obtaining a tunnel creation request for the switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel; Obtain a tunnel configuration file, and verify the tunnel configuration parameters in the tunnel configuration file to determine whether a tunnel creation condition is currently met; If the tunnel creation condition is met, the tunnel mode is obtained based on the tunnel configuration parameters, and the tunnel is created according to the creation strategy corresponding to the tunnel mode; If the tunnel is successfully created, the destination addresses in different scenarios are obtained, and the created tunnel is configured using the destination addresses to ensure that data in different scenarios is correctly transmitted in the tunnel; The checking of the tunnel configuration parameters in the tunnel configuration file to determine whether the tunnel creation condition is currently met includes: obtaining a source address and a tunnel mode from the tunnel configuration parameters; using the source address to query whether there is a matching creation record from the tunnel configuration file to obtain a first query result; and determining whether the tunnel creation condition is currently met based on the first query result; The determining whether the tunnel creation condition is currently met based on the first query result includes: if the first query result is that there is a matching creation record, and the tunnel mode in the creation record matched by the source address is consistent with the tunnel mode in the tunnel configuration parameters, then it is determined that the tunnel creation condition is currently met; if the first query result is that there is no matching creation record, then it is determined that the tunnel creation condition is not currently met.
2. The method according to claim 1, characterized in that The step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes: If the tunnel mode is a shared mode, the source address is used to query whether there is a matching target key name from a pre-created dictionary structure to obtain a second query result, wherein the dictionary structure includes multiple key-value pairs, the key name in each key-value pair is a preset source address, and the key value is a tunnel start configuration parameter; A corresponding tunnel creation operation is performed according to the second query result to obtain the tunnel.
3. The method according to claim 2, characterized in that The step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes: If the second query result is that there is a target key name matching the source address, obtaining the corresponding target tunnel start configuration parameter from the key-value pair where the target key name is located; The tunnel is obtained by performing a tunnel creation operation using the target tunnel start configuration parameters.
4. The method according to claim 2, characterized in that: The step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes: If the second query result is that there is no target key name matching the source address, calling a first application programming interface function of the software abstract interface to create a tunnel mapping table; Creating a point-to-multipoint type tunnel initiator using the tunnel mapping table and the source address; Creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end; The tunnel is constructed by using the tunnel initiator and the tunnel terminator.
5. The method according to claim 1, characterized in that The step of creating a tunnel according to a creation strategy corresponding to the tunnel mode includes: If the tunnel mode is exclusive mode, obtain the currently created tunnel mapping table; Creating a point-to-multipoint type tunnel initiator using the tunnel mapping table and the source address; Recording a first correspondence between the tunnel initiator and the tunnel mapping table, and initializing a reference count corresponding to the first correspondence to 0; Creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end; Recording a second correspondence between the tunnel termination end and the tunnel mapping table, and initializing a reference count corresponding to the second correspondence to 0; Verifying the first corresponding relationship and the second corresponding relationship; If the first correspondence relationship and the second correspondence relationship are verified to be successful, the first correspondence relationship and the second correspondence relationship are stored, and the tunnel initiator and the tunnel terminator are used to construct the tunnel.
6. The method according to claim 5, characterized in that The step of creating a point-to-multipoint type tunnel initiator by using the tunnel mapping table and the source address includes: Obtaining target configuration information associated with the tunnel contained in the tunnel mapping table; Passing the source address and the target configuration information as parameters into a first application programming interface function of a software abstract interface; The first application programming interface function is called to determine a starting position according to the source address, and the target configuration information is used to configure a plurality of communication addresses pointed to by the starting position to obtain the tunnel initiator.
7. The method according to claim 5, characterized in that The step of creating a point-to-multipoint type tunnel termination end based on the tunnel initiator end includes: Passing the initiator information of the tunnel initiator as a parameter into the second application programming interface function of the software abstract interface; The second application programming interface function is called to create a point-to-multipoint type tunnel termination end according to the initiator information.
8. The method according to claim 1, characterized in that: The obtaining of destination addresses in different scenarios and configuring the created tunnel using the destination addresses includes: Obtain remote tunnel routes created in different scenarios, and obtain destination addresses specified by the remote tunnel routes; The first application programming interface function is called to configure the tunnel according to the destination address to obtain a configured tunnel, so that data is transmitted between the source address and the destination address through the configured tunnel.
9. The method according to claim 1, characterized in that: The method further comprises: Obtain a tunnel deletion request, wherein the tunnel deletion request carries the tunnel to be deleted; Determine the tunnel mode of the tunnel to be deleted, and perform a corresponding tunnel deletion operation based on a deletion policy corresponding to the tunnel mode.
10. A switch tunnel creation device, characterized in that: The device comprises: An acquisition module, configured to acquire a tunnel creation request for a switch, wherein the tunnel creation request includes tunnel configuration parameters of a virtual extensible local area network tunnel; A verification module, used to obtain a tunnel configuration file, and verify the tunnel configuration parameters in the tunnel configuration file to determine whether the tunnel creation condition is currently met; A creation module, configured to obtain a tunnel mode based on the tunnel configuration parameters if the tunnel creation condition is met, and create a tunnel according to a creation strategy corresponding to the tunnel mode; A processing module, configured to obtain the destination addresses in different scenarios if the tunnel is successfully created, and configure the created tunnel using the destination addresses to ensure that data in different scenarios is correctly transmitted in the tunnel; The verification module is used to obtain a source address and a tunnel mode from the tunnel configuration parameters; query whether there is a matching creation record from the tunnel configuration file using the source address to obtain a first query result; and determine whether a tunnel creation condition is currently met based on the first query result; The verification module is used to determine that the tunnel creation conditions are currently met if the first query result is that there is a matching creation record, and the tunnel mode in the creation record matching the source address is consistent with the tunnel mode in the tunnel configuration parameters; if the first query result is that there is no matching creation record, determine that the tunnel creation conditions are currently not met.
11. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product includes at least one instruction, which is stored in a computer-readable storage medium. The processor of the server reads the at least one instruction from the computer-readable storage medium, and the processor executes the at least one instruction, so that the server loads and executes to implement the operations performed by the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
VXLAN tunnel detection method and apparatus
CN105490884A