Traitement en cours

Veuillez attendre...



Aller à Demande


Note: Texte fondé sur des processus automatiques de reconnaissance optique de caractères. Seule la version PDF a une valeur juridique

[ EN ]


[0001] This application claims priority to U.S. Pat. App. Ser. No. 11/368,252, filed March 3, 2006, and U.S. Pat. App. Ser. No. 11/315,115, filed August 31, 2006.

[0002] The present invention relates generally to automated testing and, more particularly, to automated testing of network devices from diverse device platforms via a command line interface.

[0003] It is often desirable to perform automated testing of devices such as network components and the like during the design, development, and manufacturing stages. Many devices include a command line interface (CLI) configured to allow certain CLI commands to be issued to the device via a computer or human operator. The operation of the device can then be tested by issuing commands through the CLI and watching for expected (and unexpected) results.
[0004] Manual testing by a human operator is undesirable in that the device under test often includes a long list of commands and expressions to be tested, and many of those commands may require multiple and/or iterative testing. It is therefore generally not feasible to implement manual testing on a large scale.
[0005] Automated testing may be employed by using a general purpose computer language to develop a series of automated tests. Known systems are unsatisfactory, however, in that they generally require knowledge of a high level language (such as Perl, TCL/Expect, or the like), making the creation of test routines time-consuming, difficult, and expensive. Furthermore, the test programs themselves are often subject to bugs and inadequacies, necessitating the expenditure of time and effort to test and diagnose problems with the test software rather than the device of interest.
[0006] Because of the difficulty in developing automated testing, such testing is typically performed late in the development process. As a result, product problems are often not found until much later than necessary, leading to added time and expense.

[0007] Furthermore, it is often desirable to test devices from different device platforms. As each manufacturer typically incorporates different sets of commands with different syntaxes (and platform-specific output), it is difficult to set up an automated testing scheme that can accommodate devices from a variety of manufacturers, even with devices of the same type (e.g., switches, routers, etc.).
[0008] Accordingly, it is desirable to provide quick, easy-to-learn systems and methods for developing automated test plans for diverse network device platforms. Furthermore, other desirable features and characteristics of the present invention will become apparent from the subsequent detailed description and the appended claims, taken in conjunction with the accompanying drawings and the foregoing technical field and background.

[0009] In accordance with one embodiment of the present invention, a method for automated testing of a device (e.g., a router, switch, mobile terminal, barcode reader, or the like) includes: creating a metafile; establishing a network connection to the device; parsing the metafile to determine a device command and an expected result; performing a terminology substitution step using a terminology block, issuing the device command to the command line interface of the device via the network connection; receiving a response from the command line interface of the device via the network connection; and comparing the response to the expected result; and logging, to a test summary file, a test result based on this comparison.

[0010] A more complete understanding of the present invention may be derived by referring to the detailed description and claims when considered in conjunction with the following figures, wherein like reference numbers refer to similar elements throughout the figures.
[0011] FIG. 1 is a conceptual overview of a test system in accordance with one embodiment of the present invention; and
[0012] FIGS. 2A-2B depict an exemplary process in accordance with one embodiment of the present invention.
[0013] FIG. 3 is a conceptual overview of a test system in accordance with an alternate embodiment of the invention; and [0014] FIG. 4 is a flow chart depicting a process in accordance implemented by the test system of FIG. 3.

[0015] The following detailed description is merely illustrative in nature and is not intended to limit the invention or the application and uses of the invention. Furthermore, there is no intention to be bound by any express or implied theory presented in the preceding technical field, background, brief summary or the following detailed description.
[0016] The invention may be described herein in terms of functional and/or logical block components and various processing steps. It should be appreciated that such block components may be realized by any number of hardware, software, and/or firmware components configured to perform the specified functions.
[0017] Referring to the conceptual block diagram shown in FIG. 1, an automated testing environment 100 in accordance with one embodiment of the present invention generally includes an automated command line interface test apparatus (or simply "test system," or simply "system") 110 configured to communicate via a network connection 112, 114 with a network device (or simply "device") 106. Test system 110 is capable of accepting a metafile 102, parsing the metafile to determine device commands (or "CLI commands"), determining one or more expected results relating to the desired tests, then issuing the device commands 112 to device 106 via a command line interface 120.
[0018] Device 106 then reacts in some manner to the issued device commands and returns respective responses 114, which are received by test system 110. Test system 110 compares the responses with the expected results to produce a log or a test summary 104. As described in further detail below, metafile 102 is created using a relatively simple vocabulary of commands and expressions and using a highly-intuitive syntax, thereby allowing complex test cases to be performed with minimal knowledge of the underlying high-level language.
[0019] Metafile 102 may be any type of data file stored in any machine-readable medium. In one embodiment, metafile 102 is a conventional text file comprising a number of lines of text, white space, carriage-returns, and/or any other special characters traditionally included in known character sets (e.g., ASCII, Unicode, Windows, etc.). Toward this end, metafile 102 may be created by the user via any convenient text editor or other authoring software.

