Method and related device for testing maximum number of neighbors of OSPF (Open Shortest Path First) protocol
By obtaining configuration information and establishing an OSPF protocol relationship between switches, the maximum number of neighbors is automatically determined, and the problem of high cost and high workload testing of the maximum number of neighbors in the prior art is solved, thereby achieving efficient switch testing.
Patent Information
- Application Number
- CN202410981084.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-19
AI Technical Summary
The prior art requires testers that support the OSPF protocol when testing the maximum number of neighbors of the OSPF protocol, resulting in high costs and high workload.
By obtaining configuration information, the configuration operations are performed on the two switches separately, so that they establish neighbor relationships through the OSPF protocol, and obtain their state machine to determine the maximum number of neighbors, and realize automatic testing.
It reduces the workload and equipment costs of testers, while improving testing efficiency, and implements effective testing of switches.
Smart Images

Figure CN118984313A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and related devices for testing the maximum number of neighbors of an OSPF protocol. Background Art
[0002] Open Shortest Path First (OSPF) is a typical dynamic routing protocol used to exchange routing information between network devices. Before a switch is put into commercial use, the system software must be tested for various aspects of performance, including the test of the maximum number of neighbors of the OSPF protocol.
[0003] In the related art, when testing the maximum number of neighbors of the OSPF protocol, a common method is that the tester uses a tester to establish the maximum number of neighbors allowed between the tester and the switch through the OSPF protocol. For example, if the maximum number of neighbors supported by the OSPF protocol of the switch is 1024, then the tester is used to establish 1024 neighbors between the tester and the switch based on the OSPF protocol. Figure 1 shown.
[0004] However, this method requires the tester to support the OSPF protocol, but the tester supporting the OSPF protocol is relatively expensive and the workload of the tester is relatively large. Summary of the invention
[0005] In response to the above problems, the present application provides a method and related devices for testing the maximum number of neighbors of the OSPF protocol, which are used to reduce the workload of testers and reduce the testing cost of testing the maximum number of neighbors of the OSPF protocol.
[0006] Based on this, the embodiments of the present application disclose the following technical solutions:
[0007] On the one hand, an embodiment of the present application provides a method for testing the maximum number of neighbors of the OSPF protocol, the method comprising:
[0008] Acquire configuration information, wherein the configuration information includes a target port for communicating with a peer switch, a maximum number of neighbors to be tested, a mapping relationship between a switch and an Internet Protocol address, and a corresponding relationship between a switch and a routing identifier;
[0009] Performing configuration operations on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the open shortest path first protocol;
[0010] Acquire a first neighbor state machine of the first switch and a second neighbor state machine of the second switch;
[0011] The maximum number of neighbors established by the first switch through the open shortest path first protocol is determined according to the first neighbor state machine, and the maximum number of neighbors established by the second switch through the open shortest path first protocol is determined according to the second neighbor state machine.
[0012] Optionally, the configuration operation includes:
[0013] Creating a plurality of virtual local area networks having the same number as the maximum number of neighbors to be tested according to the configuration information, and adding the target port to the plurality of virtual local area networks;
[0014] Creating corresponding logical interfaces in each of the virtual local area networks, respectively, and configuring an Internet Protocol address for each of the logical interfaces according to a mapping relationship between the switch and the Internet Protocol address, wherein different logical interfaces have different Internet Protocol addresses;
[0015] Creating a routing process of the open shortest path first protocol, and creating a routing identifier corresponding to the switch for the routing process according to the correspondence between the switch and the routing identifier;
[0016] The network segment address of each of the logical interfaces is announced in the backbone area.
[0017] Optionally, configuring an Internet Protocol address for each of the logical interfaces according to a mapping relationship between the switch and the Internet Protocol address includes:
[0018] For a target switch, determining an Internet Protocol address range corresponding to the target switch according to a mapping relationship between the switch and the Internet Protocol address, the target switch being the first switch or the second switch;
[0019] Dividing the plurality of logical interfaces into a plurality of groups of logical interfaces, the number of logical interfaces in each group being less than 255;
[0020] Different network segments are allocated to logical interfaces belonging to different groups according to the Internet Protocol address range, and logical interfaces in the same group have different Internet Protocol addresses.
[0021] Optionally, determining the maximum number of neighbors established by the first switch through the open shortest path first protocol according to the first neighbor state machine, and determining the maximum number of neighbors established by the second switch through the open shortest path first protocol according to the second neighbor state machine includes:
[0022] If the number of normal states included in the first neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test;
[0023] If the number of normal states included in the second neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the OSPF protocol for the second switch passes the test.
[0024] Optionally, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the method further includes:
[0025] Performing a configuration operation on the third switch according to the configuration information, so that the first switch and the third switch establish a neighbor relationship through the open shortest path first protocol, and the third switch is a switch that passes the maximum number of neighbors test of the open shortest path first protocol;
[0026] Obtaining a third neighbor state machine of the first switch;
[0027] If the number of normal states included in the third neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test; if the number of normal states included in the third neighbor state machine is different from the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch fails the test.
[0028] Optionally, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the method further includes:
[0029] Obtaining a network connection status between the first switch and the second switch;
[0030] If the network connection state is a connected state, obtaining the sending information and receiving information of the first switch through a troubleshooting command, and determining inconsistent information between the sending information and the receiving information as a cause of the fault;
[0031] If the network connection status is a disconnected state, the physical connection status and the link connection status of the physical interfaces of the first switch and the second switch are obtained; if the physical connection status and the link connection status of the physical interface are a disconnected state, the fault cause is a physical link fault; if the physical connection status and the link connection status of the physical interface are a connected state, the link status of the logical interface is obtained; if the link status of the logical interface is a disconnected state, the fault cause is a logical interface fault.
[0032] On the other hand, the present application provides a device for testing the maximum number of neighbors of the OSPF protocol, the device comprising: a first acquisition unit, a configuration unit, a second acquisition unit and a determination unit;
[0033] The first acquisition unit is used to acquire configuration information, wherein the configuration information includes a target port for communicating with a peer switch, a maximum number of neighbors to be tested, a mapping relationship between a switch and an Internet Protocol address, and a corresponding relationship between a switch and a routing identifier;
[0034] The configuration unit is configured to perform configuration operations on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the open shortest path first protocol;
[0035] The second acquiring unit is configured to acquire a first neighbor state machine of the first switch and a second neighbor state machine of the second switch;
[0036] The determining unit is configured to determine a maximum number of neighbors established by the first switch through the open shortest path first protocol according to the first neighbor state machine, and determine a maximum number of neighbors established by the second switch through the open shortest path first protocol according to the second neighbor state machine.
[0037] Optionally, the configuration unit is specifically used to:
[0038] Creating a plurality of virtual local area networks having the same number as the maximum number of neighbors to be tested according to the configuration information, and adding the target port to the plurality of virtual local area networks;
[0039] Creating corresponding logical interfaces in each of the virtual local area networks, respectively, and configuring an Internet Protocol address for each of the logical interfaces according to a mapping relationship between the switch and the Internet Protocol address, wherein different logical interfaces have different Internet Protocol addresses;
[0040] Creating a routing process of the open shortest path first protocol, and creating a routing identifier corresponding to the switch for the routing process according to the correspondence between the switch and the routing identifier;
[0041] The network segment address of each of the logical interfaces is announced in the backbone area.
[0042] Optionally, the configuration unit is specifically used to:
[0043] For a target switch, determining an Internet Protocol address range corresponding to the target switch according to a mapping relationship between the switch and the Internet Protocol address, the target switch being the first switch or the second switch;
[0044] Dividing the plurality of logical interfaces into a plurality of groups of logical interfaces, the number of logical interfaces in each group being less than 255;
[0045] Different network segments are allocated to logical interfaces belonging to different groups according to the Internet Protocol address range, and logical interfaces in the same group have different Internet Protocol addresses.
[0046] Optionally, the determining unit is specifically configured to:
[0047] If the number of normal states included in the first neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test;
[0048] If the number of normal states included in the second neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the OSPF protocol for the second switch passes the test.
[0049] Optionally, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the determining unit is further used to:
[0050] Performing a configuration operation on the third switch according to the configuration information, so that the first switch and the third switch establish a neighbor relationship through the open shortest path first protocol, and the third switch is a switch that passes the maximum number of neighbors test of the open shortest path first protocol;
[0051] Obtaining a third neighbor state machine of the first switch;
[0052] If the number of normal states included in the third neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test; if the number of normal states included in the third neighbor state machine is different from the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch fails the test.
[0053] Optionally, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the determining unit is further used to:
[0054] Obtaining a network connection status between the first switch and the second switch;
[0055] If the network connection state is a connected state, obtaining the sending information and receiving information of the first switch through a troubleshooting command, and determining inconsistent information between the sending information and the receiving information as a cause of the fault;
[0056] If the network connection status is a disconnected state, the physical connection status and the link connection status of the physical interfaces of the first switch and the second switch are obtained; if the physical connection status and the link connection status of the physical interface are a disconnected state, the fault cause is a physical link fault; if the physical connection status and the link connection status of the physical interface are a connected state, the link status of the logical interface is obtained; if the link status of the logical interface is a disconnected state, the fault cause is a logical interface fault.
[0057] In another aspect, the present application provides a computer device, the device comprising a processor and a memory:
[0058] The memory is used to store program code and transmit the program code to the processor;
[0059] The processor is used to execute the method described in the above aspects according to the instructions in the program code.
[0060] On the other hand, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the above aspects.
[0061] On the other hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method described in the above aspects.
[0062] The advantages of the above technical solution of this application are:
[0063] Instead of using a tester supporting the OSPF protocol to test the maximum number of neighbors of the switch's OSPF protocol, two switches that need to test the maximum number of neighbors of the OSPF protocol are used to test each other, thereby reducing the cost of the test equipment. Specifically, configuration information is obtained, and configuration operations are performed on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the OSPF protocol. In order to clarify the establishment of the neighbor relationship, it is also necessary to obtain the neighbor state machine of the switch, that is, the first neighbor state machine of the first switch and the second neighbor state machine of the second switch, and determine the maximum number of neighbors established by the first switch through the OSPF protocol according to the first neighbor state machine, and determine the maximum number of neighbors established by the second switch through the OSPF protocol according to the second neighbor state machine, thereby automatically completing the test of the switch for the maximum number of neighbors of the OSPF protocol according to the configuration information, reducing the workload of the tester. In addition, the test of the two switches is also realized at the same time, which improves the test efficiency of the switch. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0065] Figure 1 A schematic diagram of a test switch provided for this application;
[0066] Figure 2 A flowchart of a method for testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application;
[0068] Figure 4 A schematic diagram of testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application;
[0069] Figure 5 A schematic diagram of testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application;
[0070] Figure 6 A schematic diagram of an OSPF neighbor reaching a FULL state provided in an embodiment of the present application;
[0071] Figure 7A schematic diagram of printing OSPF Debug information for a first switch provided in an embodiment of the present application;
[0072] Figure 8 A schematic diagram of printing OSPF Debug information for a second switch provided in an embodiment of the present application;
[0073] Fig. 9 A configuration diagram of a logical interface vlanif1024 of a first switch provided in an embodiment of the present application;
[0074] Fig.10 A schematic diagram of a network connection state of a first switch provided in an embodiment of the present application;
[0075] Fig.11 A schematic diagram of a network connection state of a second switch provided in an embodiment of the present application;
[0076] Fig.12 A schematic diagram of a physical connection state and a link connection state of a physical interface of a first switch provided in an embodiment of the present application;
[0077] Fig.13 A schematic diagram of a physical connection state and a link connection state of a physical interface of a second switch provided in an embodiment of the present application;
[0078] Fig.14 A schematic diagram of a link state of a logical interface of a first switch provided in an embodiment of the present application;
[0079] Fig.15 A schematic diagram of a link state of a logical interface of a second switch provided in an embodiment of the present application;
[0080] Fig.16 A schematic diagram of a device for testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application;
[0081] Fig.17 A structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0082] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0083] Open Shortest Path First (OSPF) is a typical dynamic routing protocol used to exchange routing information between network devices. As a link-state-based protocol, OSPF dynamically discovers and propagates routes by collecting and transmitting link states. OSPF uses an open protocol to provide routing information exchange and updates for all devices in the network, and selects the shortest path based on the network topology. The OSPF protocol plays a key role in building complex network architectures. It automatically establishes a link state database and generates a shortest path tree by announcing the status of network ports between network devices. Each network device uses these shortest paths to construct a routing table, achieving rapid convergence of the routing table and reducing network latency.
[0084] The calculation process of OSPF protocol routing can be simply described as follows:
[0085] 1. Establish an adjacency relationship. The process is as follows:
[0086] a. The local device sends a Hello message through the interface to establish a neighbor relationship with the remote device.
[0087] b. The devices at both ends negotiate the master / slave relationship and exchange database description (DD) messages.
[0088] c. The devices at both ends complete the synchronization of the link database (Link State Database, LSDB) by updating the Link Statement Advertisement (LSA).
[0089] 2. Route calculation: The OSPF protocol uses the shortest path first (SPF) algorithm to calculate routes, which can achieve the purpose of rapid route convergence.
[0090] In an OSPF network, in order to exchange routing information, network devices must establish adjacencies. Neighbors and adjacencies are two different concepts, which are explained below.
[0091] Neighbor relationship: After the network device starts OSPF, it will send Hello messages through the OSPF interface. The network device that receives the Hello message will check the parameters defined in the message. If both parties are consistent, a neighbor relationship is formed and the devices at both ends are neighbors.
[0092] Adjacency: After a neighbor relationship is formed, if the two devices successfully exchange DD packets and LSAs and reach the FULL state, an adjacency is established.
[0093] Neighbor relationships and adjacency relationships are expressed through OSPF state machines. OSPF has eight neighbor state machines: Down, Attempt, Init, 2-Way, Exstart, Exchange, Loading, and Full. Figure 1 As shown in the figure, Down, 2-way, and Full are stable states, while Attempt, Init, Exstart, Exchange, and Loading are unstable states. Unstable states exist momentarily during the conversion process and generally do not exceed a few minutes.
[0094] Before a switch is put into commercial use, the system software must undergo various performance tests, including testing of the maximum number of neighbors of the OSPF protocol.
[0095] When testing the maximum number of neighbors of the OSPF protocol, a common method is for the tester to use the tester to establish the maximum number of neighbors allowed between the tester and the switch through the OSPF protocol. For example, if the maximum number of neighbors supported by the OSPF protocol of the switch is 1024, then the tester is used to establish 1024 neighbors between the tester and the switch based on the OSPF protocol. Figure 1 shown.
[0096] However, this method requires the tester to support the OSPF protocol, but the tester supporting the OSPF protocol is relatively expensive and the workload of the tester is relatively large.
[0097] Based on this, the embodiment of the present application provides a method and related device for testing the maximum number of neighbors of the OSPF protocol. The tester supporting the OSPF protocol is no longer used to test the maximum number of neighbors of the OSPF protocol of the switch. Instead, two switches that need to test the maximum number of neighbors of the OSPF protocol are used to test each other, thereby reducing the cost of the test equipment. Specifically, configuration information is obtained, and configuration operations are performed on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the OSPF protocol. In order to clarify the establishment of the neighbor relationship, it is also necessary to obtain the neighbor state machine of the switch, that is, the first neighbor state machine of the first switch and the second neighbor state machine of the second switch, and determine the maximum number of neighbors established by the first switch through the OSPF protocol according to the first neighbor state machine, and determine the maximum number of neighbors established by the second switch through the OSPF protocol according to the second neighbor state machine, so as to automatically complete the test of the maximum number of neighbors of the OSPF protocol for the switch according to the configuration information, reducing the workload of the tester. Thus, while reducing the workload of the tester, the test cost of testing the maximum number of neighbors of the OSPF protocol is reduced.
[0098] The method for testing the maximum number of neighbors of the OSPF protocol provided in this application can be applied to computer devices capable of testing the maximum number of neighbors of the OSPF protocol, such as terminal devices and servers. Among them, the terminal device can specifically be a desktop computer, a laptop computer, a mobile phone, and a tablet computer; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0099] Combine the following Figure 2 , a method for testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application is introduced. Figure 2 , this figure is a flowchart of a method for testing the maximum number of neighbors of the OSPF protocol provided in an embodiment of the present application, and the method may include S201-S204.
[0100] S201: Obtain configuration information.
[0101] The configuration information includes the target port for communicating with the opposite switch, the maximum number of neighbors to be tested, the mapping relationship between the switch and the Internet Protocol address, and the corresponding relationship between the switch and the routing identifier.
[0102] The peer switch refers to another switch between two switches that have established a neighbor relationship. For example, a first switch and a second switch have established a neighbor relationship. For the first switch, the second switch is the peer switch. For the two switches to communicate, they need to have ports of the same type, and the ports for communication need to be designated as target ports, such as port G1.
[0103] The switch with the maximum number of neighbors to be tested needs to reach the maximum number of neighbors. For example, if the maximum number of neighbors that the first switch can establish is 1024, then the maximum number of neighbors to be tested is 1024. It can be understood that the maximum number of neighbors of the two switches tested with each other is generally the same. If they are not the same, the smaller maximum number of neighbors of the two switches is used as the maximum number of neighbors to be tested.
[0104] The mapping relationship between switches and Internet Protocol addresses refers to the Internet Protocol address ranges used by the two switches that establish a neighbor relationship. The Internet Protocol address (IP address) is a unified address format provided by the IP protocol. It assigns a logical address to each network and each host on the Internet to shield the difference in physical addresses.
[0105] As a possible implementation manner, the IP address range is related to the maximum number of neighbors to be tested. Taking the maximum number of neighbors to be tested as 1024 as an example, the two switches that establish a neighbor relationship are the first switch and the second switch. The IP address range of the first switch is 100.10.1.1 / 24 to 100.50.24.1 / 24, and the IP address range of the second switch is 100.10.1.2 / 24 to 100.50.24.2 / 24.
[0106] The correspondence between switches and router IDs refers to the router IDs used by the two switches that establish a neighbor relationship. The router ID is a 32-bit integer that uniquely identifies the device during routing interaction through a specified dynamic routing protocol. For example, the two switches that establish a neighbor relationship are the first switch and the second switch. The first switch is configured with a router ID of 1.1.1.1, and the second switch is configured with a router ID of 2.2.2.2.
[0107] S202: Perform configuration operations on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the open shortest path first protocol.
[0108] The first switch is configured according to the configuration information, and the second switch is configured according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the OSPF protocol.
[0109] As a possible implementation manner, the configuration operations may be S2021-S2024.
[0110] S2021: Create multiple virtual LANs with the same number as the maximum number of neighbors to be tested according to the configuration information, and add the target port to the multiple virtual LANs.
[0111] Continue to test whether the maximum number of neighbors established by the first switch and the second switch through the OSPF protocol is 1024 as an example. Figure 3 , which is a schematic diagram of a test of the maximum number of neighbors of the OSPF protocol provided by an embodiment of the present application. Figure 3 In the example, switch A is the first switch and switch B is the second switch.
[0112] According to the configuration information, 1024 virtual local area networks (VLANs) are created for the first switch, which may be marked as VLAN 1 to VLAN 1024 respectively, and port G1 is added to VLAN 1 to VLAN 1024 as a target port.
[0113] According to the configuration information, 1024 VLANs are created for the second switch, which can be marked as VLAN 1 to VLAN 1024 respectively, and port G1 is added to VLAN 1 to VLAN 1024 as a target port.
[0114] S2022: Create corresponding logical interfaces in each virtual local area network, and configure an Internet Protocol address for each logical interface according to a mapping relationship between the switch and the Internet Protocol address.
[0115] Among them, the logical interface (vlanif) refers to the virtual interface created in the virtual LAN, which is used to achieve the logical isolation and communication of VLAN. It is created on a three-layer switch or router to connect the communication between different VLANs.
[0116] In the mapping relationship between switches and Internet Protocol addresses, the IP address range corresponding to the first switch is different from the IP address range corresponding to the second switch, and Internet Protocol addresses of different logical interfaces of the same switch are different.
[0117] As a possible implementation method, for a target switch, the Internet Protocol address range corresponding to the target switch is determined according to the mapping relationship between the switch and the Internet Protocol address, and the target switch is the first switch or the second switch; multiple logical interfaces are divided into multiple groups of logical interfaces, and the number of logical interfaces in each group is less than 255, so as to comply with the IP address range. Different network segments are allocated to logical interfaces belonging to different groups according to the Internet Protocol address range, and logical interfaces in the same group have different Internet Protocol addresses. In this way, different IP addresses can be configured for multiple logical interfaces in an automatic manner, which is convenient and quick.
[0118] Continue to use the example of testing whether the maximum number of neighbors established by the first switch and the second switch through the OSPF protocol is 1024 for description.
[0119] Create logical interfaces for the first switch and configure IP addresses for each logical interface as follows:
[0120] (1) Create logical interfaces vlanif 1 to vlanif 1024.
[0121] (2) Configure IP addresses 100.10.1.1 / 24 to 100.10.250.1 / 24 for logical interfaces vlanif 1 to vlanif 250 respectively.
[0122] (3) Configure IP addresses 100.20.1.1 / 24 to 100.20.250.1 / 24 for logical interfaces vlanif 251 to vlanif 500 respectively.
[0123] (4) The logical interfaces vlanif 501 to vlanif 750 are configured with IP addresses 100.30.1.1 / 24 to 100.30.250.1 / 24 respectively.
[0124] (5) The logical interfaces vlanif 751 to vlanif 1000 are configured with IP addresses 100.40.1.1 / 24 to 100.40.250.1 / 24 respectively.
[0125] (6) The logical interfaces vlanif 1001 to vlanif 1024 are configured with IP addresses 100.50.1.1 / 24 to 100.50.24.1 / 24 respectively.
[0126] Create logical interfaces for the second switch and configure IP addresses for each logical interface as follows:
[0127] (1) Create logical interfaces vlanif 1 to vlanif 1024.
[0128] (2) Configure IP addresses for logical interfaces vlanif 1 to vlanif 250: 100.10.1.2 / 24 to 100.10.250.2 / 24
[0129] (3) Configure IP addresses 100.20.1.2 / 24 to 100.20.250.2 / 24 for logical interfaces vlanif 251 to vlanif 500 respectively.
[0130] (4) Configure IP addresses 100.30.1.2 / 24 to 100.30.250.2 / 24 for logical interfaces vlanif 501 to vlanif 750 respectively.
[0131] (5) Configure IP addresses 100.40.1.2 / 24 to 100.40.250.2 / 24 for logical interfaces vlanif 751 to vlanif 1000 respectively.
[0132] (6) The logical interfaces vlanif 1001 to vlanif 1024 are configured with IP addresses 100.50.1.2 / 24 to 100.50.24.2 / 24 respectively.
[0133] S2023: Create an open shortest path first protocol routing process, and create a routing identifier corresponding to the switch for the routing process according to the correspondence between the switch and the routing identifier.
[0134] An OSPF routing process is created, and a routing identifier is configured for the routing process so that the routing process can be used. In the correspondence between the switch and the routing identifier, the routing identifier corresponding to the first switch is different from the routing identifier corresponding to the second switch.
[0135] S2024: Announce the network segment address of each logical interface in the backbone area.
[0136] Continue to use the example of testing whether the maximum number of neighbors established by the first switch and the second switch through the OSPF protocol is 1024 for description.
[0137] The operations for configuring OSPF on the first switch are as follows:
[0138] (1) Create OSPF process 1 and configure Router-ID 1.1.1.1.
[0139] (2) In area 0 (backbone area), the network segment address of logical interfaces vlanif 1 to vlanif 250 is announced as 100.10.0.0 / 16.
[0140] (3) In area 0, the network segment address of logical interfaces vlanif 251 to vlanif 500 is announced as 100.20.0.0 / 16.
[0141] (4) In area 0, the network segment address of logical interfaces vlanif 501 to vlanif 750 is announced as 100.30.0.0 / 16.
[0142] (5) In area 0, the network segment address of the logical interface vlanif 751 to vlanif 1000 is announced as 100.40.0.0 / 16
[0143] (6) In area 0, the network segment address of the logical interface vlanif 1001 to vlanif1024 is announced as 100.50.0.0 / 16
[0144] To configure OSPF on the second switch:
[0145] (1) Create OSPF process 1 and configure Router-ID 2.2.2.2.
[0146] (2) In area 0, the network segment address of logical interfaces vlanif 1 to vlanif 250 is announced as 100.10.0.0 / 16.
[0147] (3) In area 0, the network segment address of logical interfaces vlanif 251 to vlanif 500 is announced as 100.20.0.0 / 16.
[0148] (4) In area 0, the network segment address of logical interfaces vlanif 501 to vlanif 750 is announced as 100.30.0.0 / 16.
[0149] (5) In area 0, the network segment address of logical interfaces vlanif 751 to vlanif 1000 is announced as 100.40.0.0 / 16.
[0150] (6) In area 0, the network segment address of the logical interfaces vlanif 1001 to vlanif1024 is announced as 100.50.0.0 / 16.
[0151] S203: Acquire a first neighbor state machine of the first switch and a second neighbor state machine of the second switch.
[0152] After the first switch and the second switch establish a neighbor relationship through the open shortest path first protocol, in order to determine whether the neighbor relationship between the first switch and the second switch is successfully established, the neighbor state machine of each switch can be obtained, that is, the first neighbor state machine of the first switch and the second neighbor state machine of the second switch are obtained.
[0153] The first neighbor state machine is used to describe the situation of multiple neighbor relationships established between the first switch and the second switch, such as obtaining 1024 first neighbor state machines, and the second neighbor state machine is used to describe the situation of multiple neighbor relationships established between the second switch and the first switch, such as obtaining 1024 second neighbor state machines.
[0154] S204: Determine the maximum number of neighbors established by the first switch through the OSPF protocol according to the first neighbor state machine, and determine the maximum number of neighbors established by the second switch through the OSPF protocol according to the second neighbor state machine.
[0155] As mentioned above, OSPF has 8 neighbor state machines, namely Down, Attempt, Init, 2-Way, Exstart, Exchange, Loading, and Full. The maximum number of neighbors established by each switch through the OSPF protocol can be determined based on the status of each neighbor state machine.
[0156] As a possible implementation, if the number of normal states included in the first neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test. If the number of normal states included in the second neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the second switch passes the test.
[0157] Among them, the normal state refers to the Full state. For example, if the maximum number of neighbors to be tested is 1024, and the 1024 first neighbor state machines are all in the Full state, it means that the first switch has established 1024 neighbors with the second switch through the OSPF protocol, that is, the number of neighbors established by the first switch and the second switch meets the maximum number of neighbors required for the test, that is, the first switch and the second switch have passed the test of the maximum number of neighbors of the OSPF protocol. The first switch and the second switch can successfully exchange DD messages and LSAs through 1024 OSPF neighbors, and can learn routing information normally.
[0158] It can be seen from the above technical solution that the maximum number of neighbors of the OSPF protocol of the switch is no longer tested by a tester supporting the OSPF protocol, but two switches that need to test the maximum number of neighbors of the OSPF protocol are used to test each other, thereby reducing the cost of the test equipment. Specifically, the configuration information is obtained, and the configuration operation is performed on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the OSPF protocol. In order to clarify the establishment of the neighbor relationship, it is also necessary to obtain the neighbor state machine of the switch, that is, the first neighbor state machine of the first switch and the second neighbor state machine of the second switch, and determine the maximum number of neighbors established by the first switch through the OSPF protocol according to the first neighbor state machine, and determine the maximum number of neighbors established by the second switch through the OSPF protocol according to the second neighbor state machine, so as to automatically complete the test of the maximum number of neighbors of the OSPF protocol for the switch according to the configuration information, reducing the workload of the tester. In addition, the test of the two switches is also realized at the same time, which improves the test efficiency of the switch.
[0159] In addition, during the process of establishing OSPF neighbors between switch A and switch B, the neighbors may not be established normally. If the OSPF neighbors cannot be established normally, that is, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the embodiment of the present application provides two methods for troubleshooting, which are described below.
[0160] Method 1: Introduce a third switch for troubleshooting.
[0161] A1: Perform a configuration operation on the third switch according to the configuration information, so that the first switch and the third switch establish a neighbor relationship through the open shortest path first protocol.
[0162] Perform configuration operations on the third switch according to the configuration information, so that the first switch and the third switch establish a neighbor relationship through the open shortest path first protocol, such as Figure 4 As shown, switch A is the first switch and switch C is the third switch.
[0163] The third switch is a switch that passes the OSPF protocol maximum neighbor number test, that is, the third switch is a normal state machine.
[0164] The configuration operation performed on the third switch according to the configuration information may refer to the configuration operation performed on the first switch and the second switch, which will not be described in detail here.
[0165] A2: Obtain the third neighbor state machine of the first switch.
[0166] The third neighbor state is used to describe the situation of multiple neighbor relationships established between the first switch and the third switch, such as obtaining 1024 third neighbor state machines.
[0167] A3: If the number of normal states included in the third neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test; if the number of normal states included in the third neighbor state machine is different from the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch fails the test.
[0168] If the number of normal states included in the third neighbor state machine is the same as the maximum number of neighbors to be tested, it means that the number of neighbors established between the first switch and the third switch meets the test requirements, and the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test.
[0169] If the number of normal states included in the third neighbor state machine is different from the maximum number of neighbors to be tested, it means that the maximum number of neighbors established between the first switch and the third switch does not meet the test requirements, and the third switch is a switch that has been clearly tested, then the maximum number of neighbors of the open shortest path first protocol for the first switch fails the test.
[0170] As a possible implementation manner, if the first switch and the second switch fail the test, and the first switch and the third switch pass the test, it can be determined that the second switch fails the test.
[0171] In addition, in order to ensure the accuracy of the test results, a configuration operation can also be performed on the third switch according to the configuration information, so that the second switch and the third switch establish a neighbor relationship through the open shortest path first protocol. Obtain the fourth neighbor state machine of the second switch. If the number of normal states included in the fourth neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the second switch passes the test; if the number of normal states included in the fourth neighbor state machine is not the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the second switch fails the test, such as Figure 5 As shown, switch B is the second switch and switch C is the third switch.
[0172] Therefore, the first switch and the second switch can be checked by introducing the third switch, which is convenient and quick.
[0173] Method 2: Check based on existing information.
[0174] B1: Obtain the network connection status between the first switch and the second switch.
[0175] Among them, the network connection status between the two switches can be obtained by pinging each other.
[0176] See also Figure 6 , which is a schematic diagram of an OSPF neighbor reaching a FULL state provided by an embodiment of the present application. The first switch (DUT1) and the second switch DUT2 establish an OSPF neighbor through the physical interface 1 / 0 / 4 and the vlanif1024 logical interface, and the OSPF neighbor is established normally and reaches the FULL state.
[0177] B2: If the network connection state is connected, obtain the sending information and receiving information of the first switch through the troubleshooting command, and determine the inconsistent information between the sending information and the receiving information as the cause of the fault.
[0178] The troubleshooting command is a debug command, the information sent by the first switch refers to the information sent by the first switch when establishing a neighbor relationship with the second switch, and the information received by the first switch may also be the information sent by the second switch.
[0179] The network connection status of the first switch (DUT1) is as follows Fig.10 As shown, the network connection status of the second switch (DUT2) is as follows Fig.11 shown.
[0180] If the two switches can ping each other, open the debug command "debug ospf all" on both switches and check the error information that the OSPF neighbor relationship cannot be established based on the printed debug information. The OSPF debug information printed by the first switch (DUT1) is the sending information, such as Figure 7 As shown, the OSPF Debug information printed by the second switch (DUT2), that is, the received information, is as follows Figure 8 shown.
[0181] Depend on Figure 7 and Figure 8As shown in the figure, according to the OSPF Debug information printed by the first switch (DUT1) and the second switch (DUT2), it can be seen that the hello interval mismatch causes the OSPF neighbor relationship to fail to be established normally. Figure 7 It can be seen that the hello interval of the first switch (DUT1) is 20. Figure 8 It can be seen that the hellointerval of the second switch (DUT2) is 10.
[0182] Check the configuration of the logical interface vlanif1024 of the first switch (DUT1) and find that ospf hellointerval 20 is configured. Fig. 9 Therefore, the ospf hello interval 20 configured on the logical interface vlanif1024 of the first switch (DUT1) can be deleted so that the OSPF neighbors of the switches at both ends can be established normally and reach the FULL state.
[0183] B3: If the network connection status is disconnected, obtain the physical connection status and link connection status of the physical interface of the first switch and the second switch. If the physical connection status and link connection status of the physical interface are disconnected, the fault cause is a physical link failure. If the physical connection status and link connection status of the physical interface are connected, obtain the link status of the logical interface. If the link status of the logical interface is disconnected, the fault cause is a logical interface failure.
[0184] If the network connection status is disconnected, you need to check the physical link first, that is, obtain the physical connection status and link connection status of the physical interface of the first switch and the second switch. If the physical connection status and link connection status of the physical interface are disconnected, the fault is caused by a physical link fault. If the physical connection status and link connection status of the physical interface are connected, you need to continue to check the virtual link, that is, obtain the link status of the logical interface. If the link status of the logical interface is disconnected, the fault is caused by a logical interface fault.
[0185] For example, if the two ends of the switch cannot ping each other, check whether the physical status and protocol status of the interfaces at both ends of the neighbor are connected (UP). If the physical interface is not UP (that is, the physical connection status and link connection status of the physical interface are not connected), such as Fig.14 If the VLANIF interface is not UP (that is, the link status of the logical interface is not connected), check the configuration to ensure that the VLANIF interface is not shut down. Fig.15 shown.
[0186] In addition to providing a method for testing the maximum number of neighbors of the OSPF protocol, the embodiment of the present application also provides a device for testing the maximum number of neighbors of the OSPF protocol, such as Fig.16 As shown, it includes: a first acquisition unit 1601, a configuration unit 1602, a second acquisition unit 1603 and a determination unit 1604;
[0187] The first acquisition unit 1601 is used to acquire configuration information, where the configuration information includes a target port for communicating with a peer switch, a maximum number of neighbors to be tested, a mapping relationship between a switch and an Internet Protocol address, and a corresponding relationship between a switch and a routing identifier;
[0188] The configuration unit 1602 is configured to perform configuration operations on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the open shortest path first protocol;
[0189] The second acquiring unit 1603 is configured to acquire a first neighbor state machine of the first switch and a second neighbor state machine of the second switch;
[0190] The determining unit 1604 is configured to determine the maximum number of neighbors established by the first switch through the open shortest path first protocol according to the first neighbor state machine, and determine the maximum number of neighbors established by the second switch through the open shortest path first protocol according to the second neighbor state machine.
[0191] It can be seen from the above technical solution that the maximum number of neighbors of the OSPF protocol of the switch is no longer tested by a tester supporting the OSPF protocol, but two switches that need to test the maximum number of neighbors of the OSPF protocol are used to test each other, thereby reducing the cost of the test equipment. Specifically, the configuration information is obtained, and the configuration operation is performed on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the OSPF protocol. In order to clarify the establishment of the neighbor relationship, it is also necessary to obtain the neighbor state machine of the switch, that is, the first neighbor state machine of the first switch and the second neighbor state machine of the second switch, and determine the maximum number of neighbors established by the first switch through the OSPF protocol according to the first neighbor state machine, and determine the maximum number of neighbors established by the second switch through the OSPF protocol according to the second neighbor state machine, so as to automatically complete the test of the maximum number of neighbors of the OSPF protocol for the switch according to the configuration information, reducing the workload of the tester. In addition, the test of the two switches is also realized at the same time, which improves the test efficiency of the switch.
[0192] As a possible implementation manner, the configuration unit 1602 is specifically configured to:
[0193] Creating a plurality of virtual local area networks having the same number as the maximum number of neighbors to be tested according to the configuration information, and adding the target port to the plurality of virtual local area networks;
[0194] Creating corresponding logical interfaces in each of the virtual local area networks, respectively, and configuring an Internet Protocol address for each of the logical interfaces according to a mapping relationship between the switch and the Internet Protocol address, wherein different logical interfaces have different Internet Protocol addresses;
[0195] Creating a routing process of the open shortest path first protocol, and creating a routing identifier corresponding to the switch for the routing process according to the correspondence between the switch and the routing identifier;
[0196] The network segment address of each of the logical interfaces is announced in the backbone area.
[0197] As a possible implementation manner, the configuration unit 1602 is specifically configured to:
[0198] For a target switch, determining an Internet Protocol address range corresponding to the target switch according to a mapping relationship between the switch and the Internet Protocol address, the target switch being the first switch or the second switch;
[0199] Dividing the plurality of logical interfaces into a plurality of groups of logical interfaces, the number of logical interfaces in each group being less than 255;
[0200] Different network segments are allocated to logical interfaces belonging to different groups according to the Internet Protocol address range, and logical interfaces in the same group have different Internet Protocol addresses.
[0201] As a possible implementation manner, the determining unit 1604 is specifically configured to:
[0202] If the number of normal states included in the first neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test;
[0203] If the number of normal states included in the second neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the OSPF protocol for the second switch passes the test.
[0204] As a possible implementation manner, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the determining unit 1604 is further used to:
[0205] Performing a configuration operation on the third switch according to the configuration information, so that the first switch and the third switch establish a neighbor relationship through the open shortest path first protocol, and the third switch is a switch that passes the maximum number of neighbors test of the open shortest path first protocol;
[0206] Obtaining a third neighbor state machine of the first switch;
[0207] If the number of normal states included in the third neighbor state machine is the same as the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch passes the test; if the number of normal states included in the third neighbor state machine is different from the maximum number of neighbors to be tested, the maximum number of neighbors of the open shortest path first protocol for the first switch fails the test.
[0208] As a possible implementation manner, if the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the determining unit 1604 is further used to:
[0209] Obtaining a network connection status between the first switch and the second switch;
[0210] If the network connection state is a connected state, obtaining the sending information and receiving information of the first switch through a troubleshooting command, and determining inconsistent information between the sending information and the receiving information as a cause of the fault;
[0211] If the network connection status is a disconnected state, the physical connection status and the link connection status of the physical interfaces of the first switch and the second switch are obtained; if the physical connection status and the link connection status of the physical interface are a disconnected state, the fault cause is a physical link fault; if the physical connection status and the link connection status of the physical interface are a connected state, the link status of the logical interface is obtained; if the link status of the logical interface is a disconnected state, the fault cause is a logical interface fault.
[0212] The present application also provides a computer device, see Fig.17 , which shows a structural diagram of a computer device provided in an embodiment of the present application, such as Fig.17 As shown, the device includes a memory 1710 and a processor 1720:
[0213] The memory 1710 is used to store program codes and transmit the program codes to the processor;
[0214] The processor 1720 is used to execute any one of the methods for testing the maximum number of neighbors of the OSPF protocol provided in the above embodiments according to the instructions in the program code.
[0215] An embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program. The computer program is used to execute any one of the methods for testing the maximum number of neighbors of the OSPF protocol provided in the above embodiments.
[0216] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method for testing the maximum number of neighbors of the OSPF protocol provided in various optional implementations of the above aspects.
[0217] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0218] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0219] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0220] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0221] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for testing the maximum number of neighbors of the OSPF protocol, characterized in that: The method comprises: Obtaining configuration information, the configuration information including a target port for communicating with a peer switch, a maximum number of neighbors to be tested, a mapping relationship between a switch and an Internet Protocol address, and a mapping relationship between a switch and a routing identifier; Performing configuration operations on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the Open Shortest Path First protocol; Obtain a first neighbor state machine of the first switch and a second neighbor state machine of the second switch; The maximum number of neighbors established by the first switch through the OSPF protocol is determined according to the first neighbor state machine, and the maximum number of neighbors established by the second switch through the OSPF protocol is determined according to the second neighbor state machine.
2. The method according to claim 1, characterized in that The configuration operation includes: Creating a plurality of virtual local area networks (VLANs) having the same number as the maximum number of neighbors to be tested according to the configuration information, and adding the target port to the plurality of virtual local area networks; Creating corresponding logical interfaces in each of the virtual local area networks, and configuring an Internet Protocol address for each of the logical interfaces according to a mapping relationship between the switch and the Internet Protocol address, wherein the Internet Protocol addresses of different logical interfaces are different; Creating a routing process of the open shortest path first protocol, and creating a routing identifier corresponding to the switch for the routing process according to the correspondence between the switch and the routing identifier; The network segment address of each logical interface is announced in the backbone area.
3. The method according to claim 2, characterized in that The configuring an Internet Protocol address for each of the logical interfaces according to the mapping relationship between the switch and the Internet Protocol address includes: For a target switch, determining an Internet Protocol address range corresponding to the target switch according to a mapping relationship between the switch and the Internet Protocol address, where the target switch is the first switch or the second switch; Dividing the plurality of logical interfaces into a plurality of groups of logical interfaces, wherein the number of logical interfaces in each group is less than 255; Different network segments are allocated to logical interfaces belonging to different groups according to the Internet Protocol address range, and logical interfaces in the same group have different Internet Protocol addresses.
4. The method according to claim 1, wherein The determining, according to the first neighbor state machine, a maximum number of neighbors established by the first switch through the Open Shortest Path First protocol, and determining, according to the second neighbor state machine, a maximum number of neighbors established by the second switch through the Open Shortest Path First protocol, includes: If the number of normal states included in the first neighbor state machine is the same as the maximum number of neighbors to be tested, the test for the maximum number of neighbors of the OSPF protocol for the first switch passes; If the number of normal states included in the second neighbor state machine is the same as the maximum number of neighbors to be tested, the test of the maximum number of neighbors of the OSPF protocol for the second switch passes.
5. The method according to claim 4, characterized in that If the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the method further includes: Performing a configuration operation on a third switch according to the configuration information, so that the first switch and the third switch establish a neighbor relationship through the OSPF protocol, wherein the third switch is a switch that passes a maximum neighbor number test of the OSPF protocol; Obtaining a third neighbor state machine of the first switch; If the number of normal states included in the third neighbor state machine is the same as the maximum number of neighbors to be tested, the test for the maximum number of neighbors of the OSPF protocol for the first switch passes; if the number of normal states included in the third neighbor state machine is different from the maximum number of neighbors to be tested, the test for the maximum number of neighbors of the OSPF protocol for the first switch fails.
6. The method according to claim 1, characterized in that If the number of normal states included in the first neighbor state machine is different from the maximum number of neighbors to be tested, the method further includes: Obtaining a network connection status between the first switch and the second switch; If the network connection state is connected, obtaining the sending information and receiving information of the first switch through a troubleshooting command, and determining inconsistent information between the sending information and the receiving information as a cause of the fault; If the network connection status is disconnected, the physical connection status and link connection status of the physical interfaces of the first switch and the second switch are obtained. If the physical connection status and link connection status of the physical interfaces are disconnected, the fault cause is a physical link failure. If the physical connection status and link connection status of the physical interfaces are connected, the link status of the logical interface is obtained. If the link status of the logical interface is disconnected, the fault cause is a logical interface failure.
7. A device for testing the maximum number of neighbors of the OSPF protocol, characterized in that: The device includes: a first acquisition unit, a configuration unit, a second acquisition unit and a determination unit; The first acquiring unit is configured to acquire configuration information, the configuration information including a target port for communicating with a peer switch, a maximum number of neighbors to be tested, a mapping relationship between a switch and an Internet Protocol address, and a corresponding relationship between a switch and a routing identifier; The configuration unit is configured to perform configuration operations on the first switch and the second switch respectively according to the configuration information, so that the first switch and the second switch establish a neighbor relationship through the Open Shortest Path First protocol; The second acquiring unit is configured to acquire a first neighbor state machine of the first switch and a second neighbor state machine of the second switch; The determining unit is configured to determine a maximum number of neighbors established by the first switch through the Open Shortest Path First protocol according to the first neighbor state machine, and to determine a maximum number of neighbors established by the second switch through the Open Shortest Path First protocol according to the second neighbor state machine.
8. A computer device, characterized in that: The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1 to 6 according to instructions in the program code.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises a computer program or an instruction; when the computer program or the instruction is executed by a processor, the method according to any one of claims 1 to 6 is executed.
