ea080a1b839e93ce4aced501848d085a1b5d1ca1
[csit.git] / resources / libraries / robot / shared / memif.robot
1 # Copyright (c) 2017 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 | Library | resources.libraries.python.Memif
16 | Documentation | Memif interface keyword library.
17
18 *** Keywords ***
19 | Set up memif interfaces on DUT node
20 | | [Documentation] | Create two Memif interfaces on given VPP node.
21 | | ...
22 | | ... | *Arguments:*
23 | | ... | - ${dut_node} - DUT node. Type: dictionary
24 | | ... | - ${filename1} - Socket filename for 1st Memif interface. Type: string
25 | | ... | - ${filename2} - Socket filename for 2nd Memif interface. Type: string
26 | | ... | - ${mid} - Memif interface ID. Type: integer
27 | | ... | - ${memif_if1} - Name of the first Memif interface (Optional).
28 | | ... | Type: string
29 | | ... | - ${memif_if2} - Name of the second Memif interface (Optional).
30 | | ... | Type: string
31 | | ... | - ${rxq} - RX queues. Type: integer
32 | | ... | - ${txq} - TX queues. Type: integer
33 | | ... | - ${role} - Memif role. Type: string
34 | | ...
35 | | ... | _NOTE:_ This KW sets following test case variable:
36 | | ... | - ${${memif_if1}} - 1st Memif interface.
37 | | ... | - ${${memif_if2}} - 2nd Memif interface.
38 | | ...
39 | | ... | *Example:*
40 | | ...
41 | | ... | \| Set up memif interfaces on DUT node \
42 | | ... | \| ${nodes['DUT1']} \| sock1 \| sock2 \| 1 \|
43 | | ... | \| Set up memif interfaces on DUT node \
44 | | ... | \| ${nodes['DUT2']} \| sock1 \| sock2 \| 1 \
45 | | ... | \| dut2_memif_if1 \| dut2_memif_if2 \| 1 \| 1 \| slave \|
46 | | ...
47 | | [Arguments] | ${dut_node} | ${filename1} | ${filename2} | ${mid}=${1}
48 | | ... | ${memif_if1}=memif_if1 | ${memif_if2}=memif_if2 | ${rxq}=${1}
49 | | ... | ${txq}=${1} | ${role}=slave
50 | | ${sid_1}= | Evaluate | (${mid}*2)-1
51 | | ${sid_2}= | Evaluate | (${mid}*2)
52 | | ${memif_1}= | Create memif interface | ${dut_node}
53 | | ... | ${filename1}${mid}-${sid_1} | ${mid} | ${sid_1} | rxq=${rxq}
54 | | ... | txq=${txq} | role=${role}
55 | | ${memif_2}= | Create memif interface | ${dut_node}
56 | | ... | ${filename2}${mid}-${sid_2} | ${mid} | ${sid_2} | rxq=${rxq}
57 | | ... | txq=${txq} | role=${role}
58 | | Set Interface State | ${dut_node} | ${memif_1} | up
59 | | Set Interface State | ${dut_node} | ${memif_2} | up
60 | | Set Test Variable | ${${memif_if1}} | ${memif_1}
61 | | Set Test Variable | ${${memif_if2}} | ${memif_2}
62
63 | Set up single memif interface on DUT node
64 | | [Documentation] | Create single Memif interface on given VPP node.
65 | | ...
66 | | ... | *Arguments:*
67 | | ... | - ${dut_node} - DUT node. Type: dictionary
68 | | ... | - ${filename} - Socket filename for Memif interface. Type: string
69 | | ... | - ${mid} - Memif interface ID. Type: integer
70 | | ... | - ${memif_if} - Name of the Memif interface (Optional).
71 | | ... | Type: string
72 | | ... | - ${rxq} - RX queues. Type: integer
73 | | ... | - ${txq} - TX queues. Type: integer
74 | | ... | - ${role} - Memif role. Type: string
75 | | ...
76 | | ... | _NOTE:_ This KW sets following test case variable:
77 | | ... | - ${${memif_if}} - Memif interface.
78 | | ...
79 | | ... | *Example:*
80 | | ...
81 | | ... | \| Set up single memif interface on DUT node \
82 | | ... | \| ${nodes['DUT1']} \| sock1 \| 1 \| dut1_memif_if1 \| 1 \| 1 \
83 | | ... | \| slave \|
84 | | ...
85 | | [Arguments] | ${dut_node} | ${filename} | ${mid}=${1}
86 | | ... | ${memif_if}=memif_if1 | ${rxq}=${1} | ${txq}=${1} | ${role}=slave
87 | | ${sid}= | Evaluate | (${mid}*2)-1
88 | | ${memif}= | Create memif interface | ${dut_node} | ${filename}${mid}-${sid}
89 | | ... | ${mid} | ${sid} | rxq=${rxq} | txq=${txq} | role=${role}
90 | | Set Interface State | ${dut_node} | ${memif} | up
91 | | Set Test Variable | ${${memif_if}} | ${memif}