fix Honeycomb failing tests
[csit.git] / resources / libraries / robot / honeycomb / vhost_user.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 | Documentation | Keywords used to manipulate vhost-user unterfaces.
18
19 *** Keywords ***
20 | Honeycomb creates vhost-user interface
21 | | [Documentation] | Create a vhost-user interface using Honeycomb API.
22 | | ...
23 | | ... | *Arguments:*
24 | | ... | - node - information about a DUT node. Type: dictionary
25 | | ... | - interface - name of an interface on the specified node. Type: string
26 | | ... | - settings - Configuration data for vhost-user interface.\
27 | | ... | Type: dictionary
28 | | ...
29 | | ... | *Example:*
30 | | ... | \| Honeycomb creates vhost-user interface\
31 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \|
32 | | ...
33 | | [Arguments] | ${node} | ${interface} | ${settings}
34 | | Create vhost user interface | ${node} | ${interface}
35 | | ... | &{settings}
36
37 | Honeycomb removes vhost-user interface
38 | | [Documentation] | Remove a vhost-user interface using Honeycomb API.
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 | | ... | \| Honeycomb removes vhost-user interface\
46 | | ... | \| ${nodes['DUT1']} \| vhost_test \|
47 | | ...
48 | | [Arguments] | ${node} | ${interface}
49 | | Delete interface | ${node} | ${interface}
50
51 | Honeycomb configures vhost-user interface
52 | | [Documentation] | Configure a vhost-user interface using Honeycomb API.
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 vhost-user interface.\
58 | | ... | Type: dictionary
59 | | ...
60 | | ... | *Example:*
61 | | ... | \| Honeycomb configures vhost-user interface\
62 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${new_vhost_user_settings} \|
63 | | ...
64 | | [Arguments] | ${node} | ${interface} | ${settings}
65 | | Configure interface vhost user | ${node} | ${interface}
66 | | ... | &{settings}
67
68 | Vhost-user Operational Data From Honeycomb Should Be
69 | | [Documentation] | Retrieves interface vhost-user configuration through\
70 | | ... | Honeycomb and compares it with settings supplied in argument.
71 | | ...
72 | | ... | *Arguments:*
73 | | ... | - node - information about a DUT node. Type: dictionary
74 | | ... | - interface - name of an interface on the specified node. Type: string
75 | | ... | - settings - Configuration data for vhost-user interface.\
76 | | ... | Type: dictionary
77 | | ...
78 | | ... | *Example:*
79 | | ... | \| Vhost-user Operational Data From Honeycomb Should Be\
80 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \|
81 | | ...
82 | | [Arguments] | ${node} | ${interface} | ${settings}
83 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
84 | | ${api_vhost}= | Set Variable | ${api_data['v3po:vhost-user']}
85 | | :FOR | ${key} | IN | @{settings.keys()}
86 | | | Should be equal | ${api_vhost['${key}']} | ${settings['${key}']}
87
88 | Vhost-user Operational Data From VAT Should Be
89 | | [Documentation] | Retrieves interface vhost-user configuration through VAT\
90 | | ... | and compares it with settings supplied in argument.
91 | | ...
92 | | ... | *Arguments:*
93 | | ... | - node - information about a DUT node. Type: dictionary
94 | | ... | - settings - Configuration data for vhost-user interface.\
95 | | ... | Type: dictionary
96 | | ...
97 | | ... | *Example:*
98 | | ... | \| Vhost-user Operational Data From VAT Should Be\
99 | | ... | \| ${nodes['DUT1']} \| vhost_test \|
100 | | ...
101 | | ... | *Note:*
102 | | ... | Due to the difficulty of identifying newly created interfaces by name\
103 | | ... | or by sw_index, this keyword assumes there is only one vhost-user\
104 | | ... | interface present on the specified node.
105 | | ...
106 | | [Arguments] | ${node} | ${settings}
107 | | &{translate}= | Create dictionary | server=1 | client=0
108 | | ${vat_data}= | vhost user Dump | ${node}
109 | | ${vat_data}= | Set Variable | ${vat_data[0]}
110 | | Should be equal | ${vat_data['sock_filename']} | ${settings['socket']}
111 | | should be equal as strings | ${vat_data['is_server']}
112 | | ... | ${translate['${settings['role']}']}
113
114 | Vhost-user Operational Data From Honeycomb Should Be empty
115 | | [Documentation] | Attempts to retrieve interface vhost-user configuration\
116 | | ... | through Honeycomb and expects to recieve an empty dictionary.
117 | | ...
118 | | ... | *Arguments:*
119 | | ... | - node - information about a DUT node. Type: dictionary
120 | | ... | - interface - name of an interface on the specified node. Type: string
121 | | ...
122 | | ... | *Example:*
123 | | ... | \| Vhost-user Operational Data From Honeycomb Should Be empty\
124 | | ... | \| ${nodes['DUT1']} \| vhost_test \|
125 | | ...
126 | | [Arguments] | ${node} | ${interface}
127 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
128 | | Run keyword and expect error | *KeyError: 'v3po:vhost-user'
129 | | ... | Should be empty | ${api_data['v3po:vhost-user']}
130
131 | Vhost-user Operational Data From VAT Should Be empty
132 | | [Documentation] | Attempts to retrieve interface vhost-user configuration\
133 | | ... | through VAT and expects a "no data" error.
134 | | ...
135 | | ... | *Arguments:*
136 | | ... | - node - information about a DUT node. Type: dictionary
137 | | ...
138 | | ... | *Example:*
139 | | ... | \| Vhost-user Operational Data From VAT Should Be empty\
140 | | ... | \| ${nodes['DUT1']} \|
141 | | ...
142 | | [Arguments] | ${node}
143 | | ${data}= | vhost user Dump | ${node}
144 | | Should be empty | ${data}
145
146 | Honeycomb fails setting vhost-user on different interface type
147 | | [Documentation] | Attempts to set vhost-user settings on an ethernet\
148 | | ... | type interface and expects to fail.
149 | | ...
150 | | ... | *Arguments:*
151 | | ... | - node - information about a DUT node. Type: dictionary
152 | | ... | - interface - name of an interface on the specified node. Type: string
153 | | ... | - settings - Configuration data for vhost-user. Type: dictionary
154 | | ...
155 | | ... | *Example:*
156 | | ... | \| Honeycomb fails setting vhost-user on different interface type\
157 | | ... | \| ${nodes['DUT1']} \| ${interface} \| ${vhost_user_settings} \|
158 | | ...
159 | | [Arguments] | ${node} | ${interface} | ${settings}
160 | | Run Keyword And Expect Error | HoneycombError: * Status code: 500.
161 | | ... | Configure interface vhost user | ${node} | ${interface}
162 | | ... | &{settings}
163
164 | Honeycomb fails setting invalid vhost-user configuration
165 | | [Documentation] | Attempts to create a vhost-user interface with invalid\
166 | | ... | configuration and expects to fail.
167 | | ...
168 | | ... | *Arguments:*
169 | | ... | - node - information about a DUT node. Type: dictionary
170 | | ... | - interface - name of an interface on the specified node. Type: string
171 | | ... | - settings_list - Bad configuration data for vhost-user. Type: list
172 | | ...
173 | | ... | *Example:*
174 | | ... | \| Honeycomb fails setting invalid vhost-user configuration\
175 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \|
176 | | ...
177 | | [Arguments] | ${node} | ${interface} | ${settings}
178 | | Run Keyword And Expect Error | HoneycombError: * Status code: 400.
179 | | ... | Configure interface vhost user | ${node} | ${interface}
180 | | ... | &{settings}