Ready to Use Auxiliaries

Communication Auxiliary

This plugin only contains two keywords “Send message” and “Receive message”. The first one simply sends raw bytes using the associated connector and the second one returns one received message (raw form).

See below a complete example of the Robot Communication Auxiliary plugin:

*** Settings ***
Documentation   Robot framework Demo for communication auxiliary implementation

Library    pykiso.lib.robot_framework.communication_auxiliary.CommunicationAuxiliary    WITH NAME    ComAux

*** Keywords ***

send raw message
    [Arguments]  ${raw_msg}  ${aux}
    ${is_executed}=    ComAux.Send message    ${raw_msg}    ${aux}
    [return]  ${is_executed}

get raw message
    [Arguments]  ${aux}  ${blocking}  ${timeout}
    ${msg}  ${source}=    ComAux.Receive message    ${aux}    ${blocking}    ${timeout}
    [return]  ${msg}  ${source}

*** Test Cases ***

Test send raw bytes using keywords
    [Documentation]    Simply send raw bytes over configured channel
    ...                using defined keywords

    ${state}  send raw message    \x01\x02\x03    aux1

    Log    ${state}

    Should Be Equal   ${state}    ${TRUE}

    ${msg}  ${source}  get raw message    aux1    ${TRUE}    0.5

    Log    ${msg}

Test send raw bytes
    [Documentation]    Simply send raw bytes over configured channel
    ...                using communication auxiliary methods directly

    ${state} =  Send message    \x04\x05\x06    aux2

    Log    ${state}

    Should Be Equal   ${state}    ${TRUE}

    ${msg}  ${source} =  Receive message    aux2    ${FALSE}    0.5

    Log    ${msg}

Dut Auxiliary

This plugin can be used to control the ITF TestApp on the DUT.

See below an example of the Robot Dut Auxiliary plugin:

*** Settings ***
Documentation   Test demo with RobotFramework and ITF TestApp

Library    pykiso.lib.robot_framework.dut_auxiliary.DUTAuxiliary    WITH NAME    DutAux

Suite Setup       Setup Aux

*** Keywords ***
Setup Aux
    @{auxiliaries} =    Create List  aux1  aux2
    Set Suite Variable  @{suite_auxiliaries}  @{auxiliaries}

*** Variables ***

*** Test Cases ***

Test TEST_SUITE_SETUP
    [Documentation]   Setup test suite on DUT
    Test App    TEST_SUITE_SETUP  1  1  ${suite_auxiliaries}

Test TEST_SECTION_RUN
    [Documentation]   Run test section on DUT
    Test App    TEST_SECTION_RUN  1  1  ${suite_auxiliaries}

Test TEST_CASE_SETUP
    [Documentation]   Setup test case on DUT
    Test App    TEST_CASE_SETUP  1  1  ${suite_auxiliaries}

Test TEST_CASE_RUN
    [Documentation]   Run test case on DUT
    Test App    TEST_CASE_RUN  1  1  ${suite_auxiliaries}

Test TEST_CASE_TEARDOWN
    [Documentation]   Teardown test case on DUT
    Test App    TEST_CASE_TEARDOWN  1  1  ${suite_auxiliaries}

Test TEST_SUITE_TEARDOWN
    [Documentation]   Teardown test suite on DUT
    Test App    TEST_SUITE_TEARDOWN  1  1  ${suite_auxiliaries}

Proxy Auxiliary

This robot plugin only contains two keywords : Suspend and Resume.

See below example :

*** Settings ***
Documentation   Robot framework Demo for proxy auxiliary implementation

Library    pykiso.lib.robot_framework.proxy_auxiliary.ProxyAuxiliary    WITH NAME    ProxyAux


*** Test Cases ***

Stop auxiliary run
    [Documentation]    Simply stop the current running auxiliary

    Suspend    ProxyAux

Resume auxiliary run
    [Documentation]    Simply resume the current running auxiliary

    Resume    ProxyAux

Instrument Control Auxiliary

As the “ITF” instrument control auxiliary, the robot version integrate exactly the same user’s interface.

Note

All return types between “ITF” and “Robot” auxiliary’s version stay identical!

Please find below a complete correlation table:

ITF method

robot equivalent

Parameter 1

Parameter 2

Parameter 3

write

Write

command

aux alias

validation

read

Read

aux alias

query

Query

command

aux alias

get_identification

Get identification

aux alias

get_status_byte

Get status byte

aux alias

get_all_errors

Get all errors

aux alias

reset

Reset

aux alias

self_test

Self test

aux alias

get_remote_control_state

Get remote control state

aux alias

set_remote_control_on

Set remote control on

aux alias

set_remote_control_off

Set remote control off

aux alias

get_output_channel

Get output channel

