Honeycomb interface state management test
[csit.git] / resources / libraries / robot / honeycomb / interfaces.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/HoneycombUtil.py
16 | Library | resources.libraries.python.InterfaceUtil
17 | ... | WITH NAME | InterfaceCLI
18 | Library | resources.libraries.python.HoneycombAPIKeywords.InterfaceKeywords
19 | ... | WITH NAME | interfaceAPI
20
21 *** Keywords ***
22 | Honeycomb sets interface state
23 | | [Arguments] | ${node} | ${interface} | ${state}
24 | | [Documentation] | Uses Honeycomb API to change the admin state
25 | | ... | of the specified interface.
26 | | ...
27 | | ... | *Arguments:*
28 | | ... | - state - state to set on interface
29 | | ... | - node - dictionary of information about a DUT node
30 | | ... | - interface - name of an interface on the specified node
31 | | ...
32 | | interfaceAPI.Set interface state | ${node} | ${interface} | ${state}
33
34 | Interface state from Honeycomb should be
35 | | [Arguments] | ${node} | ${interface} | ${state}
36 | | [Documentation] | Retrieves interface admin state through Honeycomb and
37 | | ... | compares with state supplied in argument
38 | | ...
39 | | ... | *Arguments:*
40 | | ... | - state - expected interface state
41 | | ... | - node - dictionary of information about a DUT node
42 | | ... | - interface - name of an interface on the specified node
43 | | ...
44 | | ${api_data}= | interfaceAPI.Get interface oper info | ${node} | ${interface}
45 | | ${api_state}= | Set Variable | ${api_data['admin-status']}
46 | | Should be equal | ${api_state} | ${state}
47
48 | Interface state from VAT should be
49 | | [Arguments] | ${node} | ${interface} | ${state}
50 | | [Documentation] | Retrieves interface admin state through VAT and compares
51 | | ... | with state supplied in argument
52 | | ...
53 | | ... | *Arguments:*
54 | | ... | - state - expected interface state
55 | | ... | - node - dictionary of information about a DUT node
56 | | ... | - interface - name of an interface on the specified node
57 | | ...
58 | | ... | _NOTE:_ Vat returns state as int (1/0) instead of string (up/down).
59 | | ... | This keyword also handles translation.
60 | | ...
61 | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
62 | | ${vat_state}= | Set Variable if
63 | | ... | ${vat_data['admin_up_down']} == 1 | up | down
64 | | Should be equal | ${vat_state} | ${state}
65
66 | Interface state is
67 | | [Arguments] | ${node} | ${interface} | ${state}
68 | | [Documentation] | Uses VPP binary API to ensure that the interface under
69 | | ... | test is in the specified admin state.
70 | | ...
71 | | ... | *Arguments:*
72 | | ... | - state - state to set on interface
73 | | ... | - node - dictionary of information about a DUT node
74 | | ... | - interface - name of an interface on the specified node
75 | | ...
76 | | interfaceAPI.Set interface state | ${node} | ${interface} | ${state}