CSIT-687: Directory structure reorganization
[csit.git] / resources / libraries / robot / tldk / tldk_utils.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.NodePath
16 | Documentation | *Utilities for the path computing, pcap reading*
17 | ...
18 | ... | Utilities for the path computing, pcap file reading and also the port
19 | ... | selection.
20
21 *** Keywords ***
22 | Path for 2-node testing is set
23 | | [Documentation] | Compute the path for the 2 node testing. 
24 | | ...
25 | | ... | *Arguments:*
26 | | ... | - tg_node - TG node. Type: dictionary
27 | | ... | - dut_node - DUT node. Type: dictionary
28 | | ...
29 | | ... | *Return:*
30 | | ... | - No value returned.
31 | | ...
32 | | ... | *Example:*
33 | | ...
34 | | ... | \| Path for 2-node testing is set \| ${nodes['TG']} \
35 | | ... | \| ${nodes['DUT1'] \|
36 | | ...
37 | | [Arguments] | ${tg_node} | ${dut_node}
38 | | Append Nodes | ${tg_node} | ${dut_node}
39 | | Compute Path
40
41 | Pick out the port used to execute test
42 | | [Documentation] | Pick out the port used to execute the test.
43 | | ... 
44 | | ... | *Arguments:*
45 | | ... | - No arguments.
46 | | ... 
47 | | ... | *Return:*
48 | | ... | - No value returned.
49 | | ... 
50 | | ... | *Example:*
51 | | ... 
52 | | ... | \| Pick out the port used to execute test \|
53 | | ... 
54 | | ${tg_port} | ${tg_node}= | First Interface
55 | | ${dut_port} | ${dut_node}= | Last Interface
56 | | set suite variable | ${tg_node}
57 | | set suite variable | ${dut_node}
58 | | set suite variable | ${tg_port}
59 | | set suite variable | ${dut_port}
60
61 | Get the pcap data
62 | | [Documentation] | Get the pcap file detailed data.
63 | | ...
64 | | ... | *Arguments:*
65 | | ... | - file_prefix - file prefix. Type: dictionary
66 | | ...
67 | | ... | *Return:*
68 | | ... | - packet_num, dest_ip, is_ipv4 - a tuple of packet_num
69 | | ... |   dest_ip, is_ipv4. Type: tuple(int, str, bool)
70 | | ...
71 | | ... | *Example:*
72 | | ...
73 | | ... | \| Get the pcap data \| ${tc01_file_prefix} \|
74 | | ...
75 | | [Arguments] | ${file_prefix}
76 | | ${packet_num} | ${dest_ip} | ${is_ipv4}= | Get Pcap Info
77 | | ... | ${file_prefix}
78 | | set suite variable | ${packet_num}
79 | | set suite variable | ${dest_ip}
80 | | set suite variable | ${is_ipv4}