Method, device, equipment, medium and program product for identifying uplink relay port
Through switch port configuration information filtering and VLAN-ID analysis, uplink relay ports are identified, solving the problems of identification errors and information acquisition difficulties in the existing technology, improving identification accuracy and efficiency, and supporting efficient troubleshooting of private dedicated lines and faults .
Patent Information
- Application Number
- CN202210948752.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-08-09
AI Technical Summary
The existing technology is difficult to accurately identify uplink relay ports, resulting in port identification errors and difficulty in obtaining information, affecting the efficiency of private dedicated lines and troubleshooting.
By obtaining the configuration information of the switch port, filtering ports with encapsulation type Trunk or Hybrid as pseudo-relay ports, and analyzing them based on VLAN-ID to identify the uplink relay ports to improve identification accuracy.
It improves the identification accuracy and efficiency of uplink relay ports, simplifies private dedicated line troubleshooting and troubleshooting, and reduces economic losses and business impact.
Smart Images

Figure CN115426326B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, device, equipment, medium and program product for identifying an uplink relay port. Background Art
[0002] The IP data network is an open network. Whether the device port of the switch is connected to the operator's equipment or the customer's equipment, that is, whether the device port of the switch is an upstream relay port or a downstream service port, is currently mainly identified by manually configured port descriptions and the IP information of the peer device obtained by the LLDP protocol (Link Layer Discovery Protocol) enabled on some device ports.
[0003] However, due to the low accuracy of manually configured port descriptions and the limitations of using the LLDP protocol to obtain the IP information of the peer device, the upstream relay port is difficult to be identified efficiently, and there are defects such as incorrect port identification or difficulty in obtaining the information required for port identification. Summary of the invention
[0004] In view of the above problems, embodiments of the present application provide a method, apparatus, device, medium and program product for identifying an uplink relay port, so as to overcome the above problems or at least partially solve the above problems.
[0005] According to a first aspect of an embodiment of the present application, a method for identifying an uplink relay port is provided, comprising:
[0006] Obtain the configuration information of each port of the switch. The configuration information of a port includes: the encapsulation type of the port and the VLAN-ID configured for the port;
[0007] Determine the port with Trunk or Hybrid encapsulation type as a pseudo trunk port;
[0008] According to the VLAN-ID configured for the pseudo relay port, an uplink relay port is identified from the pseudo relay port, and the uplink relay port is used for the switch to communicate with a network interconnection device.
[0009] Optionally, it also includes:
[0010] In the case that there is a port whose encapsulation type is Access among the ports, the port whose encapsulation type is Access and which communicates with the network interconnection device through an uplink relay port is determined as a non-relay port;
[0011] From the set of VLAN-IDs configured for the pseudo trunk port, remove the VLAN-IDs configured for the non-trunk port to obtain a set of target VLAN-IDs;
[0012] In the case that the non-relay port does not exist in each of the ports, the set of VLAN-IDs configured for the pseudo-relay port is the set of the target VLAN-IDs;
[0013] The step of identifying an uplink trunk port from the pseudo trunk port according to the VLAN-ID configured for the pseudo trunk port includes:
[0014] In the case that there is no repeated target VLAN-ID in the target VLAN-ID set, the ports corresponding to the respective target VLAN-IDs in the target VLAN-ID set are all determined as uplink trunk ports.
[0015] Optionally, it also includes:
[0016] In the case where there are repeated target VLAN-IDs in the set of target VLAN-IDs, all ports corresponding to non-repeated target VLAN-IDs in the set of target VLAN-IDs are determined as uplink trunk ports;
[0017] For each repeated VLAN-ID in the target VLAN-ID set, port traffic analysis is performed on all pseudo trunk ports configured with the repeated VLAN-ID, thereby determining an uplink trunk port.
[0018] Optionally, for each repeated VLAN-ID in the set of target VLAN-IDs, performing port traffic analysis on all pseudo trunk ports configured with the repeated VLAN-ID to thereby determine an uplink trunk port includes:
[0019] Obtaining the real-time traffic of each of all pseudo trunk ports configured with the repeated VLAN-ID;
[0020] Among all pseudo trunk ports configured with the repeated VLAN-ID, the pseudo trunk port with the largest real-time traffic is determined as the uplink trunk port.
[0021] Optionally, it also includes:
[0022] Obtain the number of the pseudo relay ports;
[0023] Detecting whether the number of the pseudo relay ports is equal to 1;
[0024] When the number of the pseudo relay ports is equal to 1, determining the pseudo relay port as an uplink relay port;
[0025] The step of identifying an uplink trunk port from the pseudo trunk port according to the VLAN-ID configured for the pseudo trunk port includes:
[0026] When the number of the pseudo relay ports is not equal to 1, an uplink relay port is identified from the pseudo relay ports according to the VLAN-ID configured for the pseudo relay ports.
[0027] Optionally, the obtaining configuration information of each port of the switch includes:
[0028] Obtaining configuration information of each of the ports of the switch whose physical state is a connected state;
[0029] Also includes:
[0030] According to the uplink relay port, a downstream service port is identified from each port of the switch whose port physical status is a connected state.
[0031] According to a second aspect of an embodiment of the present application, a device for identifying an uplink relay port is provided, including:
[0032] The acquisition module is used to acquire the configuration information of each port of the switch. The configuration information of a port includes: the encapsulation type of the port and the VLAN-ID configured for the port;
[0033] A processing module, used for determining a port whose encapsulation type is Trunk or Hybrid as a pseudo trunk port;
[0034] The identification module is used to identify an uplink relay port from the pseudo relay port according to the VLAN-ID configured by the pseudo relay port, and the uplink relay port is used for the switch to communicate with the network interconnection device.
[0035] According to a third aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method for identifying an uplink relay port as disclosed in an embodiment of the present application.
[0036] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method for identifying an uplink relay port as disclosed in the embodiments of the present application is implemented.
[0037] According to a fourth aspect of the embodiments of the present application, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the method for identifying an uplink relay port as disclosed in the embodiments of the present application.
[0038] The embodiments of the present application include the following advantages:
[0039] In this embodiment, the configuration information of each port on the switch is collected to identify the uplink trunk port, so that the information required for identifying the port is easier to obtain, and the pseudo trunk port suspected to be the uplink trunk port is identified according to the encapsulation type in the configuration information, and then the pseudo trunk port is further analyzed through the VLAN-ID in the configuration information to identify the uplink trunk port, which can improve the accuracy of identifying the uplink trunk port, thereby achieving efficient identification of the uplink trunk port. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 is a flowchart of the steps of a method for identifying an uplink relay port in an embodiment of the present application;
[0042] Figure 2 It is a schematic diagram of the structure of a device port of a switch according to an embodiment of the present application;
[0043] Figure 3 is a flowchart of another method for identifying an uplink relay port in an embodiment of the present application;
[0044] Figure 4 It is a structural schematic diagram of a device for identifying an uplink relay port according to an embodiment of the present application;
[0045] Figure 5 It is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0047] At present, due to the motivation of interests, it is not uncommon to illegally open dedicated lines. A privately opened dedicated line will cause great economic losses and business development losses to enterprises. In order to reduce the occurrence of this situation, various operators have repeatedly carried out rectification actions for privately opened dedicated lines. When troubleshooting the problem of illegal private opening, it is necessary to first identify the uplink relay port in the device port of the switch, and then analyze the other ports of the device after excluding the uplink relay port. Therefore, whether the uplink relay port can be accurately identified is of great significance for the efficient troubleshooting of illegal private opening. In addition, whether the uplink relay port can be accurately identified is also of great significance for troubleshooting the uplink relay port (such as troubleshooting of group faults) or troubleshooting other ports (i.e., downlink service ports) except the uplink relay port.
[0048] The IP data network is an open network that enables IP devices to interconnect with a variety of devices. When the device port of the switch is connected to the operator's equipment (i.e., network interconnection equipment), the device port is the uplink relay port; when the device port of the switch is connected to the client's equipment, the device port is the downlink service port.
[0049] At present, the identification of uplink relay ports mainly relies on the description of manual configuration on the device port and the LLDP protocol enabled on some device ports. However, the manually configured port description is inaccurate, which is not conducive to the accurate identification of the uplink relay port. The existing uplink relay port identification method using the LLDP protocol also has limitations.
[0050] Specifically, when using the LLDP protocol to identify the uplink relay port, in order to obtain the device IP information of the peer device of this device, all ports of this device and the ports of the peer device need to be configured with the LLDP protocol, and the operator must have the device IP information of the entire network, which is used to compare with the device IP information of the peer device discovered by the LLDP protocol, so as to determine whether the port on this device connected to the peer device is an uplink relay port. Therefore, the uplink relay port identification method using the LLDP protocol needs to obtain the device IP information of the entire network, and needs to configure the LLDP protocol to collect the device IP information of the peer device port, which makes the acquisition of the information required for the uplink relay port identification more cumbersome, so that the uplink relay port identification method based on the LLDP protocol has great application limitations.
[0051] In view of the fact that the current uplink relay port cannot be efficiently identified, there are defects such as incorrect port identification and difficulty in obtaining the information required for port identification, which is not conducive to the timely opening of private lines and troubleshooting of faults, this application proposes a solution for identifying the uplink relay port based on the port configuration information of the switch.
[0052] The present application embodiment provides a method for identifying an uplink relay port, referring to Figure 1 As shown, a flowchart of a method for identifying an uplink relay port in an embodiment of the present application is shown. Figure 1 As shown, the method for identifying an uplink trunk port includes the following steps:
[0053] Step S11: Obtain configuration information of each port of the switch. The configuration information of a port includes: the encapsulation type of the port and the VLAN-ID configured for the port.
[0054] It should be noted that VLAN-ID is the identifier of VLAN (Virtual Local Area Network). Different VLAN-IDs correspond to different VLANs. By configuring different VLAN-IDs for each port, the peer-connected devices of each port can be placed in different VLANs. Since the peer-connected devices in different VLANs cannot communicate directly through the data link layer, the transmission range of broadcast messages can be effectively limited, thereby limiting broadcast storms.
[0055] In an IP data network, the port configuration information of a switch is common data and is easy to obtain. For example, the configuration information of each port on the switch can be directly obtained through the network management function provided by the switch itself, such as the Simple Network Management Protocol (SNMP) embedded in the switch.
[0056] Optionally, in one embodiment, the process of obtaining the configuration information of each port of the switch includes:
[0057] The configuration information of each of the ports whose physical status is a connected status among all the ports of the switch is obtained.
[0058] Among them, the port physical state is UP (i.e. connected state), which means that there is line access at the port, that is, the port can receive matching physical signals (electrical signals or optical signals) for data communication. Considering that both the uplink relay port and the downlink service port are ports in the connected state, the ports of the switch are screened according to the port physical state, and the uplink relay port is identified for the ports in the connected state, which can improve the identification efficiency.
[0059] Step S12: Determine the port whose encapsulation type is Trunk or Hybrid as a pseudo trunk port.
[0060] It is understandable that, according to the port configuration mode of the switch, the port can be divided into three encapsulation types: Trunk, Hybrid, and Access. Trunk ports and Hybrid ports are ports in the switch that allow multiple VLANs to pass through, and both can work as uplink trunk ports. Therefore, by analyzing the encapsulation type of the port, pseudo trunk ports suspected of being uplink trunk ports can be quickly screened out from multiple ports of the switch, thereby further improving the efficiency of identifying uplink trunk ports.
[0061] Step S13: according to the VLAN-ID configured for the pseudo relay port, an uplink relay port is identified from the pseudo relay port, and the uplink relay port is used for the switch to communicate with a network interconnection device.
[0062] The network interconnection equipment may be a router, a gateway or other equipment used to achieve mutual access and communication between different networks.
[0063] By adopting the technical solution of the embodiment of the present application, by collecting the configuration information (VLAN-ID and encapsulation type) of each port of the switch, it is beneficial to realize automatic analysis and judgment of the uplink relay port in the IP data network scenario, thereby improving the accuracy of identifying the uplink relay port in the IP device, and the port configuration information is easy to obtain, and there is no need to perform additional settings for the opposite connection device of the port (such as setting the LLDP protocol), so that the uplink relay port identification method provided in the embodiment of the present application is easier to implement, thereby laying the foundation for the identification of the downstream service port, and can effectively combat the illegal behavior of opening private dedicated lines and shorten the troubleshooting time.
[0064] Optionally, in one embodiment, the method further comprises:
[0065] In the case that there is a port whose encapsulation type is Access among the ports, the port whose encapsulation type is Access and which communicates with the network interconnection device through an uplink relay port is determined as a non-relay port;
[0066] From the set of VLAN-IDs configured for the pseudo trunk port, remove the VLAN-IDs configured for the non-trunk port to obtain a set of target VLAN-IDs;
[0067] In the case that the non-relay port does not exist in each of the ports, the set of VLAN-IDs configured for the pseudo-relay port is the set of the target VLAN-IDs;
[0068] The step of identifying an uplink trunk port from the pseudo trunk port according to the VLAN-ID configured for the pseudo trunk port includes:
[0069] In the case that there is no repeated target VLAN-ID in the target VLAN-ID set, the ports corresponding to the respective target VLAN-IDs in the target VLAN-ID set are all determined as uplink trunk ports.
[0070] It is understandable that since the Access port only allows a single VLAN to pass through, it cannot meet the requirement of the upstream trunk port to transparently transmit data packets under multiple VLANs. Therefore, the Access port is mainly used as a downstream service port and cannot be used as an upstream trunk port.
[0071] like Figure 2 The figure shows a schematic diagram of the structure of the device port of the switch, which is used to illustrate the port configuration of the switch. Figure 2 The SW (switch) in the figure represents a switch, the solid dots represent ports in the UP state on the switch, and the box area represents the encapsulation type to which the port belongs. Figure 2 It can be seen that the switch is configured with 3 ports of Access encapsulation type and 2 ports of Trunk / Hybrid encapsulation type.
[0072] Considering that the Access ports configured in the switch may have multiple types, and the upstream trunk port will only be configured with a set of VLAN-IDs of the downstream service ports that need to transparently transmit data, therefore, the Access ports (i.e., non-trunk ports) that need to communicate with the network interconnection device through the upstream trunk port and are configured with VLAN-IDs are obtained. Based on the VLAN-IDs of each non-trunk port, all VLAN-IDs corresponding to the Access port in the VLAN-ID configured by the pseudo trunk port can be filtered out.
[0073] For example, according to the different services carried by the device connected to the other end of the Access port, the configuration of the port is also different. By analyzing the Access port on the device, the VLAN-ID configuration of the Access port can be divided into the following three cases:
[0074] ① VLAN-ID is not configured;
[0075] ②Configure VLAN-ID, and configure the logical VLAN port for the VLAN-ID;
[0076] ③Configure the VLAN-ID, but the logical VLAN port is not configured for the VLAN-ID.
[0077] Since the VLAN-ID of the Access port is needed to assist in the analysis of the VLAN-ID configured on the pseudo-relay port in this embodiment, the Access port corresponding to situation ① can be excluded. The Access port corresponding to the VLAN-ID configured with the logical VLAN port usually communicates with the VLAN of the Internet dedicated line, and the data of the Access port is not transparently transmitted to the outside through the uplink relay port. Therefore, the Access port corresponding to situation ② can be further excluded. The data in the VLAN-ID of the Access port corresponding to situation ③ needs to be forwarded after being aggregated through the uplink relay port, that is, the uplink relay port is configured with the VLAN-ID of the Access port corresponding to situation ③. Therefore, the Access port corresponding to situation ③ can be determined as the above-mentioned non-relay port to filter the VLAN-ID of the pseudo-relay port.
[0078] Taking the Access port corresponding to the above situation ③ configured in the switch as an example, the process of obtaining the set of target VLAN-IDs is explained.
[0079] For the target switch, extract the VLAN-ID of the Access port that is not configured with a logical VLAN port to obtain the set VA (i.e., the VLAN-ID configured for the non-trunk port mentioned above), and extract the VLAN-ID configured for all Trunk ports and Hybrid ports to obtain the set VT (i.e., the set of VLAN-ID configured for the pseudo-trunk port mentioned above).
[0080] According to the formula: The set of VLAN-IDs that does not include the set VA in the set VT is calculated to obtain the set VC of the target VLAN-ID.
[0081] It can be understood that if there is no duplicate VLAN-ID in the set VC, it means that there is no VLAN-ID configured for the downstream service port with encapsulation type of trunk or hybrid in the set VT, so it can be determined that there is no downstream service port in the pseudo-relay port. Therefore, all pseudo-relay ports can be determined as upstream relay ports.
[0082] Optionally, the method further comprises:
[0083] In the case where there are repeated target VLAN-IDs in the set of target VLAN-IDs, all ports corresponding to non-repeated target VLAN-IDs in the set of target VLAN-IDs are determined as uplink trunk ports;
[0084] For each repeated VLAN-ID in the target VLAN-ID set, port traffic analysis is performed on all pseudo trunk ports configured with the repeated VLAN-ID, thereby determining an uplink trunk port.
[0085] Exemplarily, assuming that there are repeated VLAN-IDs in the set VC of the target VLAN-ID, it means that in the set VT of the VLAN-ID configured by the pseudo-relay port, there is a VLAN-ID configured by the downstream service port with the encapsulation type of trunk or hybrid, that is, each pseudo-relay port has an upstream relay port and a downstream service port configured with the repeated VLAN-ID. Therefore, it is necessary to further analyze the pseudo-relay port configured with the repeated VLAN-ID to identify the upstream relay port. As for the non-repeated VLAN-ID in the set VC, since the non-repeated VLAN-ID is not configured by the downstream service port with the encapsulation type of trunk or hybrid, the pseudo-relay port corresponding to the non-repeated VLAN-ID is the upstream relay port.
[0086] Optionally, for each repeated VLAN-ID in the set of target VLAN-IDs, performing port traffic analysis on all pseudo trunk ports configured with the repeated VLAN-ID to thereby determine an implementation process of an uplink trunk port includes:
[0087] Obtaining the real-time traffic of each of all pseudo trunk ports configured with the repeated VLAN-ID;
[0088] Among all pseudo trunk ports configured with the repeated VLAN-ID, the pseudo trunk port with the largest real-time traffic is determined as the uplink trunk port.
[0089] Exemplarily, all repeated VLAN-IDs in the target VLAN-ID set VC are represented by a set VD, and the repeated VLAN-IDs in the set VD are represented by the symbol "V", so that VD = {repeated VLAN-IDs in VC} = {V1, V2, ..., Vn} can be obtained.
[0090] Each pseudo relay port PR is represented by "PR1, PR2, ..., PRn" in sequence, and the VLAN-ID configured for a single pseudo relay port collected from the target switch is represented by a set VR. The VLAN-ID configured for each pseudo relay port can be represented as VR1 = {VLAN-ID in PR1}, VR2 = {VLAN-ID in PR2}, ..., VRn = {VLAN-ID in PRn}.
[0091] If V1∈VR1, V1∈VR2 and V1∈VR3, then PR1, PR2 and PR3 are determined as ports that need to be analyzed for traffic, and these ports are defined as the traffic analysis ports corresponding to V1. The same method is used to judge each V value in the set VD in turn, and the traffic analysis ports corresponding to all V values are determined.
[0092] For each V value in the set VD, the real-time traffic of each traffic analysis port corresponding to the V value is extracted, the real-time traffic of each traffic analysis port corresponding to the V value is compared, and the traffic analysis port with the largest real-time traffic is identified as the uplink relay port corresponding to the V value.
[0093] The maximum real-time flow value in the flow analysis port corresponding to the V value is represented by T V Indicates that T V The calculation formula is as follows:
[0094] T V =MAX(T PR1 ,T PR2 ,...,T PRn ), n∈(1,Num]
[0095] In the above formula, the flow parameter T in the MAX function PRn is the real-time traffic of the traffic analysis port corresponding to the V value, Num is the number of pseudo relay ports, and the traffic parameter in the MAX function is determined according to the actual situation. For example, if the traffic analysis ports corresponding to the V value are PR2 and PR3, the corresponding traffic parameter in the MAX function is T PR2 and T PR3 .
[0096] Based on the above formula, calculate the maximum real-time flow T in the flow analysis port corresponding to each V value. V , each T V The corresponding traffic analysis port is determined to be the uplink trunk port.
[0097] Optionally, the method further comprises:
[0098] Obtain the number of the pseudo relay ports;
[0099] Detecting whether the number of the pseudo relay ports is equal to 1;
[0100] When the number of the pseudo relay ports is equal to 1, determining the pseudo relay port as an uplink relay port;
[0101] The step of identifying an uplink trunk port from the pseudo trunk port according to the VLAN-ID configured for the pseudo trunk port includes:
[0102] When the number of the pseudo relay ports is not equal to 1, an uplink relay port is identified from the pseudo relay ports according to the VLAN-ID configured for the pseudo relay ports.
[0103] In this embodiment, if the switch has only one port with an encapsulation type of trunk / hybrid, that is, the number of pseudo trunk ports is equal to 1, since the data of each downstream service port needs to be aggregated through the upstream trunk port and then forwarded, that is, there is at least one upstream trunk port in the switch, and the upstream trunk port cannot be an Access encapsulation type, it can be determined that the pseudo trunk port is the upstream trunk port.
[0104] When the number of pseudo relay ports is not equal to 1, that is, when the number of pseudo relay ports is greater than 1, there are two situations for the device ports of the switch, one is that all "pseudo relay ports-PR" are uplink relay ports, and the other is that all "pseudo relay ports-PR" have two types of ports, namely, uplink relay ports and service ports. Therefore, it is necessary to analyze each pseudo relay port according to the VLAN-ID configured by the pseudo relay port to identify the uplink relay port from the pseudo relay port.
[0105] For example, Figure 3 The flowchart of another method for identifying an uplink relay port in an embodiment of the present application is shown. The method includes:
[0106] First, count the number of pseudo relay ports (ie, "Trunk" / "Hybrid" ports) in the ports in the connected state (ie, "UP" ports) of the switch (ie, "Num").
[0107] When the number of pseudo relay ports is equal to 1, the pseudo relay port is determined as an uplink relay port.
[0108] When the number of pseudo trunk ports is not equal to 1, extract the key device information of the switch (ie, VLAN-ID):
[0109] Collect the VLAN of all ports of the device (switch), extract the VLAN information of the "Access" port that is configured with VLAN-ID but not configured with logical VLAN ports, obtain the set VA, and extract the VLAN information of the "Trunk" / "Hybrid" port (i.e., pseudo trunk port PR) to obtain the set VT.
[0110] Then, according to the formula A VLAN-ID set VC (ie, a set of target VLAN-IDs) that does not include VA in VT is determined.
[0111] Next, determine the traffic analysis port:
[0112] The judgment is made based on all repeated VLAN-ID sets VD in the target VLAN-ID set: if VD = Φ, then all pseudo trunk ports are determined to be uplink trunk ports; if Then make the following judgment:
[0113] ① If VD (VLAN-ID configured for a single pseudo trunk port), the corresponding pseudo trunk port is an uplink trunk port;
[0114] ② If V∈VR in VD, the corresponding pseudo relay port is determined as the traffic analysis port, so that traffic analysis can be performed on each traffic analysis port to identify the uplink relay port.
[0115] For example, the above method steps are described by taking the identification of an uplink trunk port of an access switch of a certain operator as an example. The switch device has a total of 24 ports, of which 10 ports are in the UP state. The steps for identifying the uplink trunk port are as follows:
[0116] First, obtain the port encapsulation type of the 10 ports, and obtain 8 access ports and 2 trunk ports. And collect the VLAN-ID of each port of the device:
[0117] Extract the set of VLAN-IDs of non-trunk ports VA = {1500, 1501, 1502, 2000} and the set of VLAN-IDs of pseudo-trunk ports VT = {1500, 1501, 1502, 2000, 1960, 50, 1960}, among which the VLAN-IDs configured for the two Trunk ports (PR1 and PR2) are VR1 = {1960} and VR2 = {1500, 1501, 1502, 2000, 1960, 50} respectively.
[0118] Then, determine the traffic analysis port corresponding to each repeated VLAN-ID:
[0119] According to the formula Calculate VC = {50, 1960, 1960}, VD = {repeated VLAN-ID in VC} = {1960}, then V = 1960. Since Num = 2 and It is determined that V represents a repeated VLAN-ID configured on the pseudo trunk port. Since V∈VR1 and V∈VR2, it can be determined that PR1 and PR2 are the traffic analysis ports corresponding to the V value.
[0120] Finally, determine the uplink trunk port:
[0121] Collect the real-time traffic of the port corresponding to V: the real-time traffic of PR1 is 50M, and the real-time traffic of PR2 is 200M. Since the real-time traffic of PR2 is the largest, PR2 is identified as the uplink relay port.
[0122] It is understandable that the embodiment of the present application utilizes the configuration information of the port and the number of "Trunk" ports / "Hybrid" ports to classify the ports into multiple situations for identification, so that the above-mentioned uplink trunk port identification method is applicable to a variety of application scenarios, which can cover almost all services of the access switch and the configuration status of all equipment manufacturers. And based on the operation of the VLAN-ID set and the real-time traffic analysis of the ports with the intersection of repeated VLAN-IDs to obtain the trunk port, the accuracy of the trunk port identification can be effectively improved, which is conducive to improving the automation of the uplink trunk port identification.
[0123] Optionally, in one embodiment, the method further comprises:
[0124] According to the uplink relay port, a downstream service port is identified from each port of the switch whose port physical status is a connected state.
[0125] It can be understood that after the uplink trunk port on the access switch is identified, all downstream service ports on the switch can be obtained simply and quickly.
[0126] For example, a method of filtering out each uplink trunk port from each port in a connected state of the switch may be adopted to quickly obtain all downstream service ports of the switch.
[0127] Specifically, Figure 3 As shown, in the case where there are repeated VLAN-IDs in the set of target VLAN-IDs, for each repeated VLAN-ID (i.e., V value), the port with the largest real-time traffic among the traffic analysis ports corresponding to the V value is determined as the uplink relay port, and the other traffic analysis ports corresponding to the V value except the uplink relay port are determined as service ports (i.e., downstream service ports), thereby obtaining all downstream service ports of the switch.
[0128] Therefore, the technical solution provided by the embodiment of the present application is conducive to quickly finding the downlink service port, so that the service port information of the downlink service port can be analyzed in a targeted manner, and the degree of automation of identifying the service port information related to the privately opened dedicated line is further improved, providing operators with the ability to automatically identify non-compliant behaviors (mainly private business), so that they can automatically, timely and targetedly combat non-compliant behaviors, and reduce unnecessary economic losses for operators. In addition, by accurately identifying the uplink relay port, it can provide a technical implementation basis for the precise positioning of faults such as IP network group failures, thereby shortening the processing time of the fault and improving user perception.
[0129] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0130] Figure 4 : is a structural diagram of a device for identifying an uplink relay port according to an embodiment of the present application, the device comprising:
[0131] The acquisition module is used to acquire the configuration information of each port of the switch. The configuration information of a port includes: the encapsulation type of the port and the VLAN-ID configured for the port;
[0132] A processing module, used for determining a port whose encapsulation type is Trunk or Hybrid as a pseudo trunk port;
[0133] The identification module is used to identify an uplink relay port from the pseudo relay port according to the VLAN-ID configured by the pseudo relay port, and the uplink relay port is used for the switch to communicate with the network interconnection device.
[0134] Optionally, it further includes a first analysis module;
[0135] The first analysis module is used for, when there is a port with an encapsulation type of Access among the ports, determining the port with an encapsulation type of Access and communicating with the network interconnection device through an uplink relay port as a non-relay port; removing the VLAN-ID configured for the non-relay port from the set of VLAN-IDs configured for the pseudo relay port to obtain a set of target VLAN-IDs; when there is no non-relay port among the ports, the set of VLAN-IDs configured for the pseudo relay port is the set of target VLAN-IDs;
[0136] The identification module is specifically configured to determine the ports corresponding to the respective target VLAN-IDs in the target VLAN-ID set as uplink relay ports when there is no duplicate target VLAN-ID in the target VLAN-ID set.
[0137] Optionally, a second analysis module is also included;
[0138] The second analysis module is used to, when there are repeated target VLAN-IDs in the set of target VLAN-IDs, determine all ports corresponding to non-duplicate target VLAN-IDs in the set of target VLAN-IDs as uplink relay ports; for each repeated VLAN-ID in the set of target VLAN-IDs, perform port traffic analysis on all pseudo relay ports configured with the repeated VLAN-ID, and then determine the uplink relay port.
[0139] Optionally, the second analysis module is specifically used to obtain the real-time traffic of each of all pseudo relay ports configured with the repeated VLAN-ID; and determine the pseudo relay port with the largest real-time traffic among all pseudo relay ports configured with the repeated VLAN-ID as the uplink relay port.
[0140] Optionally, a third analysis module is also included;
[0141] The third analysis module is used to obtain the number of the pseudo relay ports; detect whether the number of the pseudo relay ports is equal to 1; when the number of the pseudo relay ports is equal to 1, determine the pseudo relay port as an uplink relay port;
[0142] The identification module is further configured to identify an uplink relay port from the pseudo relay ports according to a VLAN-ID configured for the pseudo relay ports when the number of the pseudo relay ports is not equal to 1.
[0143] Optionally, a fourth analysis module is also included;
[0144] The acquisition module is specifically used to acquire configuration information of each port whose physical state is a connected state among all ports of the switch;
[0145] The fourth analysis module is used to identify the downstream service port from each port of the switch whose port physical status is connected according to the upstream relay port.
[0146] It should be noted that the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
[0147] The present application also provides an electronic device, referring to Figure 5 , Figure 5 Schematic diagram of an electronic device proposed in an embodiment of the present application. Figure 5As shown, the electronic device 100 includes: a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication. A computer program is stored in the memory 110. The computer program can be run on the processor 120 to implement the steps in the method for identifying an uplink relay port disclosed in an embodiment of the present application.
[0148] The embodiment of the present application further provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method for identifying an uplink relay port as disclosed in the embodiment of the present application is implemented.
[0149] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the method for identifying an uplink relay port as disclosed in the embodiment of the present application.
[0150] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0151] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0152] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, systems, devices, storage media, and program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0153] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0154] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0155] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0156] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0157] The above is a detailed introduction to the method, device, equipment, medium and program product for identifying an uplink relay port provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for identifying an uplink relay port, characterized in that: include: Obtain the configuration information of each port of the switch. The configuration information of a port includes: the encapsulation type of the port and the VLAN-ID configured for the port; Determine the port with Trunk or Hybrid encapsulation type as a pseudo trunk port; According to the VLAN-ID configured for the pseudo relay port, an uplink relay port is identified from the pseudo relay port, and the uplink relay port is used for the switch to communicate with the network interconnection device, which includes: when there is a port with an encapsulation type of Access among the ports, the port with an encapsulation type of Access and communicating with the network interconnection device through the uplink relay port is determined as a non-relay port; from the set of VLAN-IDs configured for the pseudo relay port, the VLAN-ID configured for the non-relay port is removed to obtain a set of target VLAN-IDs; when there is no non-relay port among the ports, the set of VLAN-IDs configured for the pseudo relay port is the set of target VLAN-IDs; when there is no duplicate target VLAN-ID in the set of target VLAN-IDs, the ports corresponding to the target VLAN-IDs in the set of target VLAN-IDs are all determined as uplink relay ports.
2. The method according to claim 1, characterized in that Also includes: In the case where there are repeated target VLAN-IDs in the set of target VLAN-IDs, all ports corresponding to non-repeated target VLAN-IDs in the set of target VLAN-IDs are determined as uplink trunk ports; For each repeated VLAN-ID in the target VLAN-ID set, port traffic analysis is performed on all pseudo trunk ports configured with the repeated VLAN-ID, thereby determining an uplink trunk port.
3. The method according to claim 2, characterized in that The method of performing port traffic analysis on all pseudo trunk ports configured with the repeated VLAN-ID for each repeated VLAN-ID in the set of target VLAN-IDs, and then determining an uplink trunk port, includes: Obtaining the real-time traffic of each of all pseudo trunk ports configured with the repeated VLAN-ID; Among all pseudo trunk ports configured with the repeated VLAN-ID, the pseudo trunk port with the largest real-time traffic is determined as the uplink trunk port.
4. The method according to claim 1, characterized in that Also includes: Obtain the number of the pseudo relay ports; Detecting whether the number of the pseudo relay ports is equal to 1; When the number of the pseudo relay ports is equal to 1, determining the pseudo relay port as an uplink relay port; The step of identifying an uplink trunk port from the pseudo trunk port according to the VLAN-ID configured for the pseudo trunk port includes: When the number of the pseudo relay ports is not equal to 1, an uplink relay port is identified from the pseudo relay ports according to the VLAN-ID configured for the pseudo relay ports.
5. The method according to any one of claims 1 to 4, characterized in that: The obtaining of configuration information of each port of the switch includes: Obtaining configuration information of each of the ports of the switch whose physical state is a connected state; Also includes: According to the uplink relay port, a downstream service port is identified from each port of the switch whose port physical status is a connected state.
6. A device for identifying an uplink relay port, characterized in that: include: The acquisition module is used to acquire the configuration information of each port of the switch. The configuration information of a port includes: the encapsulation type of the port and the VLAN-ID configured for the port; A processing module, used for determining a port whose encapsulation type is Trunk or Hybrid as a pseudo trunk port; The identification module is used to identify an uplink relay port from the pseudo relay port according to the VLAN-ID configured for the pseudo relay port, and the uplink relay port is used for the switch to communicate with the network interconnection device, including: when there is a port with an encapsulation type of Access among the ports, the port with an encapsulation type of Access and communicating with the network interconnection device through the uplink relay port is determined as a non-relay port; from the set of VLAN-IDs configured for the pseudo relay port, the VLAN-ID configured for the non-relay port is removed to obtain a set of target VLAN-IDs; when there is no non-relay port among the ports, the set of VLAN-IDs configured for the pseudo relay port is the set of target VLAN-IDs; when there is no duplicate target VLAN-ID in the set of target VLAN-IDs, the ports corresponding to each target VLAN-ID in the set of target VLAN-IDs are all determined as uplink relay ports.
7. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the method for identifying an upstream relay port according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the method for identifying an uplink relay port according to any one of claims 1 to 5 is implemented.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the method for identifying an uplink relay port according to any one of claims 1 to 5 is implemented.