aux alias

set_output_channel

Set output channel

channel

aux alias

get_output_state

Get output state

aux alias

enable_output

Enable output

aux alias

disable_output

Disable output

aux alias

get_nominal_voltage

Get nominal voltage

aux alias

get_nominal_current

Get nominal current

aux alias

get_nominal_power

Get nominal power

aux alias

measure_voltage

Measure voltage

aux alias

measure_current

Measure current

aux alias

measure_power

Measure power

aux alias

get_target_voltage

Get target voltage

aux alias

get_target_current

Get target current

aux alias

get_target_power

Get target power

aux alias

set_target_voltage

Set target voltage

voltage

aux alias

set_target_current

Set target current

current

aux alias

set_target_power

Set target power

power

aux alias

get_voltage_limit_low

Get voltage limit low

aux alias

get_voltage_limit_high

Get voltage limit high

aux alias

get_current_limit_low

Get current limit low

aux alias

get_current_limit_high

Get current limit high

aux alias

get_power_limit_high

Get power limit high

aux alias

set_voltage_limit_low

Set voltage limit low

voltage limit

aux alias

set_voltage_limit_high

Set voltage limit high

voltage limit

aux alias

set_current_limit_low

Set current limit low

current limit

aux alias

set_current_limit_high

Set current limit high

current limit

aux alias

set_power_limit_high

Set power limit high

power limit

aux alias

To run the available example:

cd examples
robot robot_test_suite/test_instrument

Note

A script demo with all available keywords is under examples/robot_test_suite/test_instrument and yaml see robot_inst_aux.yaml!

Acroname Auxiliary

This plugin can be used to control a acroname usb hub.

Find below an example with all available features:

 1*** Settings ***
 2Documentation   Robot framework Demo for acroname auxiliary implementation
 3
 4Library    pykiso.lib.robot_framework.acroname_auxiliary.AcronameAuxiliary    WITH NAME    AcroAux
 5
 6*** Variables ***
 7${NO_ERROR} =    ${0}
 8
 9*** Test Cases ***
10
11Disable / Enable USB Ports
12    [Documentation]    Disable and Enable USB Ports
13
14    Log    Disable all Ports
15
16    FOR    ${index}    IN RANGE    0    4
17        Log    Disable USB port ${index}
18        ${state}  Set port disable    acroname_aux    ${index}
19        Should Be Equal   ${state}    ${NO_ERROR}
20    END
21
22    Sleep    1s
23
24    FOR    ${index}    IN RANGE    0    4
25        Log    Enable USB port ${index}
26        ${state}  Set port disable    acroname_aux    ${index}
27        Should Be Equal   ${state}    ${NO_ERROR}
28    END
29
30    Sleep    1s
31
32Get Port Current
33    [Documentation]    Read usb port current
34
35    Log    Read port current
36
37    FOR    ${index}    IN RANGE    0    4
38        ${current}  Get port current    acroname_aux    ${index}    mA
39        Log    Current on port ${index} is ${current} mA
40    END
41
42    Sleep    1s
43
44Get Port Voltage
45    [Documentation]    Read usb port voltage
46
47    Log    Read port voltage
48
49    FOR    ${index}    IN RANGE    0    4
50        ${voltage}  Get port voltage    acroname_aux    ${index}    mV
51        Log    Voltage on port ${index} is ${voltage} mV
52    END
53
54    Sleep    1s
55
56Set Port Current Limit
57    [Documentation]    Set usb port current
58
59    Log    Read port current
60
61    FOR    ${index}    IN RANGE    0    4
62        Log    Set port current on port ${index} to 500 mA
63        ${state}  Set port current limit    acroname_aux    ${index}    ${500}    mA
64        Should Be Equal   ${state}    ${NO_ERROR}
65    END
66
67    Sleep    1s
68
69Get Port Current Limit
70    [Documentation]    Get usb port current limit
71
72    Log    Read port current
73
74    FOR    ${index}    IN RANGE    0    4
75        ${current}  Get port current limit    acroname_aux    ${index}    mA
76        Log    Port limit on port ${index} is ${current} mA
77    END
78
79    Sleep    1s
80
81Set Port Current Limit to max
82    [Documentation]    Set usb port current limit
83
84    Log    Read port current
85
86    FOR    ${index}    IN RANGE    0    4
87        Log    Set port current on port ${index} to 1500 mA
88        ${state}  Set port current limit    acroname_aux    ${index}    ${1500}    mA
89        Should Be Equal   ${state}    ${NO_ERROR}
90    END
91
92    Sleep    1s

To run the available example:

cd examples
robot robot_test_suite/test_instrument

Record Auxiliary

Auxiliary used to record a connectors receive channel which are configured in the yaml config. The library needs then only to be loaded. See example below:

