A precise calculation method for dual redundant network card switching time in VxWorks

By obtaining the network card interface status in real time in VxWorks operating system and simulating faults, calculating the switching time of dual redundant network card, the problem of low accuracy and inconvenience in the existing technology is solved, and high-precision network card switching time measurement is realized, suitable for Various dual redundant network card switching programs.

CN113612621BActive Publication Date: 2024-12-27TIANJIN JINHANG COMP TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110687563.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-21
Publication Date
2024-12-27
Estimated Expiration
2041-06-21

AI Technical Summary

Technical Problem

The prior art is not very accurate when measuring the switching time of dual redundant network cards under VxWorks operating system, and is affected by the test program architecture and network traffic stability. The existing methods are not portable or have poor functional customization.

Method used

By connecting two network cards in the VxWorks operating system, obtaining the network card interface status flag in real time, simulating the failed network card disconnection time T1 and the backup network card normal working time T2, calculating the switching time of the dual redundant network card, and using the ipcom_sysctl function to obtain the network card status to ensure that The network card is on the same switch, avoiding application-layer communication delays and network traffic interference.

Benefits of technology

It realizes accurate measurement of the switching time of dual redundant network card, with simple timing method and small errors. It is suitable for various dual redundant network card switching programs and is independent of network traffic.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

A method for accurately calculating the switching time of dual redundant network cards under VxWorks belongs to the field of computer technology. The method modifies the ipnet_cmd_ifconfig function in the VxWorks kernel so that each time it is called, the ipnet_ifconfig_print_info function is called; the ipcom_sysctl function in the ipnet_ifconfig_print_info function is called to obtain the ifm_flags parameter value, i.e., the status flag of the network card interface, in real time; the dual network switching program is first run, and the two devices connected to the network card are ensured to perform network communication normally. The physical connection between the switch and one of the network cards is cut off to simulate the failure of the network card. When it is determined that the interface status flag of any network card in the ipcom_sysctl function is not in the running state, it indicates that the physical link of the network card has been disconnected, and the system time T at this time is recorded. 1 ; When the interface status flag of any network card in the ipcom_sysctl function is up and running, it indicates that the network card has been successfully linked and started to work normally. The system time T at this time is recorded 2 ; Subtract the system time obtained twice to obtain the switching time of the dual redundant network card (T 2 ‑T 1 ).
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for accurately calculating the switching time of dual redundant network cards under a VxWorks operating system, and belongs to the technical field of computers. Background Art

[0002] With the rapid development of computer system network technology, higher and higher requirements are placed on the network stability, anti-interference and bandwidth capabilities of the VxWorks operating system. In order to avoid the situation where the control equipment based on the VxWorks operating system is paralyzed or fails in the entire network when a local network is interrupted or fails, a dual redundant switching network system is usually used in the VxWorks control system, and two network cards are used physically at the same time. At the same time, only one network card is in working state, and the other network card is in standby state. Therefore, the switching time of the dual redundant network card is directly related to the performance of the control equipment based on the VxWorks operating system, and becomes the core indicator for measuring the reliability of the control system network.

[0003] The switching time of dual redundant network cards in the VxWorks operating system refers to the time it takes for a working network card to automatically switch to another standby network card and start working normally after a failure. The existing methods for monitoring the switching time of dual redundant network cards in the industry are mainly divided into the following two types:

[0004] (1) Monitoring through network performance tester or test tool

[0005] The advantage of this method is that there is no need to develop monitoring software. The disadvantage is that it is too limited, the instrument is inconvenient to carry, or an operating environment supported by third-party software is required, and function customization cannot be achieved.

[0006] (2) Monitoring using self-developed testing software

