fix Honeycomb failing tests
[csit.git] / resources / libraries / robot / honeycomb / vxlan.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 *** Keywords ***
19 | Honeycomb sets interface VxLAN configuration
20 | | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel.
21 | | ...
22 | | ... | *Arguments:*
23 | | ... | - node - information about a DUT node. Type: dictionary
24 | | ... | - interface - name of an interface on the specified node. Type: string
25 | | ... | - settings - Configuration data for VxLAN. Type: dictionary
26 | | ...
27 | | ... | *Example:*
28 | | ... | \| Honeycomb sets interface VxLAN configuration \
29 | | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'192.168.0.2',\
30 | | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \|
31 | | ...
32 | | [Arguments] | ${node} | ${interface} | ${settings}
33 | | Honeycomb Create VxLAN interface | ${node} | ${interface}
34 | | ... | &{settings}
35
36 | Honeycomb removes VxLAN tunnel settings
37 | | [Documentation] | Uses Honeycomb API to disable a VxLAN tunnel and remove\
38 | | ... | it from configuration data.
39 | | ...
40 | | ... | *Arguments:*
41 | | ... | - node - information about a DUT node. Type: dictionary
42 | | ... | - interface - name of an interface on the specified node. Type: string
43 | | ...
44 | | ... | *Example:*
45 | | ...
46 | | ... | \| Honeycomb removes VxLAN tunnel \| ${nodes['DUT1']} \| vxlan_01 \|
47 | | [Arguments] | ${node} | ${interface}
48 | | Delete interface | ${node} | ${interface}
49
50 | VxLAN Operational Data From Honeycomb Should Be
51 | | [Documentation] | Retrieves interface VxLAN configuration through Honeycomb\
52 | | ... | and compares with settings supplied in argument.
53 | | ...
54 | | ... | *Arguments:*
55 | | ... | - node - information about a DUT node. Type: dictionary
56 | | ... | - interface - name of an interface on the specified node. Type: string
57 | | ... | - settings - Configuration data for VxLAN. Type: dictionary
58 | | ...
59 | | ... | *Example:*
60 | | ...
61 | | ... | \| VxLAN Operational Data From Honeycomb Should Be \
62 | | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'192.168.0.2',\
63 | | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \|
64 | | ...
65 | | [Arguments] | ${node} | ${interface} | ${settings}
66 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
67 | | ${api_vxlan}= | Set Variable | ${api_data['v3po:vxlan']}
68 | | :FOR | ${key} | IN | @{settings.keys()}
69 | | | Should be equal | ${api_vxlan['${key}']} | ${settings['${key}']}
70
71 | VxLAN Operational Data From VAT Should Be
72 | | [Documentation] | Retrieves interface VxLAN configuration through VAT and\
73 | | ... | compares with settings supplied in argument.
74 | | ...
75 | | ... | *Arguments:*
76 | | ... | - node - information about a DUT node. Type: dictionary
77 | | ... | - settings - Configuration data for VxLAN. Type: dictionary
78 | | ...
79 | | ... | *Example:*
80 | | ...
81 | | ... | \| VxLAN Operational Data From Honeycomb Should Be \
82 | | ... | \|${nodes['DUT1']} \| ${{'src':'192.168.0.2',\
83 | | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \|
84 | | ...
85 | | ... | *Note:*
86 | | ... | Due to the difficulty of identifying newly created interfaces by name\
87 | | ... | or by sw_index, this keyword assumes there is only one VxLAN tunnel\
88 | | ... | present on the specified node.
89 | | [Arguments] | ${node} | ${settings}
90 | | ${vat_data}= | VxLAN Dump | ${node}
91 | | ${vat_data}= | Set Variable | ${vat_data[0]}
92 | | Should be equal | ${vat_data['dst_address']} | ${settings['dst']}
93 | | Should be equal | ${vat_data['src_address']} | ${settings['src']}
94 | | Should be equal | ${vat_data['vni']} | ${settings['vni']}
95 | | Should be equal
96 | | ... | ${vat_data['encap_vrf_id']} | ${settings['encap-vrf-id']}
97
98 | VxLAN Operational Data From Honeycomb Should Be empty
99 | | [Documentation] | Attempts to retrieve interface VxLAN configuration\
100 | | ... | through Honeycomb and expects to recieve an empty dictionary.
101 | | ...
102 | | ... | *Arguments:*
103 | | ... | - node - information about a DUT node. Type: dictionary
104 | | ... | - interface - name of an interface on the specified node. Type: string
105 | | ...
106 | | ... | *Example:*
107 | | ...
108 | | ... | \| VxLAN Operational Data From Honeycomb Should Be empty\
109 | | ... | \|${nodes['DUT1']} \| vxlan_01 \|
110 | | ...
111 | | [Arguments] | ${node} | ${interface}
112 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
113 | | Run keyword and expect error | *KeyError: 'v3po:vxlan' | Set Variable
114 | | ... | ${api_data['v3po:vxlan']}
115
116 | VxLAN Operational Data From VAT Should Be empty
117 | | [Documentation] | Attempts to retrieve interface VxLAN configuration\
118 | | ... | through VAT and expects a "no data" error.
119 | | ...
120 | | ... | *Arguments:*
121 | | ... | - node - information about a DUT node. Type: dictionary
122 | | ... | - interface - name of an interface on the specified node. Type: string
123 | | ...
124 | | ... | *Example:*
125 | | ...
126 | | ... | \| VxLAN Operational Data From VAT Should Be empty\
127 | | ... | \| ${nodes['DUT1']} \|
128 | | ...
129 | | [Arguments] | ${node}
130 | | ${data}= | VxLAN Dump | ${node}
131 | | Should be empty | ${data}
132
133 | Honeycomb fails setting VxLan on different interface type
134 | | [Documentation] | Attempts to set VxLAN settings on an ethernet\
135 | | ... | type interface and expects to fail.
136 | | ...
137 | | ... | *Arguments:*
138 | | ... | - node - information about a DUT node. Type: dictionary
139 | | ... | - interface - name of an interface on the specified node. Type: string
140 | | ... | - settings - Configuration data for VxLAN. Type: dictionary
141 | | ...
142 | | ... | *Example:*
143 | | ...
144 | | ... | \| Honeycomb fails setting VxLan on different interface type\
145 | | ... | \|${nodes['DUT1']} \| GigabitEthernet0/9/0 \| ${{'src':'192.168.0.2',\
146 | | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \|
147 | | ...
148 | | [Arguments] | ${node} | ${interface} | ${settings}
149 | | Run Keyword And Expect Error | HoneycombError: * Status code: 500.
150 | | ... | Honeycomb Configure interface vxlan
151 | | ... | ${node} | ${interface} | &{settings}
152
153 | Honeycomb fails setting invalid VxLAN configuration
154 | | [Documentation] | Attempts to create a VxLAN interface with invalid\
155 | | ... | configuration and expects to fail.
156 | | ...
157 | | ... | *Arguments:*
158 | | ... | - node - information about a DUT node. Type: dictionary
159 | | ... | - interface - name of an interface on the specified node. Type: string
160 | | ... | - settings_list - Bad configuration data for VxLAN. Type: list
161 | | ...
162 | | ... | *Example:*
163 | | ...
164 | | ... | \| Honeycomb fails setting invalid VxLAN configuration\
165 | | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'abcd', 'vni':-3}} \|
166 | | ...
167 | | [Arguments] | ${node} | ${interface} | ${settings_list}
168 | | :FOR | ${settings} | IN | @{settings_list}
169 | | | Run Keyword And Expect Error | HoneycombError: * Status code: 500.
170 | | | ... | Honeycomb Create VxLAN interface
171 | | | ... | ${node} | ${interface} | &{settings}