14. DUT connectivity module/package

Each function in this module will treat different command flows. As example; in part of commands we need to send to process only one string to get the main prompt back. In other commands we need to send more then one and sometimes very different one from each other.

The idea behind creating this module was to concentrate all Expect activity in one place. All future changes in the CLI will be easy to implement and will not impact on other part of test suite.

Example 1. Simple flow.

    [main@prompt]$ command
    [main@prompt]$
   

Call for function treating this flow can look like this:

$test->send_command("command"); img. which code will look more or less like this:

Figure 1. EOF, Timeout expect should be add to this code to make your test more reliable.

Example 2. More complex flow.

    [main@prompt]$ command
    
      Enter the parameter: parameter
      Are you sure (y/n)? y
      Command succeed.
    
    [main@prompt]$
   

Here the call will be a little different:

$test->send_command2("command:parameter:y");

Figure 2. Same as above.