aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/honeycomb/policer.robot
blob: 17191c5b378e415dbac66e9c7166f2efec873ad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Copyright (c) 2017 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Resource | resources/libraries/robot/traffic.robot
| Library | resources.libraries.python.honeycomb.Routing.RoutingKeywords
| Variables | resources/test_data/honeycomb/policer_variables.py
| Documentation | Keywords used to test Policer using Honeycomb.

*** Keywords ***
| Honeycomb Configures Policer
| | [Documentation] | Uses Honeycomb API to configure Policer on the specified\
| | ... | interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - policer_data - data needed to configure Policer. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb Configures Policer \| ${node} \
| | ... | \| ${policer_data} \|
| | ...
| | [Arguments] | ${node} | ${policer_data}
| | Configure Policer
| | ... | ${node} | ${policer_data['name']} | ${policer_data}

| Policer Operational Data From Honeycomb Should Be
| | [Documentation] | Retrieves Policer operational data and verifies if\
| | ... | Policer is configured correctly.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - policer_data - data to compare configuration Policer with.\
| | ... | Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Policer Operational Data From Honeycomb Should Be \
| | ... | \| ${node} \| ${policer_data} \|
| | ...
| | [Arguments] | ${node} | ${policer_data}
| | ${data}= | Get Policer oper data | ${node} | ${policer_data['name']}
| | Compare data structures | ${data[0]} | ${policer_data}

| Policer Operational Data From Honeycomb Should Be empty
| | [Documentation] | Checks whether Policer configuration from Honeycomb \
| | ... | is empty.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Policer Operational Data From Honeycomb Should Be empty \
| | ... | \| ${node} \|
| | ...
| | [Arguments] | ${node}
| | Run keyword and expect error | HoneycombError*404*
| | ... | Get Policer oper data | ${node} | ${policer_data['name']}

| Honeycomb removes Policer configuration
| | [Documentation] | Uses Honeycomb API to remove Policer configuration\
| | ... | from the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb removes Policer configuration \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node}
| | Configure Policer | ${node} | ${policer_data['name']}

| Tear down policer test
| | [Documentation] | Uses Honeycomb API to remove Policer configuration\
| | ... | and reset interface state.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb removes Policer configuration \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node}
| | Honeycomb removes Policer configuration | ${node}

| Honeycomb enables Policer on interface
| | [Documentation] | Uses Honeycomb API to enable Policer on an interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - table_name - name of an ACL table. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb enables ACL on interface \| ${nodes['DUT1']} \
| | ... | \| GigabithEthernet0/8/0 \| table0 \|
| | ...
| | [Arguments] | ${node} | ${interface} | ${table_name}
| | Enable Policer on interface
| | ... | ${node} | ${interface} | ${table_name}

| Honeycomb disables Policer on interface
| | [Documentation] | Uses Honeycomb API to disable Policer on an interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb disables Policer on interface \| ${nodes['DUT1']} \
| | ... | \| GigabithEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${interface}
| | Disable Policer on interface
| | ... | ${node} | ${interface}

| Honeycomb Send packet and verify marking
| | [Documentation] | Send packet and verify DSCP of the received packet.
| | ...
| | ... | *Arguments:*
| | ... | - node - TG node. Type: dictionary
| | ... | - tx_if - TG transmit interface. Type: string
| | ... | - rx_if - TG receive interface. Type: string
| | ... | - src_mac - Packet source MAC. Type: string
| | ... | - dst_mac - Packet destination MAC. Type: string
| | ... | - src_ip - Packet source IP address. Type: string
| | ... | - dst_ip - Packet destination IP address. Type: string
| | ... | - dscp_num - DSCP value to verify. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| ${dscp}= \| DSCP AF22 \|
| | ... | \| Send packet and verify marking \| ${nodes['TG']} \| eth1 \| eth2 \
| | ... | \| 08:00:27:87:4d:f7 \| 52:54:00:d4:d8:22 \| 192.168.122.2 \
| | ... | \| 192.168.122.1 \| ${dscp} \|
| | ...
| | [Arguments] | ${node} | ${tx_if} | ${rx_if} | ${src_mac} | ${dst_mac}
| | ...         | ${src_ip} | ${dst_ip} | ${dscp_num}
| | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_if}
| | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_if}
| | ${args}= | Traffic Script Gen Arg | ${rx_if_name} | ${tx_if_name}
| | ...      | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
| | ${args}= | Set Variable | ${args} --dscp ${dscp_num}
| | Run Traffic Script On Node | policer.py | ${node} | ${args}