HC Test: improve functional suite setup and teardown
[csit.git] / resources / libraries / robot / honeycomb / vxlan_gpe.robot
1 # Copyright (c) 2016 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.InterfaceUtil
16 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
17
18 *** Variables ***
19 # Translation table used to convert values received from Honeycomb to values
20 # received from VAT.
21 | &{protocols}=
22 | ... | -=0
23 | ... | ipv4=1
24 | ... | ipv6=2
25 | ... | ethernet=3
26 | ... | nsh=4
27
28 *** Keywords ***
29 | Honeycomb creates VxLAN GPE interface
30 | | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel.
31 | | ...
32 | | ... | *Arguments:*
33 | | ... | - node - information about a DUT node. Type: dictionary
34 | | ... | - interface - name of an interface to be created. Type: string
35 | | ... | - base_settings - configuration data common for all interfaces.\
36 | | ... | Type: dictionary
37 | | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary
38 | | ...
39 | | ... | *Example:*
40 | | ... | \| Honeycomb creates VxLAN GPE interface \
41 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${base_params} \
42 | | ... | \| ${vxlan_gpe_params} \|
43 | | ...
44 | | [Arguments] | ${node} | ${interface}
45 | | ... | ${base_settings} | ${vxlan_gpe_settings}
46 | | ...
47 | | Create VxLAN GPE interface
48 | | ... | ${node} | ${interface} | &{base_settings} | &{vxlan_gpe_settings}
49
50 | Honeycomb removes VxLAN GPE interface
51 | | [Documentation] | Uses Honeycomb API to remove VxLAN GPE interface from\
52 | | ... | node.
53 | | ...
54 | | ... | *Arguments:*
55 | | ... | - node - information about a DUT node. Type: dictionary
56 | | ... | - interface - name of the interface to be removed. Type: string
57 | | ...
58 | | ... | *Example:*
59 | | ...
60 | | ... | \| Honeycomb removes VxLAN GPE interface \
61 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
62 | | ...
63 | | [Arguments] | ${node} | ${interface}
64 | | ...
65 | | Delete interface | ${node} | ${interface}
66
67 | VxLAN GPE Operational Data From Honeycomb Should Be
68 | | [Documentation] | Uses Honeycomb API to get operational data about the\
69 | | ... | given interface and compares them to the values provided as arguments.
70 | | ...
71 | | ... | *Arguments:*
72 | | ... | - node - information about a DUT node. Type: dictionary
73 | | ... | - interface - name of an interface to be checked. Type: string
74 | | ... | - base_settings - configuration data common for all interfaces.\
75 | | ... | Type: dictionary
76 | | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary
77 | | ...
78 | | ... | *Example:*
79 | | ... | \| VxLAN GPE Operational Data From Honeycomb Should Be \
80 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${base_params} \
81 | | ... | \| ${vxlan_gpe_params} \|
82 | | ...
83 | | [Arguments] | ${node} | ${interface}
84 | | ... | ${base_settings} | ${vxlan_gpe_settings}
85 | | ...
86 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
87 | | Should be equal as strings
88 | | ... | ${api_data['name']} | ${base_settings['name']}
89 | | Should be equal as strings
90 | | ... | ${api_data['type']} | v3po:vxlan-gpe-tunnel
91 | | Run keyword if | $base_settings['enabled'] == True
92 | | ... | Run keywords
93 | | ... | Should be equal as strings | ${api_data['admin-status']} | up
94 | | ... | AND
95 | | ... | Should be equal as strings | ${api_data['oper-status']} | up
96 | | ... | ELSE
97 | | ... | Run keywords
98 | | ... | Should be equal as strings | ${api_data['admin-status']} | down
99 | | ... | AND
100 | | ... | Should be equal as strings | ${api_data['oper-status']} | down
101
102 | VxLAN GPE Operational Data From VAT Should Be
103 | | [Documentation] | Uses VAT to get operational data about the given\
104 | | ... | interface and compares them to the values provided as arguments.
105 | | ...
106 | | ... | *Arguments:*
107 | | ... | - node - information about a DUT node. Type: dictionary
108 | | ... | - interface - name of an interface to be checked. Type: string
109 | | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary
110 | | ...
111 | | ... | *Example:*
112 | | ... | \| VxLAN GPE Operational Data From VAT Should Be \
113 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${vxlan_gpe_params} \|
114 | | ...
115 | | [Arguments] | ${node} | ${interface} | ${vxlan_gpe_params}
116 | | ...
117 | | ${vat_data}= | VxLAN GPE Dump | ${node} | ${interface}
118 | | Should be equal as strings
119 | | ... | ${vat_data['local']} | ${vxlan_gpe_params['local']}
120 | | Should be equal as strings
121 | | ... | ${vat_data['remote']} | ${vxlan_gpe_params['remote']}
122 | | Should be equal as strings
123 | | ... | ${vat_data['vni']} | ${vxlan_gpe_params['vni']}
124 | | Should be equal as strings
125 | | ... | ${vat_data['encap_vrf_id']} | ${vxlan_gpe_params['encap-vrf-id']}
126 | | Should be equal as strings
127 | | ... | ${vat_data['decap_vrf_id']} | ${vxlan_gpe_params['decap-vrf-id']}
128 # VAT dump multiplies protocol value by 16777216
129 | | Should be equal as strings | ${vat_data['protocol']/16777216}
130 | | ... | ${protocols['${vxlan_gpe_params['next-protocol']}']}
131
132 | VxLAN GPE Interface indices from Honeycomb and VAT should correspond
133 | | [Documentation] | Uses VAT and Honeycomb to get operational data about the \
134 | | ... | given VxLAN GPE interface and compares the interface indexes. The \
135 | | ... | VxLAN GPE interface index from Honeycomb should be greater than \
136 | | ... | index from VAT by one.
137 | | ...
138 | | ... | *Arguments:*
139 | | ... | - node - information about a DUT node. Type: dictionary
140 | | ... | - interface - name of the interface to be checked. Type: string
141 | | ...
142 | | ... | *Example:*
143 | | ...
144 | | ... | \| VxLAN GPE Interface indices from Honeycomb and VAT should \
145 | | ... | correspond \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
146 | | ...
147 | | [Arguments] | ${node} | ${interface}
148 | | ...
149 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
150 | | ${vat_data}= | VxLAN GPE Dump | ${node} | ${interface}
151 | | ${sw_if_index}= | EVALUATE | ${vat_data['sw_if_index']} + 1
152 | | Should be equal as strings
153 | | ... | ${api_data['if-index']} | ${sw_if_index}
154
155 | VxLAN GPE Operational Data From Honeycomb Should Be empty
156 | | [Documentation] | Uses Honeycomb API to get operational data about\
157 | | ... | the given interface and expects to fail.
158 | | ...
159 | | ... | *Arguments:*
160 | | ... | - node - information about a DUT node. Type: dictionary
161 | | ...
162 | | ... | *Example:*
163 | | ... | \| VxLAN GPE Operational Data From Honeycomb Should Be empty\
164 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
165 | | ...
166 | | [Arguments] | ${node} | ${interface}
167 | | ...
168 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
169 | | Should be empty | ${api_data}
170
171 | VxLAN GPE Operational Data From VAT Should Be empty
172 | | [Documentation] | Uses VAT to get operational data about the given\
173 | | ... | interface and expects an empty dictionary.
174 | | ...
175 | | ... | *Arguments:*
176 | | ... | - node - information about a DUT node. Type: dictionary
177 | | ...
178 | | ... | *Example:*
179 | | ... | \| VxLAN GPE Operational Data From VAT Should Be empty\
180 | | ... | \| ${nodes['DUT1']} \|
181 | | ...
182 | | [Arguments] | ${node}
183 | | ...
184 | | Run Keyword And Expect Error | ValueError: No JSON object could be decoded
185 | | ... | VxLAN Dump | ${node}
186
187 | Honeycomb fails to create VxLAN GPE interface
188 | | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel with wrong\
189 | | ... | configuration data.
190 | | ...
191 | | ... | *Arguments:*
192 | | ... | - node - information about a DUT node. Type: dictionary
193 | | ... | - interface - name of an interface to be created. Type: string
194 | | ... | - base_settings - Configuration data common for all interfaces.\
195 | | ... | Type: dictionary
196 | | ... | - vxlan_gpe_settings - VxLAN GPE specific parameters. Type: dictionary
197 | | ...
198 | | ... | *Example:*
199 | | ... | \| Honeycomb fails to create VxLAN GPE interface \
200 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${wrong_base_params} \
201 | | ... | \| ${vxlan_gpe_params} \|
202 | | ...
203 | | [Arguments] | ${node} | ${interface}
204 | | ... | ${base_settings} | ${vxlan_gpe_settings}
205 | | ...
206 | | Run keyword and expect error | *HoneycombError*not successful. * code: *00.
207 | | ... | Create VxLAN GPE interface
208 | | ... | ${node} | ${interface} | &{base_settings} | &{vxlan_gpe_settings}