Python3: resources and libraries
[csit.git] / resources / libraries / robot / shared / memif.robot
1 # Copyright (c) 2019 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Documentation | Memif interface keyword library.
16 |
17 | Library | resources.libraries.python.Memif
18 | Variables | resources/libraries/python/Constants.py
19
20 *** Keywords ***
21 | Set up memif interfaces on DUT node
22 | | [Documentation] | Create two Memif interfaces on given VPP node.
23 | |
24 | | ... | *Arguments:*
25 | | ... | - dut_node - DUT node. Type: dictionary
26 | | ... | - filename1 - Socket filename for 1st Memif interface. Type: string
27 | | ... | - filename2 - Socket filename for 2nd Memif interface. Type: string
28 | | ... | - mid - Memif interface ID. Type: integer, default value: ${1}
29 | | ... | - memif_if1 - Name of the first Memif interface (Optional).
30 | | ... | Type: string, default value: memif_if1
31 | | ... | - memif_if2 - Name of the second Memif interface (Optional).
32 | | ... | Type: string, default value: memif_if2
33 | | ... | - rxq - RX queues; 0 means do not set (Optional). Type: integer,
34 | | ... | default value: ${1}
35 | | ... | - txq - TX queues; 0 means do not set (Optional). Type: integer,
36 | | ... | default value: ${1}
37 | | ... | - role - Memif role (Optional). Type: string, default value: SLAVE
38 | |
39 | | ... | _NOTE:_ This KW sets following test case variable:
40 | | ... | - ${${memif_if1}} - 1st Memif interface.
41 | | ... | - ${${memif_if2}} - 2nd Memif interface.
42 | |
43 | | ... | *Example:*
44 | |
45 | | ... | \| Set up memif interfaces on DUT node \
46 | | ... | \| ${nodes['DUT1']} \| sock1 \| sock2 \| 1 \|
47 | | ... | \| Set up memif interfaces on DUT node \
48 | | ... | \| ${nodes['DUT2']} \| sock1 \| sock2 \| 1 \
49 | | ... | \| dut2_memif_if1 \| dut2_memif_if2 \| 1 \| 1 \| SLAVE \|
50 | | ... | \| ${nodes['DUT2']} \| sock1 \| sock2 \| 1 \| rxq=0 \| txq=0 \
51 | | ... | \| dcr_uuid=_a5730a0a-2ba1-4fe9-91bd-79b9828e968e \|
52 | |
53 | | [Arguments] | ${dut_node} | ${filename1} | ${filename2} | ${mid}=${1}
54 | | ... | ${memif_if1}=memif_if1 | ${memif_if2}=memif_if2 | ${rxq}=${1}
55 | | ... | ${txq}=${1} | ${role}=SLAVE
56 | |
57 | | ${sid_1}= | Evaluate | (${mid}*2)-1
58 | | ${sid_2}= | Evaluate | (${mid}*2)
59 | | ${memif_1}= | Create memif interface | ${dut_node}
60 | | ... | ${filename1}${mid}${DUT1_UUID}-${sid_1} | ${mid} | ${sid_1}
61 | | ... | rxq=${rxq} | txq=${txq} | role=${role}
62 | | ${memif_2}= | Create memif interface | ${dut_node}
63 | | ... | ${filename2}${mid}${DUT1_UUID}-${sid_2} | ${mid} | ${sid_2}
64 | | ... | rxq=${rxq} | txq=${txq} | role=${role}
65 | | Set Interface State | ${dut_node} | ${memif_1} | up
66 | | Set Interface State | ${dut_node} | ${memif_2} | up
67 | | Set Test Variable | ${${memif_if1}} | ${memif_1}
68 | | Set Test Variable | ${${memif_if2}} | ${memif_2}
69
70 | Set up single memif interface on DUT node
71 | | [Documentation] | Create single Memif interface on given VPP node.
72 | |
73 | | ... | *Arguments:*
74 | | ... | - dut_node - DUT node. Type: dictionary
75 | | ... | - filename - Socket filename for Memif interface. Type: string
76 | | ... | - mid - Memif interface ID (Optional). Type: integer
77 | | ... | - sid - Memif socket ID (Optional). Type: integer
78 | | ... | - memif_if - Name of the Memif interface (Optional).
79 | | ... | Type: string
80 | | ... | - rxq - RX queues (Optional). Type: integer
81 | | ... | - txq - TX queues (Optional). Type: integer
82 | | ... | - role - Memif role (Optional). Type: string
83 | |
84 | | ... | _NOTE:_ This KW sets following test case variable:
85 | | ... | - ${${memif_if}} - Memif interface.
86 | |
87 | | ... | *Example:*
88 | |
89 | | ... | \| Set up single memif interface on DUT node \
90 | | ... | \| ${nodes['DUT1']} \| sock1 \| 1 \| dut1_memif_if1 \| 1 \| 1 \
91 | | ... | \| SLAVE \|
92 | |
93 | | [Arguments] | ${dut_node} | ${filename} | ${mid}=${1} | ${sid}=${1}
94 | | ... | ${memif_if}=memif_if1 | ${rxq}=${1} | ${txq}=${1} | ${role}=SLAVE
95 | |
96 | | ${memif}= | Create memif interface | ${dut_node} | ${filename}${mid}-${sid}
97 | | ... | ${mid} | ${sid} | rxq=${rxq} | txq=${txq} | role=${role}
98 | | Set Interface State | ${dut_node} | ${memif} | up
99 | | Set Test Variable | ${${memif_if}} | ${memif}