CN109639525B - Network interface detection method based on homemade operating system - Google Patents
Network interface detection method based on homemade operating system Download PDFInfo
- Publication number
- CN109639525B CN109639525B CN201811531468.8A CN201811531468A CN109639525B CN 109639525 B CN109639525 B CN 109639525B CN 201811531468 A CN201811531468 A CN 201811531468A CN 109639525 B CN109639525 B CN 109639525B
- Authority
- CN
- China
- Prior art keywords
- interface
- network
- returned
- name list
- returned result
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
Abstract
The invention relates to a network interface detection method based on a domestic operating system, which comprises the following steps: step 1, powering up a hardware system to start up; step 2, calling a network interface list of the domestic platform, and storing all read folder names as a name list; step 3, saving the returned result character string as the IP address of the equipment according to the name list; step 4, converting the obtained data in the u _ int8 format into an easily-readable character string format according to the name list; step 5, judging according to the name list; if the returned result is not null, the returned result character string is stored as the subnet mask of the equipment; step 6, analyzing the speed type of each interface according to the name list; step 7, analyzing the network connection state of each interface according to the name list, and if the returned result is empty, the link state of the network equipment cannot be read normally; if the returned result is connected, the connection is normal; if the returned result is not connected, the connection is abnormal.
Description
Technical Field
The invention relates to a technology of a home-made operating system interface, in particular to an interface detection method based on a home-made operating system.
Background
With the gradual promotion of the countries and the military to the construction of autonomous controllable key software and hardware, computers and safe and reliable information systems, the demand and the yield of the domestic equipment are continuously increased. The current mainstream domestic platform still has a certain instability, and each device network interface needs to be tested to ensure the quality of hardware devices.
The existing testing technology only can be used for manually testing by testing personnel, more manpower and time are consumed, although the testing effect is good, the automatic flow reconstruction is needed in the existing testing work along with the continuous increase of the yield.
Disclosure of Invention
The invention aims to provide a network interface detection method based on a homemade operating system, which is used for solving the problems in the prior art.
The invention relates to a network interface detection method based on a domestic operating system, which comprises the following steps: step 1, powering up a hardware system to start up; step 2, calling a network interface list of the home-made platform, reading the names of all the subfolders, and storing all the read folder names as a name list; step 3, according to the name list, sequentially calling an interface DisplayNetIP in an operating system ifconfig packet, obtaining an IP address of the interface according to a result returned by the interface, and if the returned result is empty, not setting the IP of the network equipment; if the returned result is not null, the returned result character string is stored as the IP address of the equipment; step 4, sequentially calling the interface DisplayNetMac in the operating system ifconfig packet according to the name list to obtain the MAC address of the interface, and if the obtained result is empty, determining that the MAC address is not set; if the data is not null, converting the obtained data in the u _ int8 format into an easily-readable character string format, and storing the data as the MAC address of the equipment; step 5, according to the name list, sequentially calling the interface DisplayNetMask in the operating system ifconfig packet to obtain a subnet mask of the interface, and if the returned result is empty, the network equipment does not set the subnet mask; if the returned result is not null, the returned result character string is stored as the subnet mask of the equipment; step 6, analyzing the speed type of each interface according to the name list, and if the returned result can be converted into a double type, storing the converted result as the speed type of the equipment; if the conversion fails, the network equipment does not provide the speed type information; step 7, analyzing the network connection state of each interface according to the name list, and if the returned result is empty, the link state of the network equipment cannot be read normally; if the returned result is connected, the connection is normal; if the returned result is not connected, the connection is abnormal.
According to an embodiment of the network interface detection method based on the localization operating system, the method further includes: and 8, if the connection state in the step 7 is normal connection, calling a NetPerf test tool to test the transmission speed of the TCP and UDP networks of the network interface, and using netPerf.
According to an embodiment of the network interface detection method based on the localization operating system, if the names returned by the name list in the step 2 are consistent with the number of the connected network devices, the network devices are considered to be connected correctly.
According to an embodiment of the method for detecting a network interface based on a localization operating system of the present invention, if the correct information is returned from step 3 to step 6, the configuration of the network device is considered to be correct.
According to an embodiment of the network interface detection method based on the localization operating system, if the information returned in step 7 is consistent with the actually connected network device, the hardware network connection is proved to be normal.
According to an embodiment of the network interface detection method based on the localization operating system, if the test is completed in step 8, the data transmission function of the network interface is normal, and the performance condition of the network interface is obtained.
The invention designs a full-automatic flow aiming at the network equipment interface detection of the autonomous controllable computer platform, and the test result relates to three aspects, thereby comprehensively reflecting the quality of the network equipment interface of the autonomous controllable computer. The testing method directly calls the system kernel interface without depending on an upper operating system, and the difference of different domestic platforms is solved.
Drawings
Fig. 1 is a flowchart of a network interface detection method based on a localization operating system.
Detailed Description
In order to make the objects, contents, and advantages of the present invention clearer, the following detailed description of the embodiments of the present invention will be made in conjunction with the accompanying drawings and examples.
Fig. 1 is a flowchart of a network interface detection method based on a localization operating system, and as shown in fig. 1, the test flow is developed for a localization platform, the test detection flow considers a network device with a standard RJ45 network port, and the network interface detection method based on the localization operating system includes:
1) and powering up the hardware system to start up.
2) And calling a network interface list of the domestic platform, reading the names of all the subfolders, and storing all the read folder names as a name list.
3) And sequentially calling the interface DisplayNetIP in the operating system ifconfig packet according to the name list, and obtaining the IP address of the interface according to the result returned by the interface. If the returned result is null, the network equipment does not set the IP; and if the returned result is not null, saving the character string of the returned result as the IP address of the equipment.
4) And sequentially calling the interfaces DisplayNetMac in the operating system ifconfig packet according to the name list to acquire the MAC addresses of the interfaces. If the obtained result is null, the MAC address is not set; and if the data is not null, converting the obtained data in the u _ int8 format into an easily-readable character string format, and storing the data as the MAC address of the device.
5) And sequentially calling the interfaces DisplayNetMask in the operating system ifconfig packet according to the name list to acquire subnet masks of the interfaces. If the returned result is null, the network equipment does not set a subnet mask; and if the return result is not null, saving the return result character string as the subnet mask of the equipment.
6) And analyzing the speed type of each interface from the operating system interface/sys/class/net/interface name/speed according to the name list. If the returned result can be converted into a double type, storing the converted result as the speed type of the equipment; if the translation fails, the network device does not provide speed type information.
7) And analyzing the network connection state of each interface from the operating system interface/sys/class/net/name/operator according to the name list. If the returned result is null, the link state of the network equipment cannot be read normally; if the returned result is connected, the connection is normal; if the returned result is not connected, the connection is abnormal.
8) And if the connection state in the step 7) is normal connection, calling a NetPerf test tool to test the transmission speed of the TCP and UDP networks of the network interface, and using netPerf.
9) If the name returned in the step 2) is consistent with the number of the connected network equipment, the network equipment is considered to be correctly connected; if the correct information is returned from the step 3) to the step 6), the configuration of the network equipment is considered to be correct; if the returned information in the step 7) is consistent with the actually connected network equipment, the hardware network connection is proved to be normal; and if the test is successfully completed in the step 8), the data transmission function of the network interface is proved to be normal, and the performance condition of the network interface can be obtained.
The invention can determine the name, IP address, MAC address, subnet mask, connection state, speed type and performance test data of the network device interface to determine the functional performance condition of the connected network device, thereby judging the quality condition of the mainboard interface.
The invention considers the current technical state of the autonomous controllable computer equipment, tests are required one by one when the autonomous controllable computer equipment leaves a factory, the test workload is large, and manpower and material resources are consumed. According to the invention, a domestic platform is researched, a network equipment interface detection process with strong pertinence is summarized, and full-automatic detection and testing are realized; and in consideration of differences of different brands of homemade equipment operating systems, the system kernel interfaces are called according to different test items, and the problem of software package loss of different platform operating systems is skipped, so that the cross-homed platform test is really realized.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.
Claims (6)
1. A network interface detection method based on a homemade operating system is characterized by comprising the following steps:
step 1, powering up a hardware system to start up;
step 2, calling a network interface list of the home-made platform, reading the names of all the subfolders, and storing all the read folder names as a name list;
step 3, according to the name list, sequentially calling an interface DisplayNetIP in an operating system ifconfig packet, obtaining an IP address of the interface according to a result returned by the interface, and if the returned result is empty, not setting the IP of the network equipment; if the returned result is not null, the returned result character string is stored as the IP address of the equipment;
step 4, sequentially calling the interface DisplayNetMac in the operating system ifconfig packet according to the name list to obtain the MAC address of the interface, and if the obtained result is empty, determining that the MAC address is not set; if the data is not null, converting the obtained data in the u _ int8 format into an easily-readable character string format, and storing the data as the MAC address of the equipment;
step 5, according to the name list, sequentially calling the interface DisplayNetMask in the operating system ifconfig packet to obtain a subnet mask of the interface, and if the returned result is empty, the network equipment does not set the subnet mask; if the returned result is not null, the returned result character string is stored as the subnet mask of the equipment;
step 6, analyzing the speed type of each interface according to the name list, and if the returned result can be converted into a double type, storing the converted result as the speed type of the equipment; if the conversion fails, the network equipment does not provide the speed type information;
step 7, analyzing the network connection state of each interface according to the name list, and if the returned result is empty, the link state of the network equipment cannot be read normally; if the returned result is connected, the connection is normal; if the returned result is not connected, the connection is abnormal.
2. The method for detecting network interfaces based on a localization operating system according to claim 1, further comprising: and 8, if the connection state in the step 7 is normal connection, calling a NetPerf test tool to test the transmission speed of the TCP and UDP networks of the network interface, and using netPerf.
3. The method as claimed in claim 1, wherein if the names returned from the name list in step 2 are consistent with the number of the connected network devices, the network devices are considered to be connected correctly.
4. The method as claimed in claim 1, wherein if the correct information is returned from step 3 to step 6, the configuration of the network device is considered to be correct.
5. The method as claimed in claim 1, wherein if the information returned in step 7 is consistent with the actually connected network device, the hardware network connection is proved to be normal.
6. The method for detecting network interface based on homemade operating system of claim 1, wherein if the test is completed in step 8, the data transmission function of the network interface is normal and the performance condition of the network interface is obtained.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811531468.8A CN109639525B (en) | 2018-12-14 | 2018-12-14 | Network interface detection method based on homemade operating system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811531468.8A CN109639525B (en) | 2018-12-14 | 2018-12-14 | Network interface detection method based on homemade operating system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109639525A CN109639525A (en) | 2019-04-16 |
CN109639525B true CN109639525B (en) | 2022-05-17 |
Family
ID=66073920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811531468.8A Active CN109639525B (en) | 2018-12-14 | 2018-12-14 | Network interface detection method based on homemade operating system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109639525B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107632913B (en) * | 2017-09-28 | 2020-08-25 | 北京计算机技术及应用研究所 | Storage equipment and interface testing method based on domestic operating system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410554A (en) * | 2014-12-31 | 2015-03-11 | 浪潮电子信息产业股份有限公司 | Method or testing WOL (Wake On Lan) function of server |
CN107257303A (en) * | 2017-07-28 | 2017-10-17 | 郑州云海信息技术有限公司 | A kind of method for carrying out automatic detection to network interface card in server system restarting process |
CN107360165A (en) * | 2017-07-13 | 2017-11-17 | 北京元心科技有限公司 | Terminal device, cloud server and method and device for managing and controlling operating system |
CN108632107A (en) * | 2017-12-29 | 2018-10-09 | 研祥智能科技股份有限公司 | MAC Address of Network Card detection method and device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7296069B2 (en) * | 2002-05-08 | 2007-11-13 | Hewlett-Packard Development Company, L.P. | Method and system for network fault monitoring with linux |
US7359335B2 (en) * | 2003-07-18 | 2008-04-15 | International Business Machines Corporation | Automatic configuration of network for monitoring |
CN107508727B (en) * | 2017-08-31 | 2020-11-27 | 苏州浪潮智能科技有限公司 | Automatic network card information checking method and device |
CN108965062A (en) * | 2018-08-07 | 2018-12-07 | 郑州云海信息技术有限公司 | A kind of network interface test method, device, equipment and the storage medium of Onboard NIC |
-
2018
- 2018-12-14 CN CN201811531468.8A patent/CN109639525B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410554A (en) * | 2014-12-31 | 2015-03-11 | 浪潮电子信息产业股份有限公司 | Method or testing WOL (Wake On Lan) function of server |
CN107360165A (en) * | 2017-07-13 | 2017-11-17 | 北京元心科技有限公司 | Terminal device, cloud server and method and device for managing and controlling operating system |
CN107257303A (en) * | 2017-07-28 | 2017-10-17 | 郑州云海信息技术有限公司 | A kind of method for carrying out automatic detection to network interface card in server system restarting process |
CN108632107A (en) * | 2017-12-29 | 2018-10-09 | 研祥智能科技股份有限公司 | MAC Address of Network Card detection method and device |
Also Published As
Publication number | Publication date |
---|---|
CN109639525A (en) | 2019-04-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109361562B (en) | Automatic testing method based on associated network equipment access | |
US9606904B1 (en) | System and method for data collection and analysis of information relating to mobile applications | |
CN105302732B (en) | A kind of automatic test approach and device of mobile terminal | |
CN110287696B (en) | Detection method, device and equipment for rebound shell process | |
CN108363662A (en) | A kind of applied program testing method, storage medium and terminal device | |
CN102064964B (en) | Method for rapidly switching gigabit network cards in gigabit switching environment | |
CN103138988B (en) | Positioning treatment method and positioning treatment device of network faults | |
US10499311B2 (en) | Method and apparatus for implementing network sharing | |
WO2022127196A1 (en) | Application identification method and apparatus, and device and storage medium | |
CN104767655A (en) | Analog result detection method and device | |
CN111934953A (en) | Batch testing method based on domestic processor computer platform | |
CN104639400A (en) | Automatic detection method and device of network packet processing chip | |
CN109639525B (en) | Network interface detection method based on homemade operating system | |
CN102571474A (en) | Virtualized Radius testing system and method | |
CN105515909A (en) | Data collection test method and device | |
CN112583663B (en) | Automatic network performance testing method based on domestic operating system | |
CN104486292A (en) | Enterprise-resource safety-access control method, device and system | |
CN109559121A (en) | Transaction path calls exception analysis method, device, equipment and readable storage medium storing program for executing | |
CN104570967B (en) | Long-range control method and system based on android system | |
CN101494600B (en) | Network configuration method and apparatus for mirror-image monitoring message information of ADSL terminal | |
CN107317723B (en) | Data processing method and server | |
CN110134559B (en) | BMC fault detection method, system and related components | |
CN111641623A (en) | AFDX (avionics full Duplex switched Ethernet) protocol stack construction method based on WinPcap | |
CN104954187A (en) | Method and device for determining state of CPE (customer premise equipment) | |
CN112671814A (en) | Cross-platform equipment development method, device and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |