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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 | Library | resources.libraries.python.InterfaceUtil
16 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
19 # Translation table used to convert values received from Honeycomb to values
29 | Honeycomb creates VxLAN GPE interface
30 | | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel.
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
40 | | ... | \| Honeycomb creates VxLAN GPE interface \
41 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${base_params} \
42 | | ... | \| ${vxlan_gpe_params} \|
44 | | [Arguments] | ${node} | ${interface}
45 | | ... | ${base_settings} | ${vxlan_gpe_settings}
47 | | Create VxLAN GPE interface
48 | | ... | ${node} | ${interface} | &{base_settings} | &{vxlan_gpe_settings}
50 | Honeycomb removes VxLAN GPE interface
51 | | [Documentation] | Uses Honeycomb API to remove VxLAN GPE interface from\
54 | | ... | *Arguments:*
55 | | ... | - node - information about a DUT node. Type: dictionary
56 | | ... | - interface - name of the interface to be removed. Type: string
60 | | ... | \| Honeycomb removes VxLAN GPE interface \
61 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
63 | | [Arguments] | ${node} | ${interface}
65 | | Delete interface | ${node} | ${interface}
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.
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
79 | | ... | \| VxLAN GPE Operational Data From Honeycomb Should Be \
80 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${base_params} \
81 | | ... | \| ${vxlan_gpe_params} \|
83 | | [Arguments] | ${node} | ${interface}
84 | | ... | ${base_settings} | ${vxlan_gpe_settings}
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
95 | | ... | Should be equal as strings | ${api_data['oper-status']} | up
97 | | ... | Run keywords
98 | | ... | Should be equal as strings | ${api_data['admin-status']} | down
100 | | ... | Should be equal as strings | ${api_data['oper-status']} | down
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.
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
112 | | ... | \| VxLAN GPE Operational Data From VAT Should Be \
113 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${vxlan_gpe_params} \|
115 | | [Arguments] | ${node} | ${interface} | ${vxlan_gpe_params}
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']}']}
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.
138 | | ... | *Arguments:*
139 | | ... | - node - information about a DUT node. Type: dictionary
140 | | ... | - interface - name of the interface to be checked. Type: string
144 | | ... | \| VxLAN GPE Interface indices from Honeycomb and VAT should \
145 | | ... | correspond \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
147 | | [Arguments] | ${node} | ${interface}
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}
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.
159 | | ... | *Arguments:*
160 | | ... | - node - information about a DUT node. Type: dictionary
163 | | ... | \| VxLAN GPE Operational Data From Honeycomb Should Be empty\
164 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \|
166 | | [Arguments] | ${node} | ${interface}
168 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
169 | | Should be empty | ${api_data}
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.
175 | | ... | *Arguments:*
176 | | ... | - node - information about a DUT node. Type: dictionary
179 | | ... | \| VxLAN GPE Operational Data From VAT Should Be empty\
180 | | ... | \| ${nodes['DUT1']} \|
182 | | [Arguments] | ${node}
184 | | Run Keyword And Expect Error | ValueError: No JSON object could be decoded
185 | | ... | VxLAN Dump | ${node}
187 | Honeycomb fails to create VxLAN GPE interface
188 | | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel with wrong\
189 | | ... | configuration data.
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
199 | | ... | \| Honeycomb fails to create VxLAN GPE interface \
200 | | ... | \| ${nodes['DUT1']} \| vxlan_gpe_tunnel0 \| ${wrong_base_params} \
201 | | ... | \| ${vxlan_gpe_params} \|
203 | | [Arguments] | ${node} | ${interface}
204 | | ... | ${base_settings} | ${vxlan_gpe_settings}
206 | | Run keyword and expect error | *HoneycombError*not successful. * code: *00.
207 | | ... | Create VxLAN GPE interface
208 | | ... | ${node} | ${interface} | &{base_settings} | &{vxlan_gpe_settings}