4b5248ad94c8a4c86fbfe85150f753dc00f706c3
[csit.git] / resources / libraries / robot / nsim / nsim.robot
1 # Copyright (c) 2020 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.NsimUtil
16 |
17 | Documentation | L2 keywords to set up VPP Network Simulator to test hoststack.
18
19 *** Variables ***
20 | &{vpp_nsim_attr}=
21 | ... | delay_in_usec=${1}
22 | ... | average_packet_size=${1500}
23 | ... | bw_in_bits_per_second=${40000000000}
24 | ... | packets_per_drop=${0}
25 | ... | output_nsim_enable=${False}
26 | ... | xc_nsim_enable=${False}
27
28 *** Keywords ***
29 | Set VPP NSIM Attributes
30 | | [Documentation]
31 | | ... | Set the VPP NSIM attributes in the
32 | | ... | vpp_nsim_attr dictionary.
33 | |
34 | | ... | *Arguments:*
35 | | ... | - ${delay_in_usec} - Delay in Microseconds Type: Int
36 | | ... | - ${average_packet_size} - Average packet size Type: Int
37 | | ... | - ${bw_in_bits_per_second} - Bandwidth of output interface
38 | | ... | Type: Int
39 | | ... | - ${pkts_per_drop} - Number of packets to drop Type: Int
40 | | ... | - ${output_nsim_enable} - Enable/Disable NSIM Output Feature
41 | | ... | Type: Int
42 | | ... | - ${xc_nsim_enable} - Enable/Disable NSIM Cross Connect
43 | | ... |                                     Feature Type: Int
44 | |
45 | | ... | *Example:*
46 | |
47 | | ... | \| Set VPP NSIM Attributes \| output_nsim_enable=${True} \|
48 | | ... | \| packets_per_drop=${pkts_per_drop} \|
49 | |
50 | | [Arguments]
51 | | ... | ${delay_in_usec}=${vpp_nsim_attr.delay_in_usec}
52 | | ... | ${average_packet_size}=${vpp_nsim_attr.average_packet_size}
53 | | ... | ${bw_in_bits_per_second}=${vpp_nsim_attr.bw_in_bits_per_second}
54 | | ... | ${packets_per_drop}=${vpp_nsim_attr.packets_per_drop}
55 | | ... | ${output_nsim_enable}=${vpp_nsim_attr.output_nsim_enable}
56 | | ... | ${xc_nsim_enable}=${vpp_nsim_attr.xc_nsim_enable}
57 | |
58 | | Set To Dictionary | ${vpp_nsim_attr} | delay_in_usec | ${delay_in_usec}
59 | | Set To Dictionary | ${vpp_nsim_attr} | average_packet_size
60 | | ... | ${average_packet_size}
61 | | Set To Dictionary | ${vpp_nsim_attr} | bw_in_bits_per_second
62 | | ... | ${bw_in_bits_per_second}
63 | | Set To Dictionary | ${vpp_nsim_attr} | packets_per_drop
64 | | ... | ${packets_per_drop}
65 | | Set To Dictionary | ${vpp_nsim_attr} | output_nsim_enable
66 | | ... | ${output_nsim_enable}
67 | | Set To Dictionary | ${vpp_nsim_attr} | xc_nsim_enable | ${xc_nsim_enable}
68