Add library for set path variables for testing.
[csit.git] / resources / libraries / robot / testing_path.robot
1 # Copyright (c) 2016 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.InterfaceUtil
16 | Library | resources.libraries.python.NodePath
17
18 *** Keywords ***
19 | Path for 2-node testing is set
20 | | [Documentation] | Compute path for testing on two given nodes in circular
21 | | ...             | topology and set corresponding test case variables.
22 | | ...
23 | | ... | *Arguments:*
24 | | ... | - ${tg_node} - TG node. Type: dictionary
25 | | ... | - ${dut_node} - DUT node. Type: dictionary
26 | | ... | - ${tg2_node} - Node where the path ends. Must be the same as TG node
27 | | ... |   parameter in circular topology. Type: dictionary
28 | | ...
29 | | ... | *Return:*
30 | | ... | - No value returned
31 | | ...
32 | | ... | _NOTE:_ This KW sets following test case variables:
33 | | ... | - ${tg_node} - TG node.
34 | | ... | - ${tg_to_dut_if1} - 1st TG interface towards DUT.
35 | | ... | - ${tg_to_dut_if2} - 2nd TG interface towards DUT.
36 | | ... | - ${dut_node} - DUT node.
37 | | ... | - ${dut_to_tg_if1} - 1st DUT interface towards TG.
38 | | ... | - ${dut_to_tg_if2} - 2nd DUT interface towards TG.
39 | | ... | - ${tg_to_dut_if1_mac}
40 | | ... | - ${tg_to_dut_if2_mac}
41 | | ... | - ${dut_to_tg_if1_mac}
42 | | ... | - ${dut_to_tg_if2_mac}
43 | | ...
44 | | ... | *Example:*
45 | | ...
46 | | ... | \| Given Path for 2-node testing is set \| ${nodes['TG']} \
47 | | ... | \| ${nodes['DUT1']} \| ${nodes['TG']} \|
48 | | ...
49 | | [Arguments] | ${tg_node} | ${dut_node} | ${tg2_node}
50 | | Should Be Equal | ${tg_node} | ${tg2_node}
51 | | Append Nodes | ${tg_node} | ${dut_node} | ${tg_node}
52 | | Compute Path | always_same_link=${FALSE}
53 | | ${tg_to_dut_if1} | ${tmp}= | First Interface
54 | | ${tg_to_dut_if2} | ${tmp}= | Last Interface
55 | | ${dut_to_tg_if1} | ${tmp}= | First Ingress Interface
56 | | ${dut_to_tg_if2} | ${tmp}= | Last Egress Interface
57 | | ${tg_to_dut_if1_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut_if1}
58 | | ${tg_to_dut_if2_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut_if2}
59 | | ${dut_to_tg_if1_mac}= | Get interface mac | ${dut_node} | ${dut_to_tg_if1}
60 | | ${dut_to_tg_if2_mac}= | Get interface mac | ${dut_node} | ${dut_to_tg_if2}
61 | | Set Test Variable | ${tg_to_dut_if1}
62 | | Set Test Variable | ${tg_to_dut_if2}
63 | | Set Test Variable | ${dut_to_tg_if1}
64 | | Set Test Variable | ${dut_to_tg_if2}
65 | | Set Test Variable | ${tg_to_dut_if1_mac}
66 | | Set Test Variable | ${tg_to_dut_if2_mac}
67 | | Set Test Variable | ${dut_to_tg_if1_mac}
68 | | Set Test Variable | ${dut_to_tg_if2_mac}
69 | | Set Test Variable | ${tg_node}
70 | | Set Test Variable | ${dut_node}
71
72 | Interfaces in 2-node path are up
73 | | [Documentation] | Set UP state on interfaces in 2-node path on nodes and
74 | | ...             | wait for all interfaces are ready. Requires more than
75 | | ...             | one link between nodes.
76 | | ...
77 | | ... | *Arguments:*
78 | | ... | - No arguments.
79 | | ...
80 | | ... | *Return:*
81 | | ... | - No value returned.
82 | | ...
83 | | ... | _NOTE:_ This KW uses test variables sets in
84 | | ... |         "Path for 2-node testing is set" KW.
85 | | ...
86 | | ... | *Example:*
87 | | ...
88 | | ... | \| Given Path for 2-node testing is set \| ${nodes['TG']} \
89 | | ... | \| ${nodes['DUT1']} \| ${nodes['TG']} \|
90 | | ... | \| And Interfaces in 2-node path are up \|
91 | | ...
92 | | Set Interface State | ${tg_node} | ${tg_to_dut_if1} | up
93 | | Set Interface State | ${tg_node} | ${tg_to_dut_if2} | up
94 | | Set Interface State | ${dut_node} | ${dut_to_tg_if1} | up
95 | | Set Interface State | ${dut_node} | ${dut_to_tg_if2} | up
96 | | Vpp Node Interfaces Ready Wait | ${dut_node}
97
98 | Path for 3-node testing is set
99 | | [Documentation] | Compute path for testing on three given nodes in circular
100 | | ...             | topology and set corresponding test case variables.
101 | | ...
102 | | ... | *Arguments:*
103 | | ... | - ${tg_node} - TG node. Type: dictionary
104 | | ... | - ${dut1_node} - DUT1 node. Type: dictionary
105 | | ... | - ${dut2_node} - DUT2 node. Type: dictionary
106 | | ... | - ${tg2_node} - Node where the path ends. Must be the same as TG node
107 | | ... |   parameter in circular topology. Type: dictionary
108 | | ...
109 | | ... | *Return:*
110 | | ... | - No value returned
111 | | ... |
112 | | ... | _NOTE:_ This KW sets following test case variables:
113 | | ... | - ${tg_node} - TG node.
114 | | ... | - ${tg_to_dut1} - TG interface towards DUT1.
115 | | ... | - ${tg_to_dut2} - TG interface towards DUT2.
116 | | ... | - ${dut1_node} - DUT1 node.
117 | | ... | - ${dut1_to_tg} - DUT1 interface towards TG.
118 | | ... | - ${dut1_to_dut2} - DUT1 interface towards DUT2.
119 | | ... | - ${dut2_node} - DUT2 node.
120 | | ... | - ${dut2_to_tg} - DUT2 interface towards TG.
121 | | ... | - ${dut2_to_dut1} - DUT2 interface towards DUT1.
122 | | ... | - ${tg_to_dut1_mac}
123 | | ... | - ${tg_to_dut2_mac}
124 | | ... | - ${dut1_to_tg_mac}
125 | | ... | - ${dut1_to_dut2_mac}
126 | | ... | - ${dut2_to_tg_mac}
127 | | ... | - ${dut2_to_dut1_mac}
128 | | ...
129 | | ... | *Example:*
130 | | ...
131 | | ... | \| Given Path for 3-node testing is set \| ${nodes['TG']} \
132 | | ... | \| ${nodes['DUT1']} \| ${nodes['DUT2']} \| ${nodes['TG']} \|
133 | | ...
134 | | [Arguments] | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg2_node}
135 | | Should Be Equal | ${tg_node} | ${tg2_node}
136 | | Append Nodes | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
137 | | Compute Path
138 | | ${tg_to_dut1} | ${tmp}= | Next Interface
139 | | ${dut1_to_tg} | ${tmp}= | Next Interface
140 | | ${dut1_to_dut2} | ${tmp}= | Next Interface
141 | | ${dut2_to_dut1} | ${tmp}= | Next Interface
142 | | ${dut2_to_tg} | ${tmp}= | Next Interface
143 | | ${tg_to_dut2} | ${tmp}= | Next Interface
144 | | ${tg_to_dut1_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut1}
145 | | ${tg_to_dut2_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut2}
146 | | ${dut1_to_tg_mac}= | Get interface mac | ${dut1_node} | ${dut1_to_tg}
147 | | ${dut1_to_dut2_mac}= | Get interface mac | ${dut1_node} | ${dut1_to_dut2}
148 | | ${dut2_to_tg_mac}= | Get interface mac | ${dut2_node} | ${dut2_to_tg}
149 | | ${dut2_to_dut1_mac}= | Get interface mac | ${dut2_node} | ${dut2_to_dut1}
150 | | Set Test Variable | ${tg_to_dut1}
151 | | Set Test Variable | ${dut1_to_tg}
152 | | Set Test Variable | ${tg_to_dut2}
153 | | Set Test Variable | ${dut2_to_tg}
154 | | Set Test Variable | ${dut1_to_dut2}
155 | | Set Test Variable | ${dut2_to_dut1}
156 | | Set Test Variable | ${tg_to_dut1_mac}
157 | | Set Test Variable | ${tg_to_dut2_mac}
158 | | Set Test Variable | ${dut1_to_tg_mac}
159 | | Set Test Variable | ${dut1_to_dut2_mac}
160 | | Set Test Variable | ${dut2_to_tg_mac}
161 | | Set Test Variable | ${dut2_to_dut1_mac}
162 | | Set Test Variable | ${tg_node}
163 | | Set Test Variable | ${dut1_node}
164 | | Set Test Variable | ${dut2_node}
165
166 | Interfaces in 3-node path are up
167 | | [Documentation] | Set UP state on interfaces in 3-node path on nodes and
168 | | ...             | wait for all interfaces are ready.
169 | | ...
170 | | ... | *Arguments:*
171 | | ... | - No arguments.
172 | | ...
173 | | ... | *Return:*
174 | | ... | - No value returned.
175 | | ...
176 | | ... | _NOTE:_ This KW uses test variables sets in
177 | | ... |         "Path for 3-node testing is set" KW.
178 | | ...
179 | | ... | *Example:*
180 | | ...
181 | | ... | \| Given Path for 3-node testing is set \| ${nodes['TG']} \
182 | | ... | \| ${nodes['DUT1']} \| ${nodes['TG']} \|
183 | | ... | \| And Interfaces in 3-node path are up \|
184 | | ...
185 | | Set Interface State | ${tg_node} | ${tg_to_dut1} | up
186 | | Set Interface State | ${tg_node} | ${tg_to_dut2} | up
187 | | Set Interface State | ${dut1_node} | ${dut1_to_tg} | up
188 | | Set Interface State | ${dut1_node} | ${dut1_to_dut2} | up
189 | | Set Interface State | ${dut2_node} | ${dut2_to_tg} | up
190 | | Set Interface State | ${dut2_node} | ${dut2_to_dut1} | up
191 | | Vpp Node Interfaces Ready Wait | ${dut1_node}
192 | | Vpp Node Interfaces Ready Wait | ${dut2_node}