[0007] At present, the most common method for testing the switching time of dual redundant network cards under the VxWorks operating system is to send a fixed-length message to the system under test through the test platform, and the system under test will respond to the test platform immediately after receiving the message. The test platform counts the network card switching time by monitoring the number of message losses during the network card switching process. Although this test method is relatively flexible and easy to operate, the measurement error is too large and the accuracy is not high. The measurement results are largely affected by two factors: the rationality of the test program architecture and the stability of network traffic. Summary of the invention

[0008] The technical problem solved by the present invention is: to overcome the deficiencies of the prior art, to provide an accurate calculation method for the switching time of dual redundant network cards under VxWorks, and to achieve accurate measurement and calculation of the switching time of dual redundant network cards.

[0009] The technical solution of the present invention is: a method for accurately calculating the switching time of dual redundant network cards under VxWorks, comprising the following steps:

[0010] S1: Connect the device under test running the VxWorks operating system and two network cards, and check the connection and working status of the two network cards;

[0011] S2: Obtain the interface status flag of the network card in real time to detect whether the working status of the network card is normal in real time;

[0012] S3: simulate a network card to be in a faulty state, and record the time T1 when the faulty network card is disconnected;

[0013] S4: Record the time T2 when the standby network card works normally;

[0014] S5: Calculate the dual redundant network card switching time based on the time T1 when the failed network card is disconnected and the time T2 when the standby network card is working normally.

[0015] Furthermore, when executing S1, the two network cards in the tested device are connected to the same network switch, and the working status of the two network cards are both normal.

[0016] Furthermore, the method for obtaining the interface status flag of the network card in real time is to call the ipcom_sysctl function in the VxWorks operating system.

[0017] Furthermore, the method for recording the time T2 when the standby network card works normally is: when it is determined that the fault flag of one of the network cards is valid, and the D0 bit and D6 bit of the interface status flag of the other network card are up and running respectively, the system time T2 at this time is recorded in the VxWorks operating system.

[0018] Furthermore, the dual redundant network card switching time is T2-T1.

[0019] A precise calculation system for dual redundant network card switching time under VxWorks, comprising:

[0020] The first module connects the tested device running the VxWorks operating system and two network cards to check the connection and working status of the two network cards;

[0021] The second module obtains the interface status flag of the network card in real time, which is used to detect whether the working status of the network card is normal in real time;

[0022] The third module simulates a network card as a faulty state and records the time T1 when the faulty network card disconnects;

[0023] The fourth module records the time T2 when the standby network card works normally;

[0024] The fifth module calculates the dual redundant network card switching time based on the time T1 when the failed network card is disconnected and the time T2 when the standby network card works normally.

[0025] Furthermore, in the first module, the two network cards in the tested device are connected to the same network switch, and the working status of the two network cards are both normal;

[0026] The method for obtaining the interface status flag of the network card in real time is to call the ipcom_sysctl function in the VxWorks operating system.

[0027] Further, the method for recording the time T2 when the standby network card works normally is: when it is determined that the fault flag of one of the network cards is valid, and the D0 bit and D6 bit of the interface status flag of the other network card are respectively in the up and running states, recording the system time T2 at this time in the VxWorks operating system;

[0028] The dual redundant network card switching time is T2-T1.

[0029] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a method for accurately calculating the switching time of dual redundant network cards under VxWorks.

[0030] A device for accurately calculating the switching time of dual redundant network cards under VxWorks comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for accurately calculating the switching time of dual redundant network cards under VxWorks are implemented.

[0031] The advantages of the present invention compared with the prior art are:

[0032] 1. The timing method is simple and the calculation time is highly accurate;

[0033] 2. The network connection status is judged from the physical driver layer, and the network card switching time is calculated, avoiding the communication delay of the application layer and the interference and influence of the system network traffic, and has the characteristics of small calculation error;

[0034] 3. This method can be used to calculate the network card switching time of various dual redundant network card switching programs under the VxWorks operating system. DETAILED DESCRIPTION

[0035] In order to better understand the above technical scheme, the technical scheme of the present application is described in detail through specific embodiments below. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical scheme of the present application, rather than limitations on the technical scheme of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.