[0020] Metafile 102 is created using a relatively low-complexity metafile language -e.g., a metafile language with a relatively small set of commands as compared to conventional high level languages. In one embodiment, metafile 102 includes a series of lines of text comprising a command string and an expression string separated by a delimiter, where the command string is selected from a vocabulary of commands in the metafile language, and the expression string is an expression as that term is conventionally used in the art.
[0021] In one embodiment, for example, the set of commands (and description of the commands) are as set forth in the following table. The various commands are generally either self-explanatory or described below in conjunction with the examples.
Command Description
V Version compatibility line.
D Description of test being performed on device
L Add a message to the log file
C Command
!C Command for a negative test case
TC Add test case identifier to the log file
W Wait for response from device
!W Ignore timeout error
S Show command
Show command for a negative test case, (for
!S positive test cases "Invalid input detected" is
considered error
Exec command. Executes an external command
via the shell.
Check Exec Command. Used in pair with W::
and look for R:: or !R:: in output of E command
EVAL Evaluate expression as 'in built' Perl code
R Expected result
!R Not expected result
OT Open a telnet session
CT Close a telnet session
Verify if the command shows up in running
PROCESSTEST DO a process test
rucΛT/nΛTΛTT Mark all resources for comparison later, all later
checkpoints compare against previous ones
INCLUDE Include another metafile
FUNCTION Include other functions written as metafiles
REQUIRE Include Perl code extensions If expression evaluates to non-zero, all code
IF ELSE ENDIF between IF and ELSE, or IF and ENDIF if no
ELSE present, is executed

[0022] Thus, metafile 102 might include a series of sequential lines such as:
C show version
R 1.1

[0023] In this simplified example, the first line includes a command string "C" followed by a delimiter "::" which is followed by an expression string "show version." Similarly, the second line includes a command string "R" followed by the delimiter "::" followed by an expression "1.1". As described further below in conjunction with FIG. 2 (and with momentary reference to the table shown above), when the "W" command is encountered, the CLI command "show version" is issued to CLI of device 106, then the system examines the response back from device 106 to see if the response includes the expected string of characters, "1.1". The "W" command instructs the system to wait for the response. In this metafile language embodiment, a "C" command is followed by a "R" (or "!R") command and a "W" command.
[0024] In accordance with another embodiment of the invention, various flow control structures such as conditionals, loops, and the like are incorporated into the metafile language such that certain tests and CLI commands can be tested multiple times and/or using expressions with incrementing variables. In one embodiment, for example, a loop structure employing a "REPEAT" command is used as follows:
EVAL:: $i = 0;
... inserted code
EVAL:: $i++;
UNTIL:: $i < 5

[0025] In this example, the variable i is initialized to zero, then incremented using the

EVAL command within a REPEAT/UNTIL loop as shown. Loops within loops are also permissible.
[0026] It will be appreciated that the particular choice of vocabulary ("C", "R", etc.) is arbitrary, as is the particular delimiter ("::") and syntax {command + delimeter + expression). The metafile language described above is merely exemplary, and is not intended to limit the range of commands, expressions, and syntax that may be employed to implement the present invention.
[0027] Referring again to FIG. 1 , test system 110 may include any combination of hardware, software, and firmware capable of performing the tasks set forth below. That is, the method steps described below in connection with the embodiments disclosed herein may be embodied directly in hardware, in firmware, in a software module executed by a processor, or in any practical combination thereof. Furthermore, a software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium can be coupled to a processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. [0028] In one embodiment, test system 110 includes a general-purpose computer with conventional components and an operating system (e.g., Windows, Linux, etc.) that executes a software module written in a high-level language. Example high-level languages include, for example, Perl, TCL/Expect, Java, C++, and the like. In one embodiment, for example, test system 110 includes a software module consisting, in part, of a Perl script operating on a conventional personal computer that is configured to establish a network connection with device 106.
[0029] Device 106 may be any type of device having a command line interface (CLI). In this regard, a CLI is a method of interacting with a device that allows a sequence of characters to be entered on a single line, including various parameters, commands, variables, flags, switches, and the like. The CLI may be accessed via a keyboard or any other convenient method provided by the device. In the illustrated embodiment, CLI 120 is accessible via a network connection (112, 1 14), i.e., any wired or wireless network connection now known or later developed.
[0030] In one embodiment, CLI 120 is accessed via a packet-switched network - e.g., via a Telnet session established between system 110 and device 106, both of which will typically have its own IP address within the network (see example metafile below). For the purpose of clarity, the network in FIG. 1 is shown as a two-way network connection (112, 114) between device 106 and test 110. It will be understood, however, that the network might include various other components and nodes, such as servers, workstations, routers, and the like.

[0031] Device 106 may be, for example, a network component such as a switch, a gateway, a router, or a wireless access point, but might also be a portable device such as a mobile computer, a personal data assistant, a barcode reader, or the like. Depending upon the nature of device 106, the range of possible CLI commands and responses that are supported by device 106 will vary. However, the present invention contemplates the use of any arbitrary device CLI, as long as that CLI and its range of commands is known a priori. The particular CLI commands sent to device 106 are simply set forth in metafile 102 (e.g., as the expression to the "C" command). Similarly, the expected responses to the issued CLI commands are typically known a priori, and form the basis of the test results logged in test summary 104.
[0032] Test summary 104 serves to record the results of the various tests performed by system 110, and may be any form of file, hard-copy output, computer media, or visual indicator. In one embodiment, test summary 104 is a text file that includes lines of text specifying whether the tests set forth in metafile 102 passed or failed, and/or whether any defined test cases (i.e., groups of individual tests) passed or failed. In accordance with the metafile language described above, test summary 104 may include additional helpful information, such as a test description ("D" command) or an arbitrary log message ("L" command).
[0033] Having thus given a description of the various components of an exemplary system, a test method in accordance with one embodiment of the present invention will now be described in conjunction with FIGS. 2A-2B. In this regard, it should be appreciated that the illustrated method may include any number of additional or alternative tasks, the tasks shown in FIGS. 2A-2B need not be perfoπned in the illustrated order, and process 200 may be incorporated into a more comprehensive procedure or process having additional functionality not described in detail herein.
[0034] With reference to FIGS. 1, 2A, and 2B, a suitable metafile 102 is first created (202). As mentioned above, metafile 102 may be created using a text editor or any other convenient authoring program. For example, metafile 102 may be created using a computer system on which test system 110 is implemented.
[0035] Next, the system established a connection with device 106 (204). In one embodiment, this connection comprises a connection (such as Telnet and/or ssh) over a packet-switched network such as the Internet. Any other such wired or wireless connection may be employed.

[0036] Once the connection is established, and any preliminary hand-shaking is completed, a line of text from metafile 102 is read by the system (206). If the line is empty (208), or includes a comment (e.g., a line beginning with a "#" character), processing continues with steps 228 and 206, and the next line of metafile 102 is read by the system.
[0037] The line of text is then parsed into a command string and expression string (210), where the expression string may be empty. As mentioned previously, the syntax may vary, but in one embodiment it is of the form command string + delimiter + expression string, where the delimiter is a pair of colons characters.
[0038] If, at decision step 212, the command string is a "C" (or any other string intended to designate a command), the system stores the expression string as a CLI command to be used later (226) then continues to steps 228 and 206, where the next line is processed.
[0039] If, at decision step 214, the command string is an "R" or "!R" (or any other combination of strings intended to indicate the expected or non-expected results), the system stores the expression string as an expected or non-expected result (224) then continues to steps 228 and 206, where the next line is processed.
[0040] If, at decision step 216, the command string is a "W" (or any other string intended to designate waiting), the system continues with step 230, where a CLI command (or "device command") corresponding to the previously-stored "C::" expression is sent via CLI 120 to device 106. A response from device 106 is then received back via CLI 120 (240), and that response is compared to the expected response previously stored from the preceding "R::" and "!R::" command (242). If the received response contains the string of characters specified in the stored expected result, and it does not contain the string of characters specified in the non-expected results (if any), then a "PASS" or equivalent notation is logged for use by test summary 104; otherwise, a "FAIL" or equivalent notation is logged (244). After this logging step, processing continues again with steps 228 and 206, where the next line of metafile 102 is read.
[0041] If, at decision step 218, the end of metafile 102 is reached, or the end of a test case is reached (e.g., as indicated by the string "TC::" alone on a line), then the pass/fail status of the entire test case is logged (220). That is, if all tests within a test case achieved a PASS designation, then the test case is designated as a PASS. If at least one test within a test case achieved a FAIL designation, however, then the test case is designated as a FAIL. After test summary 104 is appropriately updated, the connection is closed with device 106 (222).
[0042] It will be appreciated that the method shown in FIGS. 2 A and 2B address only a portion of the command types used by the system, and that the method might also perform a number of other procedures (e.g., other procedures associated with the commands listed in the table above). The system might also provide flow control, conditional statements, and might also parse expressions for certain high-level language commands (e.g., regular expressions, Perl commands, C commands, and the like).
[0043] What follows is an example metafile useful in illustrating the exemplary metafile language set forth above. For convenience, line numbers are included, although these line numbers would not typically be included in the text file itself. Comments are indicated using "#" as the first character in a line.
I ###################################
3 # Version command
4 V::1.0
6 # Specify the test case number. In the final report, it returns
7 # logical 'and' of PASS or FAIL for all commands in a test case
8 TC::TC0001
10 # Open telnet session
I I OT::
13 # Add log message
14 L: : Verify http is currently enabled
16 C: : show ip http
17 #look for the word 'enabled' in the output
18 R::enabled
19 W::
21 L: : Verify thttpd process has restart count of 1
22 C::show pm
23 R::thttpd[\W]*l
24 W::
25 # This test case is complete. If the file has another test case e.g. TC0002,

26 # add command TC::TC0002 instead of TC:: which means previous test

27 # case has ended and new one has started. Output of the program is
28 # PASS or FAIL for each # Test case
30 TC:: 31 # close the Telnet session. Following command is optional and if not
32 # specified at end of file then is assumed.
33 CT::
35 ####################################
[0045] As described previously, the metafile is processed by the system line-by-line. Thus, lines 1-3 would be ignored by the system (per step 208 of FIG. 2A) as they are either blank or contain comments. Line 4 specifies the version, and is preferably logged as part of the test summary. In line 8, the test case is specified using the "TC" command. In this example, the test case is labeled "TCOOOl". The individual tests that follow are then considered as part of this test case.
[0046] In line 11 , the "OT" command is used to open a Telnet connection to the device being tested. In this example, the target device has an IP address of The system then established a connection with the address over the TCP/IP network in the conventional manner. The IP address of the device being tested may alternatively be specified in the command line of the testing software module when invoked.
[0047] In line 14, a log message is included using the "L" command. That is, the text "Verify http is currently enabled" is logged to the test summary file.
[0048] In lines 16-19, the first real test is performed. First, in line 16, the "C" command is used to specify the CLI command "show ip http", which is stored by the system. Next, in line 18, the expected result of "enabled" is specified using the "R" command. Finally, in line 19, the "W" command (wait command) waits for a response from the device (i.e., a response to the "show ip http" CLI command), then logs the PASS/FAIL result based upon whether the text string includes the word "enabled".
[0049] In lines 21-24, the system similarly adds a log message via the "L" command, then tests the device using a "show pm" CLI command with an expected result of "thhtpd[\W]*l . In this regard, the expected result is framed as a regular expression, as that term is used in the art to specify certain pattern-matching capabilities. In the illustrated embodiment, this regular expression of the type commonly used in connection with Perl scripts.
[0050] In line 30, the "TC" command is used to terminate the test case. That is, lines 16-24 include two individual tests that are part of a single test case "TCOOOl". Additional test cases may be included after TCOOOl, e.g., by declaring "TC::TC0002" rather than using the terminator "TC::".

[0051] Finally, in step 33, the "CT" command is used to close the telnet connection to the device under test. This command is optional, and is assumed if not specified by the end of the metafile.
[0052] FIG. 3 shows a system 100 in accordance with an alternate embodiment. As shown, a terminology block 302 is provided, and is accessed by test system 110 to allow testing of multiple platforms, as described m further below In general, terminology block 302 includes text, rules, procedures, or other information that is specifically associated with the identity (e.g., the manufacturer, model number, etc.) of device 106. Test system 110 is configured to substitute device commands parsed from metafile 102 to create modified device commands that will produce the desired output from device 106
[0053] Terminology block 302 may have any suitable data structure. For example, in one embodiment, terminology block 302 includes ordered pairs of text strings (310 and 312) that specify a search string (i.e., the first text string 310) and a replacement stπng (i.e , the second text stπng 312) that is to be substituted m place of the search stπng. These lists of coπespondmg text strings may be provided in accordance with any desired syntax — e g , pairs of text strings separated by a suitable delimiter The terminology block 302 is not limited, however, to simple one-to-one mapping of search string and replacement string.
[0054] Terminology block 302 may be provided for a particular device (i.e., test system 110 may select a terminology block from a set of such blocks), or the terminology block itself may include listings for multiple devices — each of which having its own associated sets of text strings That is, the terminology block 302 may include all possible substitution rules for all the various devices that may be tested, allowing test system 110 to seaich through the test block for the appropriate set of substitution rules.
[0055] In one embodiment, for example, keywords are separated by an equal sign ("=") The following example teπxunology block is used to substitute keywords from one operating system to another operating system
# Example Terminology Block
# Syntax: keywordl = keyword2 (space, equal sign, space)
ap = rp
ap- rp- # in the next line, unused keyword is replaced by space
ap300 =
boot system = boot flash
clear arp-cache = clear arp
clock set = time
delete = erase
domain-lookup = dns
domain-name = domain http secure-server = secure-web-management
ht tp server = web-management
ki l l ses s ion = support ki ll se s sion
manual -wlan-mappmg = advanced- conf ig
mobile-unit = station
mu = station
name-server = dns
snmp-server community \(\w*\) ro = snmp-server community \1
snmp-server community \(\w*\) rw = snmp-server community \1
service = support
support password encryption = password encryption
show boot = show flash
show clock = show time
show debugging = show debug
show ip interface brief = show ip interface
show sessions = support show sessions
show wireless radio$ = show wireless radio-status
mu-mu-disallow = lnter-station-blockmg
wireless-switch = wireless-module
# show diag hardware
Pentium4 = AuthenticAMD
Hyperstone = Toshiba
[0057] The substitution process may be performed at any suitable point in the testing process. Referring to FIG. 4, for example, terminology substitution step 402 is performed just prior to issuance of the command (in this case, the modified command) via the CLI. In an alternate embodiment, however, the substitution process may proceed line-by-line just as the command is to be issued to the CLI (i.e., on the command line itself). Indeed, terminology substitution step 402 may be performed just after reading a line of the metafile (step 206), after parsing of the line (step 210), or after storing of parsed expressions (just prior to "next line" step 228).
[0058] As can be seen, the use of a terminology block with device-specific substitution rules allows a single metafile to be created and reused for multiple platforms. For example, a predetermined set of tests may be desired for a particular class of devices, such as network switches. The set of tests may be specified by the metafile, while the particular content and syntax to be used for the various platforms of network switches (i.e., various OEMs) is contained within the terminology block itself.
[0059] While at least one example embodiment has been presented in the foregoing detailed description, it should be appreciated that a vast number of variations exist. For example, while the illustrated invention utilizes the test system to interpret the metafile lme-by-line, the system may in fact create an intermediate high-level language file (e.g., a Perl file) which can be used for testing independent of the metafile. Alternatively, the metafile may be used to create a compiled executable file.
[0060] It should also be appreciated that the example embodiment or embodiments described herein are not intended to limit the scope, applicability, or configuration of the invention in any way. Rather, the foregoing detailed description will provide those skilled in the art with a convenient road map for implementing the described embodiment or embodiments. It should be understood that various changes can be made in the function and arrangement of elements without departing from the scope of the invention as set forth in the appended claims and the legal equivalents thereof.