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
17 | Documentation | Keywords used to manipulate vhost-user unterfaces.
20 | Honeycomb creates vhost-user interface
21 | | [Documentation] | Create a vhost-user interface using Honeycomb API.
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
30 | | ... | \| Honeycomb creates vhost-user interface\
31 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \|
33 | | [Arguments] | ${node} | ${interface} | ${settings}
34 | | Create vhost user interface | ${node} | ${interface}
37 | Honeycomb removes vhost-user interface
38 | | [Documentation] | Remove a vhost-user interface using Honeycomb API.
40 | | ... | *Arguments:*
41 | | ... | - node - information about a DUT node. Type: dictionary
42 | | ... | - interface - name of an interface on the specified node. Type: string
45 | | ... | \| Honeycomb removes vhost-user interface\
46 | | ... | \| ${nodes['DUT1']} \| vhost_test \|
48 | | [Arguments] | ${node} | ${interface}
49 | | Delete interface | ${node} | ${interface}
51 | Honeycomb configures vhost-user interface
52 | | [Documentation] | Configure a vhost-user interface using Honeycomb API.
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
61 | | ... | \| Honeycomb configures vhost-user interface\
62 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${new_vhost_user_settings} \|
64 | | [Arguments] | ${node} | ${interface} | ${settings}
65 | | Configure interface vhost user | ${node} | ${interface}
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.
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
79 | | ... | \| Vhost-user Operational Data From Honeycomb Should Be\
80 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \|
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}']}
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.
92 | | ... | *Arguments:*
93 | | ... | - node - information about a DUT node. Type: dictionary
94 | | ... | - settings - Configuration data for vhost-user interface.\
95 | | ... | Type: dictionary
98 | | ... | \| Vhost-user Operational Data From VAT Should Be\
99 | | ... | \| ${nodes['DUT1']} \| vhost_test \|
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.
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']}']}
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.
118 | | ... | *Arguments:*
119 | | ... | - node - information about a DUT node. Type: dictionary
120 | | ... | - interface - name of an interface on the specified node. Type: string
123 | | ... | \| Vhost-user Operational Data From Honeycomb Should Be empty\
124 | | ... | \| ${nodes['DUT1']} \| vhost_test \|
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']}
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.
135 | | ... | *Arguments:*
136 | | ... | - node - information about a DUT node. Type: dictionary
139 | | ... | \| Vhost-user Operational Data From VAT Should Be empty\
140 | | ... | \| ${nodes['DUT1']} \|
142 | | [Arguments] | ${node}
143 | | ${data}= | vhost user Dump | ${node}
144 | | Should be empty | ${data}
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.
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
156 | | ... | \| Honeycomb fails setting vhost-user on different interface type\
157 | | ... | \| ${nodes['DUT1']} \| ${interface} \| ${vhost_user_settings} \|
159 | | [Arguments] | ${node} | ${interface} | ${settings}
160 | | Run Keyword And Expect Error | HoneycombError: * Status code: 500.
161 | | ... | Configure interface vhost user | ${node} | ${interface}
162 | | ... | &{settings}
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.
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
174 | | ... | \| Honeycomb fails setting invalid vhost-user configuration\
175 | | ... | \| ${nodes['DUT1']} \| vhost_test \| ${vhost_user_settings} \|
177 | | [Arguments] | ${node} | ${interface} | ${settings}
178 | | Run Keyword And Expect Error | HoneycombError: * Status code: 400.
179 | | ... | Configure interface vhost user | ${node} | ${interface}
180 | | ... | &{settings}