111b932a4b489cd867a14da4e61b990c5c537fb7
[csit.git] / resources / libraries / robot / features / policer.robot
1 # Copyright (c) 2019 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.Policer
16 | ...
17 | Documentation | Policer keywords
18
19 *** Keywords ***
20 | Initialize IPv4 policer 2r3c-${t} in circular topology
21 | | [Documentation]
22 | | ... | Setup of 2r3c color-aware or color-blind policer with dst IPv4 match
23 | | ... | on all DUT nodes in 2-node / 3-node circular topology. Policer is
24 | | ... | applied on links TG - DUTx.
25 | | ...
26 | | ${dscp}= | DSCP AF22
27 | | Policer Set Name | policer1
28 | | Policer Set CIR | ${cir}
29 | | Policer Set EIR | ${eir}
30 | | Policer Set CB | ${cb}
31 | | Policer Set EB | ${eb}
32 | | Policer Set Rate Type pps
33 | | Policer Set Round Type Closest
34 | | Policer Set Type 2R3C 2698
35 | | Policer Set Conform Action Transmit
36 | | Policer Set Exceed Action Mark and Transmit | ${dscp}
37 | | Policer Set Violate Action Transmit
38 | | Policer Enable Color Aware
39 | | Run Keyword If | ${t} == 'ca' | Policer Enable Color Aware
40 | | Policer Classify Set Precolor Exceed
41 | | Policer Set Node | ${dut1}
42 | | Policer Classify Set Interface | ${dut1_if1}
43 | | Policer Classify Set Match IP | 20.20.20.2 | ${False}
44 | | Policer Set Configuration
45 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
46 | | ... | Variable Should Exist | ${dut2}
47 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
48 | | ... | Set Variable | ${dut2}
49 | | ... | ELSE | Set Variable | ${dut1}
50 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
51 | | ... | Set Variable | ${dut2_if2}
52 | | ... | ELSE | Set Variable | ${dut1_if2}
53 | | Run Keyword Unless | '${dut2_status}' == 'PASS'
54 | | ... | Policer Set Name | policer2
55 | | Policer Set Node | ${dut}
56 | | Policer Classify Set Interface | ${dut_if2}
57 | | Policer Classify Set Match IP | 10.10.10.2 | ${False}
58 | | Policer Set Configuration
59
60 | Initialize IPv6 policer 2r3c-${t} in circular topology
61 | | [Documentation]
62 | | ... | Setup of 2r3c color-aware or color-blind policer with dst IPv6 match
63 | | ... | on all DUT nodes in 2-node / 3-node circular topology. Policer is
64 | | ... | applied on links TG - DUTx.
65 | | ...
66 | | ${dscp}= | DSCP AF22
67 | | Policer Set Name | policer1
68 | | Policer Set CIR | ${cir}
69 | | Policer Set EIR | ${eir}
70 | | Policer Set CB | ${cb}
71 | | Policer Set EB | ${eb}
72 | | Policer Set Rate Type pps
73 | | Policer Set Round Type Closest
74 | | Policer Set Type 2R3C 2698
75 | | Policer Set Conform Action Transmit
76 | | Policer Set Exceed Action Mark and Transmit | ${dscp}
77 | | Policer Set Violate Action Transmit
78 | | Policer Enable Color Aware
79 | | Run Keyword If | ${t} == 'ca' | Policer Enable Color Aware
80 | | Policer Classify Set Precolor Exceed
81 | | Policer Set Node | ${dut1}
82 | | Policer Classify Set Interface | ${dut1_if1}
83 | | Policer Classify Set Match IP | 2001:2::2 | ${False}
84 | | Policer Set Configuration
85 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
86 | | ... | Variable Should Exist | ${dut2}
87 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
88 | | ... | Set Variable | ${dut2}
89 | | ... | ELSE | Set Variable | ${dut1}
90 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
91 | | ... | Set Variable | ${dut2_if2}
92 | | ... | ELSE | Set Variable | ${dut1_if2}
93 | | Run Keyword Unless | '${dut2_status}' == 'PASS'
94 | | ... | Policer Set Name | policer2
95 | | Policer Set Node | ${dut}
96 | | Policer Classify Set Interface | ${dut_if2}
97 | | Policer Classify Set Match IP | 2001:1::2 | ${False}
98 | | Policer Set Configuration