CSIT-662: KWI - KW renaming
[csit.git] / resources / libraries / robot / honeycomb / policer.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 | Resource | resources/libraries/robot/traffic.robot
16 | Library | resources.libraries.python.honeycomb.Routing.RoutingKeywords
17 | ...     | WITH NAME | RoutingKeywordsAPI
18 | Variables | resources/test_data/honeycomb/policer_variables.py
19 | Documentation | Keywords used to test Policer using Honeycomb.
20
21 *** Keywords ***
22 | Honeycomb Configures Policer
23 | | [Documentation] | Uses Honeycomb API to configure Policer on the specified\
24 | | ... | interface.
25 | | ...
26 | | ... | *Arguments:*
27 | | ... | - node - information about a DUT node. Type: dictionary
28 | | ... | - policer_data - data needed to configure Policer. Type: dictionary
29 | | ...
30 | | ... | *Example:*
31 | | ...
32 | | ... | \| Honeycomb Configures Policer \| ${node} \
33 | | ... | \| ${policer_data} \|
34 | | ...
35 | | [Arguments] | ${node} | ${policer_data}
36 | | Configure Policer
37 | | ... | ${node} | ${policer_data['name']} | ${policer_data}
38
39 | Policer Operational Data From Honeycomb Should Be
40 | | [Documentation] | Retrieves Policer operational data and verifies if\
41 | | ... | Policer is configured correctly.
42 | | ...
43 | | ... | *Arguments:*
44 | | ... | - node - information about a DUT node. Type: dictionary
45 | | ... | - policer_data - data to compare configuration Policer with.\
46 | | ... | Type: dictionary
47 | | ...
48 | | ... | *Example:*
49 | | ...
50 | | ... | \| Policer Operational Data From Honeycomb Should Be \
51 | | ... | \| ${node} \| ${policer_data} \|
52 | | ...
53 | | [Arguments] | ${node} | ${policer_data}
54 | | ${data}= | Get Policer oper data | ${node} | ${policer_data['name']}
55 | | Compare data structures | ${data[0]} | ${policer_data}
56
57 | Policer Operational Data From Honeycomb Should Be empty
58 | | [Documentation] | Checks whether Policer configuration from Honeycomb \
59 | | ... | is empty.
60 | | ...
61 | | ... | *Arguments:*
62 | | ... | - node - Information about a DUT node. Type: dictionary
63 | | ...
64 | | ... | *Example:*
65 | | ...
66 | | ... | \| Policer Operational Data From Honeycomb Should Be empty \
67 | | ... | \| ${node} \|
68 | | ...
69 | | [Arguments] | ${node}
70 | | Run keyword and expect error | HoneycombError*404*
71 | | ... | Get Policer oper data | ${node} | ${policer_data['name']}
72
73 | Honeycomb removes Policer configuration
74 | | [Documentation] | Uses Honeycomb API to remove Policer configuration\
75 | | ... | from the specified interface.
76 | | ...
77 | | ... | *Arguments:*
78 | | ... | - node - information about a DUT node. Type: dictionary
79 | | ...
80 | | ... | *Example:*
81 | | ...
82 | | ... | \| Honeycomb removes Policer configuration \
83 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
84 | | ...
85 | | [Arguments] | ${node}
86 | | Configure Policer | ${node} | ${policer_data['name']}
87
88 | Tear down policer test
89 | | [Documentation] | Uses Honeycomb API to remove Policer configuration\
90 | | ... | and reset interface state.
91 | | ...
92 | | ... | *Arguments:*
93 | | ... | - node - information about a DUT node. Type: dictionary
94 | | ...
95 | | ... | *Example:*
96 | | ...
97 | | ... | \| Honeycomb removes Policer configuration \
98 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
99 | | ...
100 | | [Arguments] | ${node}
101 | | Honeycomb removes Policer configuration | ${node}
102
103 | Honeycomb enables Policer on interface
104 | | [Documentation] | Uses Honeycomb API to enable Policer on an interface.
105 | | ...
106 | | ... | *Arguments:*
107 | | ... | - node - information about a DUT node. Type: dictionary
108 | | ... | - interface - name of an interface on the specified node. Type: string
109 | | ... | - table_name - name of an ACL table. Type: string
110 | | ...
111 | | ... | *Example:*
112 | | ...
113 | | ... | \| Honeycomb enables ACL on interface \| ${nodes['DUT1']} \
114 | | ... | \| GigabithEthernet0/8/0 \| table0 \|
115 | | ...
116 | | [Arguments] | ${node} | ${interface} | ${table_name}
117 | | Enable Policer on interface
118 | | ... | ${node} | ${interface} | ${table_name}
119
120 | Honeycomb disables Policer on interface
121 | | [Documentation] | Uses Honeycomb API to disable Policer on an interface.
122 | | ...
123 | | ... | *Arguments:*
124 | | ... | - node - information about a DUT node. Type: dictionary
125 | | ... | - interface - name of an interface on the specified node. Type: string
126 | | ...
127 | | ... | *Example:*
128 | | ...
129 | | ... | \| Honeycomb disables Policer on interface \| ${nodes['DUT1']} \
130 | | ... | \| GigabithEthernet0/8/0 \|
131 | | ...
132 | | [Arguments] | ${node} | ${interface}
133 | | Disable Policer on interface
134 | | ... | ${node} | ${interface}
135
136 | Honeycomb Send packet and verify marking
137 | | [Documentation] | Send packet and verify DSCP of the received packet.
138 | | ...
139 | | ... | *Arguments:*
140 | | ... | - node - TG node. Type: dictionary
141 | | ... | - tx_if - TG transmit interface. Type: string
142 | | ... | - rx_if - TG receive interface. Type: string
143 | | ... | - src_mac - Packet source MAC. Type: string
144 | | ... | - dst_mac - Packet destination MAC. Type: string
145 | | ... | - src_ip - Packet source IP address. Type: string
146 | | ... | - dst_ip - Packet destination IP address. Type: string
147 | | ... | - dscp_num - DSCP value to verify. Type: integer
148 | | ...
149 | | ... | *Example:*
150 | | ...
151 | | ... | \| ${dscp}= \| DSCP AF22 \|
152 | | ... | \| Send packet and verify marking \| ${nodes['TG']} \| eth1 \| eth2 \
153 | | ... | \| 08:00:27:87:4d:f7 \| 52:54:00:d4:d8:22 \| 192.168.122.2 \
154 | | ... | \| 192.168.122.1 \| ${dscp} \|
155 | | ...
156 | | [Arguments] | ${node} | ${tx_if} | ${rx_if} | ${src_mac} | ${dst_mac}
157 | | ...         | ${src_ip} | ${dst_ip} | ${dscp_num}
158 | | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_if}
159 | | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_if}
160 | | ${args}= | Traffic Script Gen Arg | ${rx_if_name} | ${tx_if_name}
161 | | ...      | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
162 | | ${args}= | Set Variable | ${args} --dscp ${dscp_num}
163 | | Run Traffic Script On Node | policer.py | ${node} | ${args}