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