config.yaml:

 1auxiliaries:
 2  record_aux:
 3    connectors:
 4      com: rtt_channel
 5    config:
 6      # When is_active is set, it actively polls the connector. It demands if
 7      # the used connector needs to be polled actively.
 8      is_active: False # False because rtt_channel has its own receive thread
 9    type: pykiso.lib.auxiliaries.record_auxiliary:RecordAuxiliary
10
11connectors:
12  rtt_channel:
13    config:
14      chip_name: "STM12345678"
15      speed: 4000
16      block_address: 0x12345678
17      verbose: True
18      tx_buffer_idx: 1
19      rx_buffer_idx: 1
20      # Decode strategy for undecodable bytes received by the rtt stream. Valid option are 'ignore' or 'replace'
21      # Default 'replace' to replace undecodable bytes with a suitable replacement character
22      rtt_decode_strategy: "ignore"
23      # Path relative to this yaml where the RTT logs should be written to.
24      # Creates a file named rtt.log
25      rtt_log_path: ./
26      # RTT channel from where the RTT logs should be read
27      rtt_log_buffer_idx: 0
28      # Manage RTT log CPU impact by setting logger speed. eg: 100% CPU load
29      # default: 1000 lines/s
30      rtt_log_speed: null
31    type: pykiso.lib.connectors.cc_rtt_segger:CCRttSegger
32
33test_suite_list:
34- suite_dir: test_record
35  test_filter_pattern: '*.py'
36  test_suite_id: 1

Robot file:

 1*** Settings ***
 2Documentation   Robot framework Demo for record auxiliary
 3
 4# Library import will start recording
 5Library    pykiso.lib.robot_framework.record_auxiliary.RecordAuxiliary
 6
 7*** Keywords ***
 8
 9*** Test Cases ***
10
11Test Something
12    [Documentation]    Record channel in the background
13
14    Sleep    5s

To run the available example:

cd examples
robot robot_test_suite/test_record/

UDS Auxiliary

To run the example:

 1auxiliaries:
 2  uds_aux:
 3    connectors:
 4        com: can_channel
 5    config:
 6      odx_file_path: null
 7      request_id : 0x123
 8      response_id : 0x321
 9      uds_layer:
10        transport_protocol: 'CAN'
11        # p2_can specifies receive time outs in seconds
12        p2_can_client: 5
13        p2_can_server: 1
14      tp_layer:
15        req_id: 0xAB
16        res_id: 0xAC
17        addressing_type: 'NORMAL'
18        n_sa: 0xFF
19        n_ta: 0xFF
20        n_ae: 0xFF
21        m_type: 'DIAGNOSTICS'
22        discard_neg_resp: False
23    type: pykiso.lib.auxiliaries.udsaux.uds_auxiliary:UdsAuxiliary
24connectors:
25  can_channel:
26    config:
27      interface : 'pcan'
28      channel: 'PCAN_USBBUS1'
29      state: 'ACTIVE'
30    type: pykiso.lib.connectors.cc_pcan_can:CCPCanCan

As the “ITF” uds auxiliary, the robot version integrate exactly the same user’s interface.

Note

All return types between “ITF” and “Robot” auxiliary’s version stay identical! Only “Send uds raw” keywords return a list instead of bytes!

Please find below a complete correlation table:

ITF method

robot equivalent

Parameter 1

Parameter 2

Parameter 3

Parameter 4

send_uds_raw

Send uds raw

message

aux alias

timeout

send_uds_config

Send uds config

message

aux alias

timeout

Robot file:

 1*** Settings ***
 2Documentation   Robot framework Demo for uds auxiliary implementation
 3Library    pykiso.lib.robot_framework.uds_auxiliary.UdsAuxiliary    WITH NAME    UdsAux
 4Library    Collections
 5
 6*** Test Cases ***
 7
 8Go in default session
 9    [Documentation]    Send diagnostic session control request session
10    ...                default using Send uds raw
11
12    ${response} =  Send uds raw    \x10\x01    uds_aux
13
14    Log  ${response}
15
16Use tester present sender
17    [Documentation]    If no communication is exchanged with the client for more than 5
18    ...                seconds the control unit automatically exits the current session and
19    ...                returns to the "Default Session" back, and might go to sleep mode.
20    ...
21    ...                To avoid this issue, if test steps take too long between uds commands,
22    ...                the tester present sender can be used. It will send
23    ...                at a defined period a Tester Present, to signal to the device that
24    ...                the client is still present.
25
26    Start tester present with    1  seconds    uds_aux
27    ${response} =  Send uds raw    \x10\x03    uds_aux
28    Stop tester present

To run the available example:

cd examples
robot robot_test_suite/test_uds/