CSIT-989 Fix: Reflect latest memif API changes
[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 | | ...
32 | | ... | _NOTE:_ This KW sets following test case variable:
33 | | ... | - ${${memif_if1}} - 1st Memif interface.
34 | | ... | - ${${memif_if2}} - 2nd Memif interface.
35 | | ...
36 | | ... | *Example:*
37 | | ...
38 | | ... | \| Set up memif interfaces on DUT node \
39 | | ... | \| ${nodes['DUT1']} \| sock1 \| sock2 \| 1 \|
40 | | ... | \| Set up memif interfaces on DUT node \
41 | | ... | \| ${nodes['DUT2']} \| sock1 \| sock2 \| 1 \
42 | | ... | \| dut2_memif_if1 \| dut2_memif_if2 \|
43 | | ...
44 | | [Arguments] | ${dut_node} | ${filename1} | ${filename2} | ${mid}=${1}
45 | | ... | ${memif_if1}=memif_if1 | ${memif_if2}=memif_if2
46 | | ${sid_1}= | Evaluate | (${mid}*2)-1
47 | | ${sid_2}= | Evaluate | (${mid}*2)
48 | | ${memif_1}= | Create memif interface | ${dut_node}
49 | | ... | ${filename1}${mid}-${sid_1} | ${mid} | ${sid_1}
50 | | ${memif_2}= | Create memif interface | ${dut_node}
51 | | ... | ${filename2}${mid}-${sid_2} | ${mid} | ${sid_2}
52 | | Set Interface State | ${dut_node} | ${memif_1} | up
53 | | Set Interface State | ${dut_node} | ${memif_2} | up
54 | | Set Test Variable | ${${memif_if1}} | ${memif_1}
55 | | Set Test Variable | ${${memif_if2}} | ${memif_2}