[0036] The switching time of the dual redundant network cards under the VxWorks operating system is essentially the time from "the faulty network card disconnects the link" to "the standby network card starts working and successfully establishes the link". The switching time of the dual redundant network cards should be independent of the current network traffic size of the system. Based on this premise, in order to achieve the above purpose, the present invention adopts the following technical solutions:

[0037] 1. Before starting the dual network card switching time test, make sure that the two network cards in the tested device are connected to the same network switch;

[0038] 2. Call the ipcom_sysctl function in the VxWorks operating system kernel to obtain the status flag of the network card interface in real time;

[0039] 3. Run the dual network switching program first, and ensure that the two devices connected to the network card are communicating normally. Cut off the physical connection between the switch and one of the network cards to simulate the failure of the network card. When the interface status flag of any network card in the ipcom_sysctl function is not in the running state, it indicates that the physical link of the network card has been disconnected, and record the system time T1 at this time;

[0040] 4. When the interface status flag of any network card in the ipcom_sysctl function is up and running, it indicates that the network card has been successfully linked and started to work normally. The system time T2 at this time is recorded;

[0041] 5. Subtract the system time obtained from the two times and get the switching time of the dual redundant network card as (T2-T1).

[0042] In the solution provided in the embodiment of the present application, in order to accurately measure and calculate the switching time of dual redundant network cards, the present invention proposes an accurate calculation method for the switching time of dual redundant network cards under VxWorks. The implementation steps of the method are as follows:

[0043] S1: Check the connection and working status of the two network cards

[0044] Before starting the dual network card switching time test, make sure that both network cards in the tested device are connected to the same network switch. Before running the dual network card switching program, make sure that both network cards are working normally.

[0045] S2: Get the interface status flag of the network card in real time

[0046] Calling the ipcom_sysctl function in the VxWorks operating system can obtain the status flag of the network card interface in real time. Among them, the D0 bit of the status flag of the network card interface indicates whether the network card is in the up state (1 indicates that it is in the up state, and 0 indicates that it is in the down state), and the D6 bit of the flag indicates whether the network card driver is in the opened / running state (1 indicates that it is in the opened / running state, and 0 indicates that it is not in the opened / running state).

[0047] Create a task A, which obtains the status flag of the network card interface in real time by calling the ipcom_sysctl function in the VxWorks operating system kernel in real time to determine the current working status of the network card.

[0048] S3: Record the time when the faulty network card disconnects T1

[0049] First, connect all devices that communicate with the network to the network switch, and ensure that the devices can communicate with each other normally, and then run the dual redundant network card switching program. Manually cut off the physical connection between the network switch and one of the network cards to simulate the failure of the network card. When calling the ipcom_sysctl function in real time and judging the interface status flag of the network card, once the D6 bit of the interface status flag of any network card is not in the opened / running state, it indicates that the physical link of the network card has been disconnected. At this time, record the system time T1 in the VxWorks operating system, and set the network card failure flag to be valid.

[0050] S4: Record the time T2 when the standby network card works normally

[0051] In task A, when it is determined that the fault flag of one of the network cards is valid, and the D0 bit and D6 bit of the interface status flag of the other network card are up and running respectively, it indicates that the other network card has been successfully linked and started to work normally, that is, the dual redundant network card switching work is completed. At this time, the system time T2 is recorded in the VxWorks operating system.

[0052] S5: Calculate the switching time of dual redundant network cards

[0053] The switching time of the dual redundant network cards is obtained by subtracting the system time obtained in step S3 from that in step S4, which is (T2-T1).

[0054] Based on the same inventive concept as a method for accurately calculating the switching time of dual redundant network cards under VxWorks, the present invention also provides a system for accurately calculating the switching time of dual redundant network cards under VxWorks, characterized in that it includes:

