Port determination method, device, electronic device and storage medium
By avoiding selecting the backup device port in the virtualized network device and using dynamic aggregate link information to determine the communication port, the resource occupation problem caused by the backup device not processing business messages is solved, and resources are saved and communication efficiency is improved.
Patent Information
- Application Number
- CN202410475537.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-04-19
AI Technical Summary
In virtualized network devices, the backup device does not process service packets, which requires the establishment of a data channel between the primary and backup devices, occupying a large number of port resources and bandwidth resources.
When determining the communication port, avoid selecting the port on the backup device, and determine the candidate port based on the port status and aggregation capability information of the dynamic aggregation link. The primary device establishes a communication port with the peer virtualized network device to avoid establishing a data channel between the primary and backup devices.
It saves port resources and bandwidth resources and optimizes the communication efficiency of virtualized network devices.
Smart Images

Figure CN118473908B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a port determination method, device, electronic device, and storage medium. Background Art
[0002] In a network scenario, multiple physical devices are virtualized into one network device (referred to as a virtualized network device) through a proprietary protocol. The virtualized network devices are physically connected through physical links established between the physical devices (which may include a master device and a backup device) within each of them. In addition, dynamic aggregation links are configured between the ports corresponding to the physical links to ensure that the virtualized network device can process service messages normally when an abnormality occurs in one of the physical devices within itself. Even if an abnormality occurs in one of the physical devices within itself and a physical device in the opposite virtual network device, the virtual network device can still process service messages normally.
[0003] When the virtual network device is operating normally, since the communication ports determined for communicating with the opposite virtual network device usually include ports on the master device and the backup device, both the master device and the backup device in the virtual network device will receive some business messages. Since the backup device does not process business messages, it is necessary to establish a data channel between the master device and the backup device. The backup device sends the business messages to the master device for processing through the data channel. This will occupy more port resources and bandwidth resources. Summary of the Invention
[0004] To overcome the problems existing in the related art, the present application provides a port determination method, device, electronic device and storage medium.
[0005] According to a first aspect of an embodiment of the present application, a port determination method is provided. The method is applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship with each other. The method includes:
[0006] When determining that it is necessary to actively determine, as a master device, a communication port for the virtualized network device to perform service communication with the peer virtualized network device, sending a notification message to the peer virtualized network device for notifying the master device in the peer virtualized network device to determine the communication port for the peer virtualized network device to perform service communication with the virtualized network device, and determining whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device;
[0007] When the judgment result is yes, determining a set number of candidate ports based on the device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the peer virtualized network device is located, the port state of each port, the aggregation capability information of each port, the aggregation capability information of the port on the peer virtualized network device connected to each port, and the identification information of each port, wherein the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device;
[0008] The determined candidate port is synchronized to the peer virtualized network device, and when the candidate port determined by the master device in the peer virtualized network device and synchronized by the peer virtualized network device is received, the candidate port connected to the received candidate port among the candidate ports determined by itself is finally determined as the communication port.
[0009] According to a second aspect of an embodiment of the present application, a port determination method is provided. The method is applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship. The method includes:
[0010] When the master device receives a notification message for notifying itself to determine a communication port for the virtualized network device to perform service communication with the peer virtualized network device, determining whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device;
[0011] When the judgment result is yes, determining a set number of candidate ports based on the device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the peer virtualized network device is located, the port status of each port, the aggregation capability information of each port, the aggregation capability information of the port connected to each port on the peer virtualized network device, and the identification information of each port corresponding to the dynamic aggregate link on the peer virtualized network device carried in the notification message, wherein the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device;
[0012] When receiving the candidate port determined by the master device in the opposite virtualized network device and synchronized from the master device in the opposite virtualized network device, the candidate port determined by itself is synchronized to the master device in the opposite virtualized network device, and the candidate port connected to the received candidate port among the candidate ports determined by itself is finally determined as the communication port.
[0013] According to a third aspect of an embodiment of the present application, a port determination device is provided, the device being applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship with each other, the device comprising:
[0014] a notification judgment module for, upon determining that it is necessary to actively determine, as a master device, a communication port for the virtualized network device to perform service communication with the peer virtualized network device, sending a notification message to the peer virtualized network device for notifying the master device in the peer virtualized network device to determine the communication port for the virtualized network device to perform service communication with the peer virtualized network device, and determining whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device;
[0015] a first determining module, configured to, when a judgment result of the notification judging module is yes, determine a set number of candidate ports based on a device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the opposite virtualized network device, a port state of each port, aggregation capability information of each port, aggregation capability information of a port on the opposite virtualized network device connected to each port, and identification information of each port, wherein the determined candidate ports do not include a port on the backup device connected to the opposite virtualized network device, and no data channel is established between the primary device and the backup device;
[0016] The second determination module is used to synchronize the determined candidate ports to the peer virtualized network device, and upon receiving the candidate ports determined by the master device in the peer virtualized network device and synchronized from the peer virtualized network device, finally determine the candidate ports connected to the received candidate ports among the candidate ports determined by itself as the communication port.
[0017] According to a fourth aspect of an embodiment of the present application, a port determination device is provided, the device being applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship with each other, the device comprising:
[0018] a determination module configured to determine, when serving as a master device and receiving a notification message for notifying itself to determine a communication port for business communication between the virtualized network device and the peer virtualized network device, whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device;
[0019] a first determining module, configured to, when a judgment result of the judging module is yes, determine a set number of candidate ports based on a device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the opposite virtualized network device on the virtualized network device is located, a port state of each port, aggregation capability information of each port, aggregation capability information of a port connected to each port on the opposite virtualized network device, and identification information of each port corresponding to the dynamic aggregate link on the opposite virtualized network device carried in the notification message, wherein the determined candidate ports do not include a port on the backup device connected to the opposite virtualized network device, and no data channel is established between the primary device and the backup device;
[0020] The second determination module is used to synchronize the candidate port determined by itself to the master device in the opposite virtualized network device when receiving the candidate port determined by the master device in the opposite virtualized network device synchronized by the master device in the opposite virtualized network device, and finally determine the candidate port connected to the received candidate port among the candidate ports determined by itself as the communication port.
[0021] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of any of the above-mentioned port determination methods.
[0022] According to a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the method steps of any of the above-mentioned port determination methods are implemented.
[0023] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0024] In an embodiment of the present application, for any one of two physical devices in a virtualized network device that is in a master-standby relationship with each other, when determining that the virtualized network device needs to serve as the master device to determine a communication port for business communication with a peer virtualized network device, if the physical device serving as the master device in the virtualized network device supports the function of not selecting a port on the backup device in the virtualized network device that is connected to the peer virtualized network device, then when determining the communication port for communication with the peer virtualized network device, the relevant port on the backup device will not be determined as the communication port. This eliminates the need to establish a data channel between the master and backup devices, saving port resources and bandwidth resources.
[0025] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0027] Figure 1 One of the flow charts of a port determination method provided in an embodiment of the present application;
[0028] Figure 2 A second flow chart of a port determination method provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the interaction between virtualized network device A and virtualized network device B provided in an embodiment of the present application;
[0030] Figure 4 This is one of the structural diagrams of a port determination device provided in an embodiment of the present application;
[0031] Figure 5 This is a second structural diagram of a port determination device provided in an embodiment of the present application;
[0032] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0034] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0035] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" or "if" as used herein may be interpreted as "when" or "when".
[0036] Next, the embodiments of the present application are described in detail.
[0037] The embodiment of the present application provides a port determination method, which is applied to any physical device in a virtualized network device having two physical devices in a master-slave relationship, such as Figure 1 As shown, the method may include the following steps:
[0038] S11. When it is determined that the master device needs to actively determine the communication port for business communication between the virtualized network device and the peer virtualized network device, a notification message is sent to the peer virtualized network device to notify the master device in the peer virtualized network device to determine the communication port for business communication between the peer virtualized network device and the peer virtualized network device, and it is determined whether the master device supports the function of not selecting the port on the backup device in the virtualized network device that is connected to the peer virtualized network device; when the judgment result is no, step S12 is executed; when the judgment result is yes, steps S13 and S14 are executed.
[0039] S12: Determine a communication port for performing service communication with the peer virtualized network device according to an existing port determination process.
[0040] S13. Determine a set number of candidate ports based on the device where each port corresponding to the dynamic aggregation link established between the virtualized network device and the peer virtualized network device is located, the port status of each port, the aggregation capability information of each port, the aggregation capability information of the port on the peer virtualized network device connected to each port, and the identification information of each port.
[0041] In this step, the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device.
[0042] In addition, the above-mentioned aggregation capability information is used to characterize the aggregation capability of the port. For example, the aggregation capability information may be an operation key.
[0043] S14. Synchronize the determined candidate ports to the peer virtualized network device, and upon receiving the candidate ports determined by the master device in the peer virtualized network device synchronized from the peer virtualized network device, finally determine the candidate ports connected to the received candidate ports among the candidate ports determined by itself as the communication port.
[0044] It should be noted that after executing the above step S14, the physical device uses the determined communication port to send a service message to the peer virtualized network device. The specific use process is existing technology and will not be described in detail here.
[0045] Specifically, in the above step S11, the physical device may determine the communication port that needs to be used as the master device to determine the virtualized network device for performing service communication with the peer virtualized network device in the following manner:
[0046] When it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when it is detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, and the port status of its own port connected to the opposite virtualized network device changes, or when it is detected that its own device role is upgraded from the backup device to the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when the preset period is reached after it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, it is determined that it is necessary to traverse all ports corresponding to the dynamic aggregated link between the virtualized network device and the opposite virtualized network device as the master device.
[0047] That is, in the embodiment of the present application, once any of the following situations occurs, the physical device needs to act as the master device to determine the communication port for the virtualized network device to perform service communication with the peer virtualized network device:
[0048] Scenario 1: The device role is detected as the primary device for the first time, and the device ID of the virtualized network device is determined to be smaller than the device ID of the peer virtualized network device.
[0049] The second scenario: the device role is detected as the master device, the device ID of the virtualized network device is determined to be smaller than the device ID of the peer virtualized network device, and the port status of the port connected to the peer virtualized network device changes;
[0050] Scenario 3: The device detects that its own device role has been upgraded from a backup device to a master device, and the device ID of the virtualized network device is smaller than the device ID of the peer virtualized network device.
[0051] A fourth scenario: after the device role of the virtualized network device is detected as the primary device for the first time, a preset period has passed, and it is determined that the device ID of the virtualized network device is smaller than the device ID of the peer virtualized network device.
[0052] It should be noted that the specific process of determining whether the device ID of the virtualized network device is smaller than the device ID of the peer virtualized network device is prior art and will not be described in detail here.
[0053] It should be further explained that the above-mentioned preset period can be set by an administrator based on the network experience of the network where the virtualized network device is located, and can be pre-configured on the virtualized network device.
[0054] It should be further explained that the virtualized network device and the peer virtualized network device may both be Intelligent Resilient Framework (IRF) devices.
[0055] Specifically, in the above step S13, the physical device determines a set number of candidate ports in the following manner:
[0056] Sort all ports in ascending order of their port numbers;
[0057] If there is no candidate port locally for the current port among the traversed sorted ports, then if the physical device where the current port is located is not a backup device and the port status of the current port is in the Up state, the current port is determined as a candidate port and the traversal continues to the next port;
[0058] If there is a candidate port locally, then when the physical device where the current port is located is not a backup device, the port state of the current port is UP, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as a candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal stops.
[0059] That is to say, for the physical device, for the current port among the sorted ports traversed, when there is a candidate port locally, the current port will be determined as a candidate port only when the physical device where the current port is located is not a backup device, the port status of the current port is in UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports does not reach the set number. In other cases except this, the current port will not be determined as a candidate port.
[0060] Here, the above-mentioned set number can be set by the administrator based on the network experience of the network where the virtualized network device is located, and can be set in advance on the physical device.
[0061] It should be noted that, in the application embodiment, after the physical device sends a notification message to the opposite virtualized network device to notify the master device in the opposite virtualized network device to determine the communication port for business communication between the opposite virtualized network device and the virtualized network device, for the opposite virtualized network device, it is possible that the physical device serving as the master device in the opposite virtualized network device directly receives the notification message, or it is possible that the physical device serving as the backup device in the opposite virtualized network device directly receives the notification message. In this case, the backup device in the opposite virtualized network device will forward the notification message to the master device in the opposite virtualized network device through the control channel established with the master device in the opposite virtualized network device.
[0062] Subsequently, if the master device in the peer virtualized network device does not support the function of not selecting the port on the backup device in the peer virtualized network device connected to the virtualized network device, the master device determines the candidate port according to the existing port candidate process.
[0063] In this case, a data channel is established between a physical device serving as a master device and a physical device serving as a backup device in the virtualized network device at the opposite end.
[0064] If the master device in the peer virtualized network device supports the function of not selecting the port on the backup device in the peer virtualized network device that is connected to the virtualized network device, the master device may perform the following operations to obtain a candidate port:
[0065] Sort all ports corresponding to the dynamic aggregate link on the peer virtual network device in ascending order of port numbers of all ports corresponding to the dynamic aggregate link on the virtual network device, wherein no data channel is established between a physical device serving as a master device and a physical device serving as a backup device in the peer virtual network device;
[0066] If there is no candidate port locally for the current port among the traversed sorted ports, then if the physical device where the current port is located is not a backup device and the port status of the current port is in the Up state, the current port is determined as a candidate port and the traversal continues to the next port;
[0067] If there is a candidate port locally, then when the physical device where the current port is located is not a backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device, and the total number of current candidate ports has not reached the set number, the current port will be determined as a candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal stops.
[0068] It should be further explained that, in the embodiment of the present application, the specific method in which the physical device sends the above-mentioned notification message is an existing technology and will not be described in detail here.
[0069] Here, the notification message may be a first Link Aggregation Control Protocol Data Unit (LACPDU) message.
[0070] It should be further explained that, in the above step S14, the physical device may send a second LACPDU message carrying the determined candidate port to the peer virtualized network device to synchronize the candidate port determined by the physical device.
[0071] Correspondingly, the master device in the opposite virtualized network device may also send a third LACPDU message carrying the determined candidate port to the virtualized network device to synchronize the candidate port determined by the master device.
[0072] The embodiment of the present application also provides a port determination method, which is applied to any physical device in a virtualized network device having two physical devices in a master-slave relationship, such as Figure 2 As shown, the method may include the following steps:
[0073] S21. When the master device receives a notification message for notifying itself to determine the communication port for business communication between the virtualized network device and the peer virtualized network device, it determines whether it supports the function of not selecting the port on the backup device in the virtualized network device that is connected to the peer virtualized network device; when the judgment result is no, execute step S22; when the judgment result is yes, execute steps S23 and S24.
[0074] In this step, the notification message is sent by the master device in the opposite virtualized network device when it determines that it needs to act as the master device to actively determine the communication port for the virtualized network device to communicate with the opposite virtualized network device for business, or the notification message is forwarded by the backup device in the virtualized network device when it receives the notification message sent by the master device in the opposite virtualized network device.
[0075] S22: Determine a communication port for performing service communication with the peer virtualized network device according to an existing port determination process.
[0076] S23. Determine a set number of candidate ports based on the device where each port corresponding to the dynamic aggregation link established between the virtualized network device and the peer virtualized network device is located, the port status of each port, the aggregation capability information of each port, the aggregation capability information of the port on the peer virtualized network device connected to each port, and the identification information of each port corresponding to the dynamic aggregation link on the peer virtualized network device carried in the notification message.
[0077] In this step, the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device.
[0078] S24. When receiving the candidate port determined by the master device in the opposite virtualized network device and synchronized from the master device in the opposite virtualized network device, synchronize the candidate port determined by itself to the master device in the opposite virtualized network device, and finally determine the candidate port connected to the received candidate port among the candidate ports determined by itself as the communication port.
[0079] It should be noted that after executing the above step S24, the physical device uses the determined communication port to send a service message to the peer virtualized network device. The specific use process is existing technology and will not be described in detail here.
[0080] Specifically, the physical device may determine a set number of candidate ports in the following manner:
[0081] Sort all ports corresponding to the dynamic aggregate link on the virtualized network device on the opposite end in ascending order of port numbers of all ports corresponding to the dynamic aggregate link on the virtualized network device;
[0082] If there is no candidate port locally for the current port among the traversed sorted ports, then if the physical device where the current port is located is not a backup device and the port status of the current port is in the Up state, the current port is determined as a candidate port and the traversal continues to the next port;
[0083] If there is a candidate port locally, then when the physical device where the current port is located is not a backup device, the port state of the current port is UP, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as a candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal stops.
[0084] Here, the above-mentioned set number can be set by the administrator based on the network experience of the network where the virtualized network device is located, and configured in advance on the virtualized network device.
[0085] It should be noted that the virtualized network device and the peer virtualized network device may both be Intelligent Resilient Framework (IRF) devices.
[0086] It should be further explained that, in the application embodiment, the processing flow of the peer virtualized network device after sending the above notification message has been explained in the description of the implementation process of the previous port determination method, and will not be described in detail here.
[0087] The above port determination method is described in detail below with reference to specific embodiments.
[0088] like Figure 3As shown, in a network configuration, only virtualized network device A, virtualized network device B, and network device C are shown. This network configuration also includes other network devices not shown. Assume that virtualized network device A is configured with physical devices A1 and A2, and that physical devices A1 and A2 can each function as a primary and backup for each other, and that no data channel is established between physical devices A1 and A2; and that virtualized network device B is configured with physical devices B1 and B2, and that physical devices B1 and B2 can each function as a primary and backup for each other, and that no data channel is established between physical devices B1 and B2.
[0089] Assume that the device ID of virtualized network device A is smaller than that of virtualized network device B, and a dynamic aggregate link is established between virtualized network devices A and B. On virtualized network device A, the ports corresponding to the dynamic aggregate link are Port_A1, Port_A2, Port_A3, and Port_A4. On virtualized network device B, the ports corresponding to the dynamic aggregate link are Port_B1, Port_B2, Port_B3, and Port_B4.
[0090] Taking physical device A1 as an example, assuming that it is detected for the first time that its own device role is the master device, and it is determined that the device ID of virtualized network device A is smaller than the device ID of virtualized network device B, at this time, it is determined that it needs to actively determine the communication port for business communication between virtualized network device A and virtualized network device B as the master device, and send a notification message 1 to virtualized network device B to notify the master device in virtualized network device B (for example, physical device B1) to determine the communication port for business communication between virtualized network device A and virtualized network device B, and determine whether it supports the function of not selecting the port on the backup device in the virtualized network device that is connected to the opposite virtualized network device.
[0091] Here, the notification message 1 may carry at least the device ID of the virtualized network device A and the port numbers of all ports on the virtualized network device A corresponding to the dynamic aggregate link established between the virtualized network device A and the peer virtualized network device B.
[0092] Assuming the judgment result is yes, at this time, physical device A1 sorts all ports (i.e., Port_A1, Port_A2, Port_A3 and Port_A4) corresponding to the dynamic aggregate link established between virtualized network device A and the peer virtualized network device B on virtualized network device A in ascending order according to the port numbers.
[0093] Assume that the sorted ports are Port_A3, Port_A4, Port_A1, and Port_A2. Then, physical device A1 starts to traverse the first sorted port (i.e., Port_A3). Currently, there is no candidate port locally, but the physical device where Port_A3 is located is a backup device. At this time, physical device A1 does not determine Port_A3 as a candidate port.
[0094] The second port (ie, Port_A4) after sorting is traversed continuously. Currently, there is no candidate port locally, but the physical device where Port_A4 is located is a backup device. At this time, physical device A1 does not determine Port_A4 as a candidate port.
[0095] Continuing to traverse the third port after sorting (i.e., Port_A1), there is currently no candidate port locally. Assuming that the port status of Port_A1 is UP, then, if the physical device where Port_A1 is located is not a backup device and the port status of Port_A1 is UP, physical device A1 determines Port_A1 as a candidate port.
[0096] Continue to traverse the fourth port after sorting (i.e., Port_A2). There is currently a candidate port. Assume that the port state of Port_A2 is UP, the aggregation capability information of Port_A2 is the same as the aggregation capability information of the last determined candidate port (i.e., Port_A1), Port_A2 and the last determined candidate port are located on the same hardware chip, and the aggregation capability information of Port_A2 is the same as the aggregation capability information of the port connected to Port_A2 on the virtualized network device B (i.e., Port_B2). Then, on the physical device where Port_A2 is located, Physical device A1 determines Port_A2 as a candidate port if it is not a backup device, Port_A2 is in the UP state, the aggregation capability information of Port_A2 is the same as the aggregation capability information of the previously determined candidate port (i.e., Port_A1), Port_A2 and the previously determined candidate port are located on the same hardware chip, the aggregation capability information of Port_A2 is the same as the aggregation capability information of the port connected to Port_A2 on virtualized network device B (i.e., Port_B2), and the total number of current candidate ports (i.e., 1) does not reach 2.
[0097] Accordingly, it is assumed that the physical device B1 in the virtualized network device B directly receives the notification message 1 and determines whether it supports the function of not selecting the port on the backup device in the virtualized network device B that is connected to the virtualized network device A.
[0098] Assuming the result of the judgment is yes, physical device B1 then sorts all ports (i.e., Port_B1, Port_B2, Port_B3, and Port_B4) on virtualized network device B corresponding to the dynamic aggregate link established between virtualized network device A and peer virtualized network device B, in ascending order according to the port numbers of all ports (i.e., Port_A1, Port_A2, Port_A3, and Port_A4) on virtualized network device A corresponding to the dynamic aggregate link established between virtualized network device A and peer virtualized network device B, as carried in notification message 1. That is, the sorted ports are Port_B3, Port_B4, Port_B1, and Port_B2, with the order of these ports being the same as the order of Port_A1, Port_A2, Port_A3, and Port_A4.
[0099] Physical device B starts to traverse the first port (ie, Port_B3) after sorting. Currently, there is no candidate port locally, but the physical device where Port_B3 is located is a backup device. At this time, physical device B does not determine Port_B3 as a candidate port.
[0100] The second port (ie, Port_B4) after sorting is traversed continuously. Currently, there is no candidate port locally, but the physical device where Port_B4 is located is a backup device. At this time, physical device B does not determine Port_B4 as a candidate port.
[0101] Continuing to traverse the third port after sorting (i.e., Port_B1), there is currently no candidate port locally. Assuming that the port status of Port_B1 is UP, then, if the physical device where Port_B1 is located is not a backup device and the port status of Port_B1 is UP, physical device B determines Port_B1 as a candidate port.
[0102] Continue to traverse the fourth port after sorting (i.e., Port_B2). Currently, there is a candidate port. Assume that the port status of Port_B2 is UP, the aggregation capability information of Port_B2 is the same as the aggregation capability information of the last determined candidate port (i.e., Port_B1), Port_B2 and the last determined candidate port are located on the same hardware chip, and the aggregation capability information of Port_B2 is the same as the aggregation capability information of the port connected to Port_B2 on the virtualized network device B (i.e., Port_B2). Then, on the physical device where Port_B2 is located, If it is not a backup device, the port status of Port_B2 is UP, the aggregation capability information of Port_B2 is the same as the aggregation capability information of the last determined candidate port (i.e., Port_B1), Port_B2 and the last determined candidate port are located on the same hardware chip, the aggregation capability information of Port_B2 is the same as the aggregation capability information of the port connected to Port_B2 on the virtualized network device B (i.e., Port_B2), and the total number of current candidate ports (i.e., 1) does not reach 2, the physical device B determines Port_B2 as a candidate port.
[0103] Subsequently, physical device A1 synchronizes the determined candidate ports (i.e., Port_A1 and Port_A2) to virtualized network device B, and upon receiving the candidate ports (i.e., Port_B1 and Port_B2) determined by the master device (i.e., physical device B1) in virtualized network device B synchronized from virtualized network device B, physical device A1 ultimately determines the candidate ports among its own determined candidate ports that are connected to the received candidate ports as communication ports. That is, physical device A1 ultimately determines Port_A1 and Port_A2 as communication ports.
[0104] In an example, the physical device A1 may use one of the determined communication ports to send a service message to the virtualized network device B, and the virtualized network device B may send the message to the network device C for processing.
[0105] Correspondingly, when physical device B receives the candidate ports (i.e., Port_A1 and Port_A2) determined by the master device in virtualized network device A (i.e., physical device A1) synchronized from virtualized network device A, it ultimately determines the candidate ports among its own determined candidate ports that are connected to the received candidate ports as communication ports. That is, physical device B1 ultimately determines Port_B1 and Port_B2 as communication ports.
[0106] As can be seen from the above technical solution, in the embodiments of the present application, for any one of the two physical devices in a virtualized network device that is in a master-standby relationship with each other, when it is determined that the virtualized network device needs to serve as the master device to determine the communication port for business communication with the other virtualized network device, if the physical device serving as the master device in the virtualized network device supports the function of not selecting the port on the backup device in the virtualized network device that is connected to the other virtualized network device, then when determining the communication port for communication with the other virtualized network device, the relevant port on the backup device will not be determined as the communication port. This eliminates the need to establish a data channel between the master and backup devices, saving port resources and bandwidth resources.
[0107] Based on the same inventive concept, the present application also provides a port determination device, which is applied to any physical device in a virtualized network device having two physical devices in a master-slave relationship. Figure 4 As shown, specifically including:
[0108] a notification determination module 41 configured to, upon determining that it is necessary for the master device to actively determine the communication port for the virtualized network device to perform service communication with the peer virtualized network device, send a notification message to the peer virtualized network device to notify the master device in the peer virtualized network device to determine the communication port for the virtualized network device to perform service communication with the peer virtualized network device, and determine whether the master device supports a function of not selecting the port on the backup device in the virtualized network device that is connected to the peer virtualized network device;
[0109] a first determining module 42 configured to, when the determination result of the notification determining module 41 is yes, determine a set number of candidate ports based on the device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the peer virtualized network device is located, the port state of each port, the aggregation capability information of each port, the aggregation capability information of the port on the peer virtualized network device connected to each port, and the identification information of each port, wherein the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device;
[0110] The second determination module 43 is configured to synchronize the determined candidate ports to the peer virtualized network device, and upon receiving the candidate ports determined by the master device in the peer virtualized network device and synchronized from the peer virtualized network device, finally determine the candidate ports among the candidate ports determined by itself that are connected to the received candidate ports as the communication ports.
[0111] Preferably, the notification judgment module 41 is specifically configured to determine the communication port that needs to be used as the master device to perform service communication between the virtualized network device and the peer virtualized network device by:
[0112] When it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when it is detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, and the port status of its own port connected to the opposite virtualized network device changes, or when it is detected that its own device role is upgraded from a backup device to a master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when a preset period is reached after it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, it is determined that it is necessary to traverse all ports corresponding to the dynamic aggregated link between the virtualized network device and the opposite virtualized network device as the master device.
[0113] Preferably, the first determining module 42 is specifically configured to determine a set number of candidate ports by:
[0114] Sort all ports in ascending order of their port numbers;
[0115] For the current port among the traversed sorted ports, if there is no candidate port locally, then if the physical device where the current port is located is not the backup device and the port status of the current port is in the UP state, the current port is determined as a candidate port, and the traversal continues to the next port;
[0116] If there is a candidate port locally, then when the physical device where the current port is located is not the backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as the candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal is stopped.
[0117] The present application also provides a port determination device, which is applied to any physical device in a virtualized network device having two physical devices in a master-slave relationship. Figure 5As shown, specifically including:
[0118] a determination module 51 configured to, upon receiving as a master device a notification message for notifying itself to determine a communication port for service communication between the virtualized network device and the peer virtualized network device, determine whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device;
[0119] a first determining module 52 configured to, when the judgment result of the judging module 51 is yes, determine a set number of candidate ports based on the device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the peer virtualized network device is located, the port state of each port, the aggregation capability information of each port, the aggregation capability information of the port connected to each port on the peer virtualized network device, and the identification information of each port corresponding to the dynamic aggregate link on the peer virtualized network device carried in the notification message, wherein the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device;
[0120] The second determination module 53 is used to synchronize the candidate port determined by itself to the master device in the peer virtualized network device when receiving the candidate port determined by the master device in the peer virtualized network device synchronized by the master device in the peer virtualized network device, and finally determine the candidate port connected to the received candidate port among the candidate ports determined by itself as the communication port.
[0121] Preferably, the first determining module 52 is specifically configured to determine a set number of candidate ports by:
[0122] sorting all ports corresponding to the dynamic aggregate link on the virtualized network device according to the port numbers of all ports corresponding to the dynamic aggregate link on the peer virtualized network device in ascending order;
[0123] For the current port among the traversed sorted ports, if there is no candidate port locally, then if the physical device where the current port is located is not the backup device and the port status of the current port is in the UP state, the current port is determined as a candidate port, and the traversal continues to the next port;
[0124] If there is a candidate port locally, then when the physical device where the current port is located is not the backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as the candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal is stopped.
[0125] As can be seen from the above technical solution, in the embodiments of the present application, for any one of the two physical devices in a virtualized network device that is in a master-standby relationship with each other, when it is determined that the virtualized network device needs to serve as the master device to determine the communication port for business communication with the other virtualized network device, if the physical device serving as the master device in the virtualized network device supports the function of not selecting the port on the backup device in the virtualized network device that is connected to the other virtualized network device, then when determining the communication port for communication with the other virtualized network device, the relevant port on the backup device will not be determined as the communication port. This eliminates the need to establish a data channel between the master and backup devices, saving port resources and bandwidth resources.
[0126] The present application also provides an electronic device, such as Figure 6 As shown, it includes a processor 61 and a machine-readable storage medium 62, wherein the machine-readable storage medium 62 stores machine-executable instructions that can be executed by the processor 61, and the processor 61 is prompted by the machine-executable instructions to implement the steps of any port determination method.
[0127] The machine-readable storage medium may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, the machine-readable storage medium may be at least one storage device located remote from the processor.
[0128] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0129] In another embodiment provided by the present application, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the steps of any of the above-mentioned port determination methods are implemented.
[0130] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A port determination method, characterized in that: The method is applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship with each other, and the method includes: When determining that it is necessary to actively determine, as a master device, a communication port for the virtualized network device to perform service communication with the peer virtualized network device, sending a notification message to the peer virtualized network device for notifying the master device in the peer virtualized network device to determine the communication port for the peer virtualized network device to perform service communication with the virtualized network device, and determining whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device; When the judgment result is yes, determining a set number of candidate ports based on the device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the peer virtualized network device is located, the port state of each port, the aggregation capability information of each port, the aggregation capability information of the port on the peer virtualized network device connected to each port, and the identification information of each port, wherein the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device; The determined candidate port is synchronized to the peer virtualized network device, and when the candidate port determined by the master device in the peer virtualized network device and synchronized by the peer virtualized network device is received, the candidate port connected to the received candidate port among the candidate ports determined by itself is finally determined as the communication port.
2. The method according to claim 1, characterized in that The communication port for the virtualized network device to perform service communication with the peer virtualized network device is determined as the master device in the following manner: When it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when it is detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, and the port status of its own port connected to the opposite virtualized network device changes, or when it is detected that its own device role is upgraded from a backup device to a master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when a preset period is reached after it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, it is determined that it is necessary to traverse all ports corresponding to the dynamic aggregated link between the virtualized network device and the opposite virtualized network device as the master device.
3. The method according to claim 1, characterized in that The set number of candidate ports is determined in the following way: Sort all ports in ascending order of their port numbers; For the current port among the traversed sorted ports, if there is no candidate port locally, then if the physical device where the current port is located is not the backup device and the port status of the current port is in the UP state, the current port is determined as a candidate port, and the traversal continues to the next port; If there is a candidate port locally, then when the physical device where the current port is located is not the backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as the candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal is stopped.
4. A port determination method, characterized in that: The method is applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship with each other, and the method includes: When the master device receives a notification message for notifying itself to determine a communication port for the virtualized network device to perform service communication with the peer virtualized network device, determining whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device; When the judgment result is yes, determining a set number of candidate ports based on the device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the peer virtualized network device is located, the port status of each port, the aggregation capability information of each port, the aggregation capability information of the port connected to each port on the peer virtualized network device, and the identification information of each port corresponding to the dynamic aggregate link on the peer virtualized network device carried in the notification message, wherein the determined candidate ports do not include the port on the backup device connected to the peer virtualized network device, and no data channel is established between the primary device and the backup device; When receiving the candidate port determined by the master device in the opposite virtualized network device and synchronized from the master device in the opposite virtualized network device, the candidate port determined by itself is synchronized to the master device in the opposite virtualized network device, and the candidate port connected to the received candidate port among the candidate ports determined by itself is finally determined as the communication port.
5. The method according to claim 4, characterized in that The set number of candidate ports is determined in the following way: sorting all ports corresponding to the dynamic aggregate link on the virtualized network device according to the port numbers of all ports corresponding to the dynamic aggregate link on the peer virtualized network device in ascending order; For the current port among the traversed sorted ports, if there is no candidate port locally, then if the physical device where the current port is located is not the backup device and the port status of the current port is in the UP state, the current port is determined as a candidate port, and the traversal continues to the next port; If there is a candidate port locally, then when the physical device where the current port is located is not the backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as the candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal is stopped.
6. A port determination device, characterized in that: The device is applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship, and the device includes: a notification judgment module for, upon determining that it is necessary to actively determine, as a master device, a communication port for the virtualized network device to perform service communication with the peer virtualized network device, sending a notification message to the peer virtualized network device for notifying the master device in the peer virtualized network device to determine the communication port for the virtualized network device to perform service communication with the peer virtualized network device, and determining whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device; a first determining module, configured to, when a judgment result of the notification judging module is yes, determine a set number of candidate ports based on a device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the opposite virtualized network device, a port state of each port, aggregation capability information of each port, aggregation capability information of a port on the opposite virtualized network device connected to each port, and identification information of each port, wherein the determined candidate ports do not include a port on the backup device connected to the opposite virtualized network device, and no data channel is established between the primary device and the backup device; The second determination module is used to synchronize the determined candidate ports to the peer virtualized network device, and upon receiving the candidate ports determined by the master device in the peer virtualized network device and synchronized from the peer virtualized network device, finally determine the candidate ports connected to the received candidate ports among the candidate ports determined by itself as the communication port.
7. The device according to claim 6, characterized in that The notification judgment module is specifically configured to determine the communication port that needs to be used as the master device to perform service communication between the virtualized network device and the peer virtualized network device in the following manner: When it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when it is detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, and the port status of its own port connected to the opposite virtualized network device changes, or when it is detected that its own device role is upgraded from a backup device to a master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, or when a preset period is reached after it is first detected that its own device role is the master device and it is determined that the device ID of the virtualized network device is smaller than the device ID of the opposite virtualized network device, it is determined that it is necessary to traverse all ports corresponding to the dynamic aggregated link between the virtualized network device and the opposite virtualized network device as the master device.
8. The device according to claim 6, characterized in that The first determining module is specifically configured to determine a set number of candidate ports by: Sort all ports in ascending order of their port numbers; For the current port among the traversed sorted ports, if there is no candidate port locally, then if the physical device where the current port is located is not the backup device and the port status of the current port is in the UP state, the current port is determined as a candidate port, and the traversal continues to the next port; If there is a candidate port locally, then when the physical device where the current port is located is not the backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as the candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal is stopped.
9. A port determination device, characterized in that: The device is applied to any physical device in a virtualized network device having two physical devices in a master-standby relationship, and the device includes: a determination module configured to determine, when serving as a master device and receiving a notification message for notifying itself to determine a communication port for business communication between the virtualized network device and the peer virtualized network device, whether the master device supports a function of not selecting a port on a backup device in the virtualized network device that is connected to the peer virtualized network device; a first determining module, configured to, when a judgment result of the judging module is yes, determine a set number of candidate ports based on a device where each port corresponding to the dynamic aggregate link established between the virtualized network device and the opposite virtualized network device on the virtualized network device is located, a port state of each port, aggregation capability information of each port, aggregation capability information of a port connected to each port on the opposite virtualized network device, and identification information of each port corresponding to the dynamic aggregate link on the opposite virtualized network device carried in the notification message, wherein the determined candidate ports do not include a port on the backup device connected to the opposite virtualized network device, and no data channel is established between the primary device and the backup device; The second determination module is used to synchronize the candidate port determined by itself to the master device in the opposite virtualized network device when receiving the candidate port determined by the master device in the opposite virtualized network device synchronized by the master device in the opposite virtualized network device, and finally determine the candidate port connected to the received candidate port among the candidate ports determined by itself as the communication port.
10. The device according to claim 9, characterized in that The first determining module is specifically configured to determine a set number of candidate ports by: sorting all ports corresponding to the dynamic aggregate link on the virtualized network device according to the port numbers of all ports corresponding to the dynamic aggregate link on the peer virtualized network device in ascending order; For the current port among the traversed sorted ports, if there is no candidate port locally, then if the physical device where the current port is located is not the backup device and the port status of the current port is in the UP state, the current port is determined as a candidate port, and the traversal continues to the next port; If there is a candidate port locally, then when the physical device where the current port is located is not the backup device, the port state of the current port is in the UP state, the aggregation capability information of the current port is the same as the aggregation capability information of the candidate port determined last time, the current port and the candidate port determined last time are located on the same hardware chip, the aggregation capability information of the current port is the same as the aggregation capability information of the port connected to the current port on the virtualized network device at the opposite end, and the total number of current candidate ports has not reached the set number, the current port will be determined as the candidate port, and the traversal will continue to the next port until the total number of determined candidate ports reaches the set number and the traversal is stopped.
11. An electronic device, characterized in that: The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of any one of claims 1-3 or 4-5.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method steps of any one of claims 1-3 or 4-5.
Citation Information
Patent Citations
Member port selecting method and device
CN108600100A
Equipment virtualization method, device, system, equipment and storage medium
CN112751755A