71909af490c0eaa892fd8f1a2e9ddd01be6e5144
[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 | | ... | - ${sock1} - Socket path for first Memif interface. Type: string
25 | | ... | - ${sock2} - Socket path for second Memif interface. Type: string
26 | | ... | - ${number} - Memif interface key. 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}} - First Memif interface.
34 | | ... | - ${${memif_if2}} - Second Memif interface.
35 | | ...
36 | | ... | *Example:*
37 | | ...
38 | | ... | \| Set up memif interfaces on DUT node \
39 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \| 1 \|
40 | | ... | \| Set up memif interfaces on DUT node \
41 | | ... | \| ${nodes['DUT2']} \| /tmp/sock1 \| /tmp/sock2 \| 1 \
42 | | ... | \| dut2_memif_if1 \| dut2_memif_if2 \|
43 | | ...
44 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${number}=${1}
45 | | ... | ${memif_if1}=memif_if1 | ${memif_if2}=memif_if2
46 | | ${key_1}= | Evaluate | (${number}*2)-1
47 | | ${key_2}= | Evaluate | (${number}*2)
48 | | ${memif_1}= | Create memif interface | ${dut_node} | ${sock1} | ${key_1}
49 | | ${memif_2}= | Create memif interface | ${dut_node} | ${sock2} | ${key_2}
50 | | Set Interface State | ${dut_node} | ${memif_1} | up
51 | | Set Interface State | ${dut_node} | ${memif_2} | up
52 | | Set Test Variable | ${${memif_if1}} | ${memif_1}
53 | | Set Test Variable | ${${memif_if2}} | ${memif_2}
54
55 | Create memif VPP configuration on '${nr}' LXC containers on '${dut}' node
56 | | [Documentation] | Create memif configuration of VPP on multiple LXC
57 | | ... | container on DUT node.
58 | | ...
59 | | ... | *Example:*
60 | | ...
61 | | ... | \| Create memif VPP configuration on 1 LXC containers on DUT1 node \|
62 | | ...
63 | | :FOR | ${number} | IN RANGE | 1 | ${nr}+1
64 | | | Run Keyword | ${dut}_${lxc_base_name}_${number}.Create VPP cfg in container
65 | | | ... | memif_create_lxc.vat | socket1=memif-${dut}_VNF${number}-1
66 | | | ... | socket2=memif-${dut}_VNF${number}-2
67
68 | Create memif VPP configuration on '${nr}' LXC containers on all DUT nodes
69 | | [Documentation] | Create memif configuration of VPP on multiple LXC
70 | | ... | container on all DUT nodes.
71 | | ...
72 | | ... | *Example:*
73 | | ...
74 | | ... | \| Create memif VPP configuration on 1 LXC containers on all \
75 | | ... | DUT nodes \|
76 | | ...
77 | | ${duts}= | Get Matches | ${nodes} | DUT*
78 | | :FOR | ${dut} | IN | @{duts}
79 | | | Create memif VPP configuration on '${nr}' LXC containers on '${dut}' node