[0055] The first module connects the tested device running the VxWorks operating system and two network cards to check the connection and working status of the two network cards;

[0056] The second module obtains the interface status flag of the network card in real time, which is used to detect whether the working status of the network card is normal in real time;

[0057] The third module simulates a network card as a faulty state and records the time T1 when the faulty network card disconnects;

[0058] The fourth module records the time T2 when the standby network card works normally;

[0059] The fifth module calculates the dual redundant network card switching time based on the time T1 when the failed network card is disconnected and the time T2 when the standby network card works normally.

[0060] Furthermore, in a possible implementation, in the first module, two network cards in the tested device are connected to the same network switch, and the working status of the two network cards are both normal;

[0061] In a possible implementation, the method for obtaining the interface status flag of the network card in real time is to call the ipcom_sysctl function in the VxWorks operating system.

[0062] In a possible implementation, the method for recording the time T2 when the standby network card works normally is: when it is determined that the fault flag of one of the network cards is valid, and the D0 bit and the D6 bit of the interface status flag of the other network card are respectively in the up and running states, the system time T2 at this time is recorded in the VxWorks operating system;

[0063] Optionally, in a possible implementation, the dual redundant network card switching time is T2-T1.

[0064] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may 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 may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0065] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

[0066] The contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.

Claims

1. A method for accurately calculating the switching time of dual redundant network cards under VxWorks, characterized in that: The steps include: S1: Connect the device under test running the VxWorks operating system and two network cards, and check the connection and working status of the two network cards; S2: Obtain the interface status flag of the network card in real time to detect whether the working status of the network card is normal in real time; S3: simulate a network card to be in a faulty state, and record the time T1 when the faulty network card is disconnected; S4: Record the time T2 when the standby network card works normally; S5: Calculate the dual redundant network card switching time based on the time T1 when the failed network card is disconnected and the time T2 when the standby network card is working normally; The method for recording the time T2 when the standby network card works normally is as follows: when it is determined that the fault flag of one of the network cards is valid, and the D0 bit and D6 bit of the interface status flag of the other network card are respectively in the up and running states, the system time T2 at this time is recorded in the VxWorks operating system; The dual redundant network card switching time is T2-T1.

2. According to claim 1, a method for accurately calculating the switching time of dual redundant network cards under VxWorks is characterized in that: When executing S1, the two network cards in the tested device are connected to the same network switch, and the working status of the two network cards are both normal.

3. The method for accurately calculating the switching time of dual redundant network cards under VxWorks according to claim 1, characterized in that: The method for obtaining the interface status flag of the network card in real time is to call the ipcom_sysctl function in the VxWorks operating system.

4. A precise calculation system for dual redundant network card switching time under VxWorks, characterized in that: include: The first module connects the tested device running the VxWorks operating system and two network cards to check the connection and working status of the two network cards; The second module obtains the interface status flag of the network card in real time, which is used to detect whether the working status of the network card is normal in real time; The third module simulates a network card as a faulty state and records the time T1 when the faulty network card disconnects; The fourth module records the time T2 when the standby network card works normally; The fifth module calculates the dual redundant network card switching time based on the time T1 when the failed network card is disconnected and the time T2 when the standby network card is working normally; The method for recording the time T2 when the standby network card works normally is as follows: when it is determined that the fault flag of one of the network cards is valid, and the D0 bit and D6 bit of the interface status flag of the other network card are respectively in the up and running states, the system time T2 at this time is recorded in the VxWorks operating system; The dual redundant network card switching time is T2-T1.

5. The system for accurately calculating the switching time of dual redundant network cards under VxWorks according to claim 4, characterized in that: In the first module, the two network cards in the tested device are connected to the same network switch, and the working status of the two network cards are made normal; The method for obtaining the interface status flag of the network card in real time is to call the ipcom_sysctl function in the VxWorks operating system.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

7. A device for accurately calculating the switching time of dual redundant network cards under VxWorks, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.