Hardware identifier identification method, device and equipment
By obtaining device configuration information and identifying hardware component identification based on recognition rules of type matching, the problem of identification efficiency and accuracy in device testing is solved, and efficient and accurate identification of hardware component identification is achieved, which improves testing efficiency and accuracy.
Patent Information
- Application Number
- CN202510454577.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-07-01
AI Technical Summary
In equipment testing, facing more and more equipment testing needs and complex testing scenarios, how to efficiently and accurately identify hardware component identification and ensure the accuracy and efficiency of the test have become an urgent problem.
By obtaining the configuration information of the device to be tested, the identification of multiple hardware components is identified based on the type matching recognition rules of the hardware components. The identification rules are generated based on the sample identification to indicate the type of characters at any position in the character string.
Ensure the accuracy and completeness of configuration information, accurately and efficiently identify hardware component identification, avoid the problem of identification tool inappropriate and changes in hardware component manufacturers, and improve testing efficiency and accuracy.
Smart Images

Figure CN120234196A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and particularly to a method, apparatus, and device for identifying hardware identifiers. Background Art
[0002] In device testing, by identifying the identifiers of hardware components, and then matching the testing methods and the hardware components involved in the tools relied on for testing according to the hardware component identifiers. However, in the face of an increasing number of device testing requirements and increasingly complex device testing scenarios, the types, manufacturers, versions, etc. of the hardware components required for device testing are increasing, and it is necessary to continuously update the hardware component identifiers to meet the needs of various testing scenarios.
[0003] Therefore, how to efficiently and accurately identify hardware component identifiers and ensure the accuracy and efficiency of testing has become an urgent problem to be solved. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides a method, apparatus, device, medium, and program product for improving hardware identifier recognition.
[0005] According to a first aspect of the present disclosure, there is provided a method for identifying a hardware identifier, including: in response to a test request for a device to be tested, obtaining configuration information of the device to be tested, where the configuration information includes component configuration information of multiple hardware components in the device to be tested; based on an identification rule matching the type of each hardware component, respectively identifying the identifiers of the multiple hardware components from the multiple component configuration information, the identification rule is generated based on a sample identifier matching the type of the hardware component, the identifier includes a string, and the identification rule indicates the type of a character at any position in the string.
[0006] A second aspect of the present disclosure provides a device for identifying a hardware identifier, including: an obtaining module, configured to obtain configuration information of a device to be tested in response to a test request for the device to be tested, where the configuration information includes component configuration information of multiple hardware components in the device to be tested; an identification module, configured to respectively identify the identifiers of the multiple hardware components from the multiple component configuration information based on an identification rule matching the type of each hardware component, the identification rule is generated based on a sample identifier matching the type of the hardware component, the identifier includes a string, and the identification rule indicates the type of a character at any position in the string.
[0007] A third aspect of the present disclosure provides an electronic device, including: one or more processors; a memory, configured to store one or more computer programs, where the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0008] The fourth aspect of the present disclosure further provides a computer-readable storage medium, on which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, the steps of the above method are implemented.
[0009] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instruction, and when the computer program or instruction is executed by a processor, the steps of the above method are implemented.
[0010] According to the embodiments of the present disclosure, when receiving a test request of a device under test, by obtaining all the component configuration information of multiple hardware components in the device under test, the accuracy and integrity of the configuration information can be ensured. Furthermore, when identifying an identifier from the corresponding component configuration information through the identification rule of type matching of the hardware component, the hardware component identifier can be accurately and efficiently identified. Compared with the identification tools based on different hardware component identifiers, it can avoid the problem that due to the change of the hardware component manufacturer and the untimely update of the identification tool, the identification tool and the manufacturer are not compatible, resulting in the inability to identify some hardware component identifiers, which is beneficial to improving the test efficiency and test accuracy of the device under test. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above content and other objects, features and advantages of the present disclosure will become clearer. In the drawings:
[0012] Figure 1 Schematically shows an application scenario diagram of a hardware identifier recognition method, device, equipment, medium and program product according to an embodiment of the present disclosure;
[0013] Figure 2 Schematically shows a flowchart of a hardware identifier recognition method according to an embodiment of the present disclosure;
[0014] Figure 3 Schematically shows a schematic diagram of determining a sample character set for any type of sample identifier according to an embodiment of the present disclosure;
[0015] Figure 4 Schematically shows a schematic diagram of determining a sample character set for any type of sample identifier according to another embodiment of the present disclosure;
[0016] Figure 5 Schematically shows a schematic diagram of determining the type of a sample character in any sample character set according to an embodiment of the present disclosure;
[0017] Figure 6 Schematically shows a schematic diagram of combining multiple matching rules according to an embodiment of the present disclosure;
[0018] Figure 7Schematically shows a structural block diagram of a hardware identifier recognition device according to an embodiment of the present disclosure; and
[0019] Figure 8 Schematically shows a block diagram of an electronic device suitable for implementing a hardware identifier recognition method according to an embodiment of the present disclosure. Detailed implementation manners
[0020] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without this information of specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present disclosure.
[0021] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0022] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0023] In the case of information using expressions such as "at least one of A, B, and C", generally, it should be interpreted according to the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include, but not be limited to, a system having only A, having only B, having only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0024] In the technical solution of the present disclosure, the user information involved (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties. Moreover, the processing of relevant data, such as collection, storage, use, processing, transmission, provision, disclosure, and application, all comply with relevant laws, regulations, and standards, adopt necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to select authorization or rejection.
[0025] In the process of implementing the embodiments of the present disclosure, it is found that due to differences in the types, manufacturers, versions, etc. of hardware components, different identification tools are required to identify hardware component identifiers. For example, for the types, manufacturers, versions, etc. of hardware components required for server testing, there are more and more, and the versions of the identification tools are constantly iteratively updated, resulting in an increasing difference in component identifier identification. Especially for complex server testing scenarios, in addition to the complex identification logic, the identification tools need to be continuously updated to adapt to new tool versions and manufacturers, etc. As the differences in testing requirements become larger and larger, if the identification logic cannot be updated in a timely manner, some hardware component identifiers cannot be identified, and only testers can manually connect to the server to view, wasting testing time. Therefore, optimizing the logic for identifying hardware component identifiers, increasing the automatic compatibility with manufacturer or tool version updates, and reducing manual iteration are very necessary for improving testing efficiency.
[0026] Embodiments of the present disclosure provide a method for identifying hardware identifiers, including: in response to a test request for a device to be tested, obtaining configuration information of the device to be tested, where the configuration information includes component configuration information of multiple hardware components in the device to be tested; based on identification rules matching the types of the respective hardware components, respectively identifying the identifiers of the multiple hardware components from the multiple component configuration information, the identification rules are generated based on sample identifiers matching the types of the hardware components, the identifier includes a string, and the identification rules indicate the types of characters at any position in the string.
[0027] Figure 1 FIG. schematically shows an application scenario diagram of a method, apparatus, device, medium, and program product for identifying hardware identifiers according to an embodiment of the present disclosure.
[0028] As Figure 1 shown, the application scenario 100 according to this embodiment may include an electronic device 101 and a device to be tested 102. The electronic device 101 and the device to be tested 102 are communicatively connected. A medium for providing a communication connection may be utilized between the electronic device 101 and the device to be tested 102. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0029] A user may use the electronic device 101 to interact with the device to be tested 102 through the network to receive or send messages, etc.
[0030] The electronic device 101 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0031] The device to be tested 102 may be a device configured with multiple hardware components 1,..., hardware component N, including but not limited to servers, etc.
[0032] It should be noted that the hardware identification method in the embodiments of the present disclosure can generally be executed by the electronic device 101. Correspondingly, the hardware identification device in the embodiments of the present disclosure can generally be arranged in the electronic device 101. The hardware identification method in the embodiments of the present disclosure can also be executed by an electronic device or an electronic device cluster different from the electronic device 101 and capable of communicating with the device under test 102. Correspondingly, the hardware identification device in the embodiments of the present disclosure can also be arranged in an electronic device or an electronic device cluster different from the electronic device 101 and capable of communicating with the device under test 102.
[0033] It should be understood that Figure 1 the numbers of the electronic devices and the devices under test in
[0034] are merely illustrative. According to the implementation requirements, there can be any number of electronic devices and devices under test. Figure 1 Based on the scenario described below Figures 2 to 6 the hardware identification method in the embodiments of the present disclosure will be described in detail.
[0035] Figure 2 FIG. schematically shows a flowchart of the hardware identification method according to the embodiments of the present disclosure.
[0036] As Figure 2 shown, the hardware identification method of this embodiment includes operations S210 to S220.
[0037] In operation S210, in response to a test request for the device under test, the configuration information of the device under test is obtained.
[0038] In operation S220, based on the identification rules matching the respective types of the hardware components, the identifiers of the multiple hardware components are respectively identified from the multiple component configuration information.
[0039] In the embodiments of the present disclosure, the device under test may include, but is not limited to, a server, etc. The configuration information may include the component configuration information of multiple hardware components in the device under test. The number of hardware components can be determined according to the use and requirements of the device under test.
[0040] For example, when the device under test is a server, the hardware components of the server may include, but are not limited to, at least one of the following: a central processing unit, a memory, a storage device, a motherboard, a power supply, a network interface card, a graphics card, a cooling system, a chassis, and a management card, etc. When the server is used for high-performance computing, such as big data analysis, etc., more central processing unit cores and memory are required, while when the server is used for storing a large amount of data, such as a file server, a database server, etc., more hard disks are required.
[0041] For example, when a test request sent by a client for a server is received, an interface corresponding to the server can be called to obtain the configuration information of the server. The configuration information of the server can include, but is not limited to, at least one of the following: central processing unit configuration information, memory configuration information, storage device configuration information, motherboard configuration information, power supply configuration information, network interface card configuration information, graphics card configuration information, cooling system configuration information, chassis configuration information, and management card configuration information. The central processing unit configuration information can include, for example, but is not limited to: information such as model, number of cores, number of threads, serial number, cache size, etc.
[0042] The recognition rule can be generated based on a sample identifier that matches the type of the hardware component. For example, by extracting the features of the sample identifier that matches the type of the hardware component, a recognition rule similar to the features of the sample identifier can be generated.
[0043] The identifiers of the respective hardware components can be used to represent the unique identifier of the hardware component.
[0044] For example, if the type of the central processing unit is a processor, the serial number can be recognized from the central processing unit configuration information using a recognition rule generated based on a sample identifier that matches the processor, and the serial number can be determined as the identifier of the central processing unit.
[0045] The identifier can include a string, and the recognition rule can indicate the type of the character at any position in the string. For example, for any hardware component: multiple strings can be recognized in the component configuration information of the hardware component, and when the type of the character at any position in the target string that exists in the multiple strings matches the type of the character at any position in the string in the recognition rule, the target string can be determined as the identifier of the hardware component.
[0046] According to an embodiment of the present disclosure, since when a test request of a device to be tested is received, the component configuration information of multiple hardware components in the device to be tested is obtained in full, the accuracy and integrity of the configuration information can be ensured. Furthermore, when identifying the identifier from the corresponding component configuration information through a recognition rule that matches the type of the hardware component, the hardware component identifier can be accurately and efficiently identified. Compared with the recognition tools based on different hardware component identifiers, the problem that some hardware component identifiers cannot be recognized due to the change of the hardware component manufacturer and the untimely update of the recognition tool, resulting in the mismatch between the recognition tool and the manufacturer, can be avoided, which is beneficial to improving the test efficiency and test accuracy of the device to be tested.
[0047] According to an embodiment of the present disclosure, the sample identifier can include a sample string. The length of the sample string can be determined according to the type of the hardware device. The lengths of the sample strings of the same type of hardware devices are the same.
[0048] According to another embodiment of the present disclosure, in addition to the operations S210 - S220 as shown above Figure 2 , the hardware identification method may further include operations: obtaining a plurality of sample identifiers of different types; for any type of sample identifier: splitting the sample string of the sample identifier to obtain a plurality of sample characters; grouping the plurality of sample characters based on the positions of the respective sample characters in the sample identifier to obtain a plurality of sample character sets; for any sample character set, determining a matching rule segment for the sample character set according to the types of the sample characters in the sample character set to obtain a plurality of matching rule segments; and obtaining an identification rule for any type according to the plurality of matching rule segments.
[0049] The plurality of sample identifiers of different types may be a plurality of sample identifiers from different types of hardware devices. For example, if the lengths of the plurality of sample strings of the same type are all N, the sample characters of each sample string in the plurality of sample strings of the same type may be split to obtain N sample characters corresponding to each sample string, where N may be an integer greater than or equal to 2.
[0050] Figure 3 FIG. schematically shows a schematic diagram of determining a sample character set for any type of sample identifier according to an embodiment of the present disclosure.
[0051] As Figure 3 shown, in this embodiment, the method for determining a sample character set for any type of sample identifier may include operations S301 - S306.
[0052] In operation S301, obtain a plurality of sample identifiers of the same type.
[0053] In operation S302, initialize N sample character sets. For example, the N sample character sets respectively correspond one-to-one to the positions of the respective sample characters in the sample string.
[0054] In operation S303, traverse the nth sample character in the sample string of each sample identifier, where 0 < n ≤ N.
[0055] In operation S304, add the nth sample character to the nth sample character set in the initialized N sample character sets.
[0056] In operation S305, determine whether it has traversed to the Nth sample character. When n = N, it is determined that it has traversed to the Nth sample character, and operation S306 is executed. When n ≠ N, it is determined that it has not traversed to the Nth sample character, and operation S303 is repeatedly executed, and the new n is iterated on the previous n, that is, the new n is the previous n plus 1.
[0057] In operation S306, a set of sample characters corresponding to each position among the N positions is obtained.
[0058] For example, the lengths of the 3 sample strings of type 1 are all 5. For example, the 3 sample strings can be AB257, AC555, VD346, etc. The first character strings of AB251, AB555, and VB346 are A, A, and V respectively, the second character strings are B, C, and D respectively, the third character strings are 2, 5, and 3 respectively, the fourth character strings are 5, 5, and 4 respectively, and the fifth character strings are 7, 5, and 6 respectively. The first set of sample characters can be {A, A, V}, the second set of sample characters can be {B, C, D}, the third set of sample characters can be {2, 5, 3}, the fourth set of sample characters can be {5, 5, 4}, and the fifth set of sample characters can be {7, 5, 6}.
[0059] It should be noted that the above examples of the present disclosure are only for schematically illustrating the method for the present disclosure to determine the set of sample characters for any type of sample identifier, and are not intended to limit the scope of the present disclosure.
[0060] In the embodiments of the present disclosure, the matching rule segment is used to identify the characters that match the type of the sample characters in the set of sample characters from the component configuration information of the hardware device that matches the type of the sample identifier. The type of the sample characters can include at least one of the following: digital type, uppercase letter type, lowercase letter type, special character type. The special character type can be, for example, an asterisk, a hash, an exclamation mark, etc.
[0061] According to the embodiments of the present disclosure, since the matching rule segment corresponding to any position is determined according to the type of the sample characters at any position in multiple sample strings of the same type, it is possible to automatically generate identification rules of any type, avoid the subjectivity and inefficiency of manually writing identification rules, improve the identification accuracy and efficiency, and is beneficial to improving the test efficiency and test accuracy of the device to be tested. In addition, the identification rules generated by the present disclosure can adapt to the changes in the identification formats of different manufacturers without manual intervention.
[0062] Figure 4 Schematically shows a schematic diagram for determining the set of sample characters for any type of sample identifier according to another embodiment of the present disclosure.
[0063] As Figure 4 shown, in this embodiment, the method for determining the set of sample characters for any type of sample identifier may include operations S401 to S406.
[0064] In operation S401, the sample characters with the same position among the multiple sample characters are grouped to obtain multiple groups of sample characters.
[0065] In operation S402, check whether there are duplicate sample characters in any set of sample characters. When it is determined that there are duplicate sample characters in any set of sample characters, after performing operation S403, operation S404 is then performed. When it is determined that there are no duplicate sample characters in any set of sample characters, operation S404 is performed.
[0066] In operation S403, remove the duplicates from the duplicate sample characters. For example, only one sample character can be retained from the duplicate sample characters. Continuing with the example in the above embodiment, in the first set of sample characters {A, A, V}, there is a duplicate sample character A. After removing the duplicate of A, the first set of sample characters after duplicate removal is obtained as {A, V}. In the fourth set of sample characters {5, 5, 4}, there is a duplicate sample character 5. After removing the duplicate of 5, the fourth set of sample characters after duplicate removal is obtained as {5, 4}.
[0067] In operation S404, check whether there are adjacent sample characters of the same sample character type in any set of sample characters. When it is determined that there are adjacent sample characters of the same sample character type in any set of sample characters, operation S405 can be performed and then operation S406. When it is determined that there are no adjacent sample characters of the same sample character type in any set of sample characters, operation S406 can be performed.
[0068] In operation S405, simplify the adjacent sample characters.
[0069] In operation S406, obtain multiple sets of sample characters.
[0070] For example, the same sample character type can be understood as all being of the numeric type, or all being of the uppercase letter type, or all being of the lowercase letter type, etc. Simplifying the adjacent sample characters can be to omit the middle sample characters. Continuing with the example in the above embodiment, for the second set of sample characters {B, C, D}, there are adjacent sample characters B, C, D. After simplifying the adjacent sample characters, the simplified second set of sample characters {B-D} is obtained. For the fifth set of sample characters {7, 5, 6}, there are adjacent sample characters 5, 6, 7. After simplifying the adjacent sample characters, the simplified fifth set of sample characters {5-7} is obtained.
[0071] It should be noted that the order of the judgment conditions in operations S402 to S405 in the above example can be changed. Correspondingly, the operations after determining the judgment result can also be adjusted adaptively. The present disclosure does not make specific limitations on this.
[0072] According to an embodiment of the present disclosure, for complex device test scenarios, there are many types, manufacturers, versions, etc. of the hardware components required for device testing. Therefore, there are also many identifications of the hardware components. In order to improve the accuracy of the recognition rules, it is necessary to obtain multiple sample identifications of different types. The number of sample characters in multiple sample character sets is large. By removing duplicate sample characters and simplifying adjacent sample characters with the same sample character type, the amount of data in the sample character set can be reduced. When analyzing the sample characters in the sample character set, a smaller amount of data is beneficial to improving the calculation efficiency and enhancing the rule generation speed.
[0073] Figure 5 Schematically shows a schematic diagram for determining the type of sample characters in any sample character set according to an embodiment of the present disclosure.
[0074] As Figure 5 shown, in this embodiment, the method for determining the type of sample characters in any sample character set includes operation S501 to operation S511.
[0075] In operation S501, it is determined whether all the sample characters in the sample character set are numbers. When it is determined that all the sample characters in the sample character set are numbers, operation S502 is executed. When it is determined that not all the sample characters in the sample character set are numbers, operation S503 is executed.
[0076] In operation S502, it is determined that the sample character type is a numeric type.
[0077] In operation S503, it is determined whether all the sample characters in the sample character set are capital letters. When it is determined that all the sample characters in the sample character set are capital letters, operation S504 is executed. When it is determined that not all the sample characters in the sample character set are capital letters, operation S505 is executed.
[0078] In operation S504, it is determined that the sample character type is a capital letter type.
[0079] In operation S505, it is determined whether all the sample characters in the sample character set are lowercase letters. When it is determined that all the sample characters in the sample character set are lowercase letters, operation S506 is executed. When it is determined that not all the sample characters in the sample character set are lowercase letters, operation S507 is executed.
[0080] In operation S506, it is determined that the sample character type is a lowercase letter type.
[0081] In operation S507, it is determined whether all the sample characters in the sample character set are letters. When it is determined that all the sample characters in the sample character set are letters, operation S508 is executed. When it is determined that not all the sample characters in the sample character set are letters, operation S509 is executed.
[0082] In operation S508, it is determined that the sample character type is a mixed type of uppercase and lowercase letters.
[0083] In operation S509, it is determined whether the sample characters in the sample character set are a combination of letters and numbers. When it is determined that the sample characters in the sample character set are a combination of letters and numbers, operation S510 is executed. When it is determined that the sample characters in the sample character set are not a combination of letters and numbers, operation S511 is executed.
[0084] In operation S510, it is determined that the sample character type is a mixed type of letters and numbers.
[0085] In operation S511, it is determined that there is a sample character type of special character type.
[0086] For example, when the sample character type is a numeric type, it can be determined that the expression form of the matching rule segment of the sample character set is "\d", which can be used to match any numeric character, such as 0 - 9. When the sample character type is an uppercase letter type, it can be determined that the expression form of the matching rule segment of the sample character set is "[A - Z]", which can be used to match any uppercase letter character. When the sample character type is a lowercase letter type, it can be determined that the expression form of the matching rule segment of the sample character set is "[a - z]", which can be used to match any lowercase letter character. When the sample character type is a mixed type of uppercase and lowercase letters, it can be determined that the expression form of the matching rule segment of the sample character set is "[A - Za - z]", which can be used to match any uppercase or lowercase letter character. When the sample character type is a mixed type of letters and numbers, it can be determined that the expression form of the matching rule segment of the sample character set is "[A - Za - z0 - 9]", which can be used to match any uppercase letter or lowercase letter or numeric character. When the sample character type is a special character type, it can be determined that the expression form of the matching rule segment of the sample character set is "\ special character", which can be used to match any special character.
[0087] It should be noted that the order of the judgment conditions in operations S501 to S511 in the above examples can be changed. Correspondingly, the operations after determining the judgment result can also be adjusted adaptively. The present disclosure does not make specific limitations on this.
[0088] According to the embodiments of the present disclosure, the recognition rules generated based on the types of sample characters in the sample character set can intuitively reflect the format characteristics of the identifier, facilitating manual verification and adjustment.
[0089] According to an embodiment of the present disclosure, obtaining an identification rule for any type according to multiple matching rule fragments may include operations: based on the position order of sample characters in the sample identifier, sequentially combine the matching rule fragments corresponding to the positions of the sample characters to obtain an identification rule for any type.
[0090] For example, continuing with the example in the above embodiment, the first set of sample characters {A, A, V} or {A, V} corresponds to the first sample character, the second set of sample characters {B, C, D} or {B-D} corresponds to the second sample character, the third set of sample characters {2, 5, 3} corresponds to the third sample character, the fourth set of sample characters {5, 5, 4} or {5, 4} corresponds to the fourth sample character, and the fifth set of sample characters {7, 5, 6} or {5-7} corresponds to the fifth sample character. Each set of sample characters corresponds to a matching rule fragment. For example, the first set of sample characters corresponds to the first matching rule fragment, and so on. The fifth set of sample characters corresponds to the fifth matching rule fragment. The first to fifth matching rule fragments can be sequentially combined to obtain an identification rule of type 1.
[0091] According to an embodiment of the present disclosure, since the identification rule is obtained by combining the matching rule fragments based on the position order of the sample characters, it is possible to reduce the confusion and redundancy during rule matching, improve the rule matching efficiency, make the identification rule compact and orderly, facilitate management and maintenance, and have strong scalability.
[0092] According to another embodiment of the present disclosure, in addition to the operations S210 to S220 as shown above, the hardware identifier recognition method may further include operations: when the matching rule fragments corresponding to adjacent positions of sample characters in the sample identifier are the same, determine the number of adjacent positions; based on the number of positions, simplify the same matching rule fragments. Figure 2 As shown schematically in the figure, a schematic diagram of combining multiple matching rules according to an embodiment of the present disclosure is shown.
[0093] Figure 6 As shown in the figure, in an embodiment of the present disclosure, the method of combining multiple matching rules may include operations S601 to S608.
[0094] As Figure 6 shown, in an embodiment of the present disclosure, the method of combining multiple matching rules may include operations S601 to S608.
[0095] In operation S601, traverse the nth matching rule fragment corresponding to the nth sample character.
[0096] In operation S602, record the nth matching rule fragment.
[0097] In operation S603, traverse the (n + 1)th matching rule fragment corresponding to the (n + 1)th sample character.
[0098] In operation S604, it is determined whether the (n + 1)-th matching rule segment is the same as the n-th matching rule segment. When it is determined that the (n + 1)-th matching rule segment is the same as the n-th matching rule segment, operation S605 is executed and then operation S607 is executed. When it is determined that the (n + 1)-th matching rule segment is different from the n-th matching rule segment, operation S606 is executed and then operation S607 is executed.
[0099] In operation S605, the number of positions at adjacent positions is recorded.
[0100] In operation S606, the (n + 1)-th matching rule segment is recorded.
[0101] In operation S607, it is determined whether traversal reaches the N-th matching rule segment. When it is determined that n + 1 = N, operation S608 is executed. When it is determined that n + 1 ≠ N, operation S603 is repeatedly executed.
[0102] In operation S608, an identification rule is obtained.
[0103] For example, continuing with the example in the above embodiment, the sample characters in the first sample character set and the second sample character set are both of the capital letter type, the corresponding matching rule segments are the same, and the first sample character set and the second sample character set are adjacent in position. The expression form of the matching rule segment of the sample character set can be recorded as "[A-Z] {2}", indicating that the expression forms of the matching rule segments of the first sample character and the second sample character at adjacent positions can both be "[A-Z]".
[0104] According to an embodiment of the present disclosure, by determining whether the matching rule segments at adjacent positions are the same, the number of positions at adjacent positions can be recorded, and the same matching rule segments can be simplified in the form of quantifiers, thereby simplifying the identification rule and improving the identification efficiency.
[0105] According to an embodiment of the present disclosure, the component configuration information may include component identification information.
[0106] For the operation S220 as described above Figure 2 As shown, based on the identification rules matching the respective types of the hardware components, the respective identifiers of the multiple hardware components can be identified from the multiple component configuration information, which may include operations: for any one of the multiple hardware components: based on the type of the hardware component, a string with a corresponding length is determined from the component identification information; when it is determined that the type of the character at any position in the string matches the type of the sample character corresponding to the position, the string is determined as the identifier of the hardware component.
[0107] In the embodiment of the present disclosure, since the types of the hardware components are the same, the lengths of the strings may be the same.
[0108] For example, if the type of the hardware component is Type 1, then in the component identification information, a string with a length of 5 can be determined. Then, according to the recognition rule matching Type 1, the type of the character corresponding to any position in the string is matched. In the case of all matches, it can be determined that the string with a length of 5 is the identifier of the hardware component.
[0109] According to an embodiment of the present disclosure, by matching the type of the character at any position in the string with the type of the sample character corresponding to the position, it is possible to accurately identify the identifier of the hardware component compactly and orderly, and it is possible to avoid the problem that due to the change of the hardware component manufacturer and the untimely update of the recognition tool, the recognition tool and the manufacturer are not compatible, resulting in the inability to identify some hardware component identifiers.
[0110] According to an embodiment of the present disclosure, the type of the hardware component may include at least one of the following: hard disk type, memory type, processor type, and disk array card type. The present disclosure does not make a specific limitation on the number of hardware components of the same type, and can be configured according to actual needs.
[0111] For example, for the hardware devices of a server, such as a central processing unit, a solid-state drive, a hard disk, a memory, a motherboard, a graphics card, a power supply, etc., the serial number of each hardware device can be determined as the identifier of each hardware device.
[0112] According to an embodiment of the present disclosure, in the server test scenario, the serial number recognition tool of the hardware component needs to be recognized by configuring keywords. However, when the hardware component recognition tool or the component manufacturer changes, the keywords change, and recognizing according to the keywords will result in inaccurate recognition or omission. If the tester manually checks the serial number of the hardware component on the server and then updates the implementation logic in the recognition script according to the manually searched information to be compatible with the test scenario, the test time is long and the accuracy is low. Based on the above hardware identifier recognition method of the present disclosure, it has strong generality, high test efficiency, and strong scalability.
[0113] According to an embodiment of the present disclosure, before executing the hardware identifier recognition method, the compilation of the recognition rule can be completed in advance to avoid the overhead of repeated compilation during the recognition process.
[0114] According to an embodiment of the present disclosure, the hardware identifier recognition method may further include operations in addition to the operations S210 - S220 as described above Figure 2 shown. When it is determined that the number of multiple hardware components is greater than or equal to a preset threshold, the multiple hardware components are grouped based on the type of the hardware component to obtain multiple sets of hardware component collections; based on the multiple sets of hardware component collections, the identifiers of the hardware components are recognized in parallel from the component configuration information of the hardware components in any one of the sets of hardware component collections.
[0115] The preset threshold can be determined according to the actual requirements for recognition efficiency and recognition resources. For example, when high recognition efficiency is required and recognition resources are sufficient, the preset threshold can be relatively low compared to the case where high recognition efficiency is required but recognition resources are insufficient.
[0116] For example, hardware components of the same type of hardware components can be grouped into a group, and recognition threads can be determined according to the grouping situation, and the recognition threads can be executed in parallel. For each thread, the component configuration information of each hardware component in the hardware component set can be recognized in sequence to obtain the identifier of each hardware component.
[0117] According to an embodiment of the present disclosure, by using multi-threaded parallel recognition of the identifiers of hardware components based on the types of hardware components, the recognition speed can be improved and the waiting time can be reduced.
[0118] According to another embodiment of the present disclosure, the component identifier information may include a component name and a string. Before recognizing the identifiers of multiple hardware components from multiple component configuration information, it may further include an operation: matching identifiers from the component configuration information of each of the multiple hardware components based on a pre-configured set of hardware component names. In the case where the matching is determined to be unsuccessful, the identifiers of each of the multiple hardware components are then recognized based on the recognition rules matching the types of the respective hardware components. In the case where not all of the identifiers of the multiple hardware components are matched, the identifiers of the unmatched hardware components are recognized based on the recognition rules matching the types of the unmatched hardware components. Since the target string is directly matched based on the name of the hardware component, the recognition process can be simplified and the recognition efficiency can be improved.
[0119] However, when the hardware component manufacturer changes, the name of the hardware component changes, which may cause the identifiers of all hardware components not to be recognized. Based on this, the new component names can be matched from the component identifier information through the identifiers of each of the multiple hardware components recognized each time, and the set of hardware component names can be updated using the new component names. Since the reverse lookup mechanism for matching names based on identifiers can update the set of hardware component names in a timely manner, the fault tolerance can be improved and the dynamic expansion of hardware component names can be supported.
[0120] According to an embodiment of the present disclosure, based on a pre-configured set of hardware component names, matching identifiers from the component configuration information of each of multiple hardware components may include operations: When it is determined that the number of hardware component names in the set of hardware component names is greater than or equal to a preset threshold, the hardware component names in the set of hardware component names may be grouped based on the types of the hardware components to obtain multiple subsets of hardware component names. Based on the multiple subsets of hardware component names, identifiers are matched in parallel from the component configuration information of each of the multiple hardware components. Since the matching speed is slow when matching one by one due to the large number of hardware component names, therefore, using multi-threaded parallel matching can improve the matching speed and thus improve the recognition efficiency.
[0121] Based on the above hardware identifier recognition method, the present disclosure also provides a hardware identifier recognition device. The following will be combined with Figure 7 to describe this device in detail.
[0122] Figure 7 The structural block diagram of the hardware identifier recognition device according to an embodiment of the present disclosure is schematically shown.
[0123] As Figure 7 shown, the hardware identifier recognition device 700 of this embodiment includes an acquisition module 710 and an identification module 720.
[0124] The acquisition module 710 is configured to obtain the configuration information of the device under test in response to a test request for the device under test, and the configuration information includes the component configuration information of each of multiple hardware components in the device under test. In one embodiment, the acquisition module 710 may be configured to perform the operation S210 described above, which will not be elaborated here.
[0125] The identification module 720 is configured to respectively identify the identifiers of each of the multiple hardware components from the multiple component configuration information based on an identification rule that matches the type of each hardware component. The identification rule is generated based on a sample identifier that matches the type of the hardware component. The identifier includes a string, and the identification rule indicates the type of the character at any position in the string. In one embodiment, the identification module 720 may be configured to perform the operation S220 described above, which will not be elaborated here.
[0126] According to an embodiment of the present disclosure, the hardware identification recognition device 700 may further include a sample identification acquisition module, a splitting module, a first grouping module, a segment determination module, and a rule determination module. The sample identification acquisition module is used to acquire a plurality of sample identifications of different types. The splitting module is used to split the sample string of the sample identification to obtain a plurality of sample characters. The first grouping module is used to group the plurality of sample characters based on the positions of the respective sample characters in the sample identification to obtain a plurality of sample character sets. The segment determination module is used to determine a matching rule segment for any sample character set according to the types of the sample characters in the sample character set, and obtain a plurality of matching rule segments. The rule determination module is used to obtain an identification rule for any type according to the plurality of matching rule segments. For any type of sample identification, the splitting module, the first grouping module, the segment determination module, and the rule determination module can be used to determine the identification rule.
[0127] According to an embodiment of the present disclosure, the first grouping module may include: a partitioning unit, a duplicate removal unit, and a character simplification unit. The partitioning unit is used to partition the sample characters with the same position in the plurality of sample characters into one group to obtain multiple groups of sample characters. The duplicate removal unit is used to perform duplicate removal processing on the duplicate sample characters when it is determined that there are duplicate sample characters in any group of sample characters, and obtain a plurality of sample character sets. The character simplification unit is used to simplify the adjacent sample characters when it is determined that there are adjacent sample characters with the same sample character type in any group of sample characters, and obtain a plurality of sample character sets.
[0128] According to an embodiment of the present disclosure, the rule determination module may include a combination unit. The combination unit is used to sequentially combine the matching rule segments corresponding to the positions of the sample characters based on the position order of the sample characters in the sample identification, and obtain an identification rule for any type.
[0129] According to an embodiment of the present disclosure, the hardware identification recognition device 700 may further include a quantity determination module and a segment simplification module. The quantity determination module is used to determine the position quantity of adjacent positions when the matching rule segments corresponding to adjacent positions of the sample characters in the sample identification are the same. The segment simplification module is used to simplify the same matching rule segments based on the position quantity.
[0130] According to an embodiment of the present disclosure, the component configuration information includes component identification information. The recognition module 720 may further include: a string determination unit and a matching unit. The string determination unit is used to determine a string with a corresponding length from the component identification information based on the type of the hardware component. The matching unit is used to determine the string as the identification of the hardware component when it is determined that the type of the character at any position in the string matches the type of the sample character corresponding to the position.
[0131] According to an embodiment of the present disclosure, the types of hardware components include at least one of the following: hard disk type, memory type, processor type, disk array card type.
[0132] According to an embodiment of the present disclosure, the hardware identification recognition device 700 may further include: a second grouping module and a parallel recognition module. The second grouping module is configured to group a plurality of hardware components based on the types of the hardware components to obtain multiple sets of hardware component collections when it is determined that the number of the plurality of hardware components is greater than or equal to a preset threshold. The parallel recognition module is configured to parallelly recognize the identifiers of the hardware components from the component configuration information of each of the hardware components in any one of the multiple sets of hardware component collections.
[0133] According to an embodiment of the present disclosure, any plurality of modules among the acquisition module 710 and the recognition module 720 may be combined and implemented in one module, or any one of them may be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules may be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 710 and the recognition module 720 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner that can integrate or package circuits, etc., in hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, at least one of the acquisition module 710 and the recognition module 720 may be at least partially implemented as a computer program module, and when the computer program module is run, corresponding functions may be executed.
[0134] Figure 8 A block diagram of an electronic device suitable for implementing the hardware identification recognition method according to an embodiment of the present disclosure is schematically shown.
[0135] As Figure 8 shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read only memory (ROM) 802 or a program loaded from a storage section 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application specific integrated circuit (ASIC)), etc. The processor 801 may further include on-board memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0136] In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 802 and / or the RAM 803. It should be noted that the programs can also be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 can also perform various operations of the method flow according to the embodiments of the present disclosure by executing the programs stored in one or more memories.
[0137] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, and the input / output (I / O) interface 805 is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the input / output (I / O) interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read from it can be installed into the storage portion 808 as needed.
[0138] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.
[0139] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, device, or apparatus. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include one or more memories other than the above-described ROM 802 and / or RAM 803 and / or ROM 802 and RAM 803.
[0140] An embodiment of the present disclosure further includes a computer program product, which includes a computer program that contains program code for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.
[0141] When the computer program is executed by the processor 801, it executes the above functions defined in the system / apparatus of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0142] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and be downloaded and installed through the communication part 809, and / or be installed from the removable medium 811. The program code included in the computer program can be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0143] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or be installed from the removable medium 811. When the computer program is executed by the processor 801, it executes the above functions defined in the system of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0144] According to embodiments of the present disclosure, program code for executing the computer programs provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The programming languages include, but are not limited to, programming languages such as Java, C++, Python, the "C" language, or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, can be implemented using a dedicated hardware-based system for performing the specified functions or operations, or can be implemented using a combination of dedicated hardware and computer instructions.
[0146] Those skilled in the art can understand that the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0147] The above describes the embodiments of the present disclosure. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present disclosure.
Claims
1. A method for identifying a hardware identifier, characterized in that: The method comprises: In response to a test request for a device to be tested, obtaining configuration information of the device to be tested, the configuration information including component configuration information of each of a plurality of hardware components in the device to be tested; Based on identification rules that match the types of the respective hardware components, the identifiers of the respective hardware components are identified from the plurality of component configuration information respectively, the identification rules are generated based on sample identifiers that match the types of the hardware components, the identifiers include strings, and the identification rules indicate the type of a character at any position in the string.
2. The method according to claim 1, characterized in that The sample identifier includes a sample character string; The method further comprises: Acquire a plurality of sample identifiers of different types; For any type of sample ID: Splitting the sample character string of the sample identifier to obtain multiple sample characters; Based on the positions of the multiple sample characters in the sample identifier, the multiple sample characters are grouped to obtain multiple sample character sets; For any sample character set, determining a matching rule fragment for the sample character set according to the type of the sample characters in the sample character set, and obtaining a plurality of matching rule fragments; According to the plurality of matching rule fragments, an identification rule for any one of the types is obtained.
3. The method according to claim 2, characterized in that The method of grouping the plurality of sample characters based on the positions of the plurality of sample characters in the sample identifier to obtain a plurality of sample character sets includes: Divide the sample characters with the same position among the multiple sample characters into one group to obtain multiple groups of sample characters; When it is determined that there are repeated sample characters in any group of sample characters, performing deduplication processing on the repeated sample characters to obtain a plurality of the sample character sets; When it is determined that there are adjacent sample characters of the same sample character type in any group of sample characters, the adjacent sample characters are simplified to obtain a plurality of the sample character sets.
4. The method according to claim 2, characterized in that: The obtaining of an identification rule for any type according to the plurality of matching rule fragments includes: Based on the position sequence of the sample characters in the sample identification, the matching rule fragments corresponding to the positions of the sample characters are combined in sequence to obtain the recognition rule for any one of the types.
5. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: In the case where the matching rule fragments corresponding to the adjacent positions of the sample characters in the sample identification are the same, determining the number of positions of the adjacent positions; and Based on the number of positions, the identical matching rule fragments are simplified.
6. The method according to claim 2, characterized in that The component configuration information includes component identification information; The identifying of each of the plurality of hardware components from the plurality of component configuration information based on the identification rules matched with the respective types of the hardware components comprises: For any hardware component among the multiple hardware components: Based on the type of the hardware component, determining a character string having a corresponding length from the component identification information; When it is determined that the type of the character at any position in the character string matches the type of the sample character corresponding to the position, the character string is determined as the identification of the hardware component.
7. The method according to claim 6, characterized in that The type of the hardware component includes at least one of the following: a hard disk type, a memory type, a processor type, and a disk array card type.
8. The method according to claim 1, characterized in that: The method further comprises: When it is determined that the number of the plurality of hardware components is greater than or equal to a preset threshold, grouping the plurality of hardware components based on types of the hardware components to obtain a plurality of sets of hardware components; Based on a plurality of sets of the hardware component collections, the identifiers of the hardware components are identified in parallel from the component configuration information of each hardware component in any set of the hardware component collections.
9. A hardware identification recognition device, characterized in that: The device comprises: An acquisition module, configured to acquire configuration information of the device to be tested in response to a test request for the device to be tested, wherein the configuration information includes component configuration information of each of a plurality of hardware components in the device to be tested; An identification module is used to identify the respective identifiers of the multiple hardware components from the multiple component configuration information based on identification rules that match the respective types of the hardware components, the identification rules are generated based on sample identifiers that match the types of the hardware components, the identifiers include strings, and the identification rules indicate the type of characters at any position in the string.
10. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.