HC Test: improve functional suite setup and teardown
[csit.git] / resources / libraries / robot / honeycomb / tap.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 TAP interfaces.
18
19 *** Keywords ***
20 | Honeycomb creates TAP interface
21 | | [Documentation] | Uses Honeycomb API to configure a new TAP interface.
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 TAP. Type: dictionary
27 | | ...
28 | | ... | *Example:*
29 | | ... | \| Honeycomb creates TAP interface \
30 | | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\
31 | | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
32 | | ...
33 | | [Arguments] | ${node} | ${interface} | ${settings}
34 | | Create TAP interface | ${node} | ${interface}
35 | | ... | &{settings}
36
37 | Honeycomb configures TAP interface
38 | | [Documentation] | Uses Honeycomb API to configure an existing TAP interface.
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 | | ... | - settings - Configuration data for TAP. Type: dictionary
44 | | ...
45 | | ... | *Example:*
46 | | ... | \| Honeycomb configures TAP interface \
47 | | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\
48 | | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
49 | | ...
50 | | [Arguments] | ${node} | ${interface} | ${settings}
51 | | Configure interface TAP | ${node} | ${interface}
52 | | ... | &{settings}
53
54 | Honeycomb removes TAP interface
55 | | [Documentation] | Uses Honeycomb API to remove a TAP interface.
56 | | ...
57 | | ... | *Arguments:*
58 | | ... | - node - information about a DUT node. Type: dictionary
59 | | ... | - interface - name of an interface on the specified node. Type: string
60 | | ...
61 | | ... | *Example:*
62 | | ...
63 | | ... | \| Honeycomb removes TAP interface \
64 | | ... | \| ${nodes['DUT1']} \| tap_int1 \|
65 | | [Arguments] | ${node} | ${interface}
66 | | Delete interface | ${node} | ${interface}
67
68 | TAP Operational Data From Honeycomb Should Be
69 | | [Documentation] | Retrieves interface TAP configuration through Honeycomb\
70 | | ... | and compares 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 TAP. Type: dictionary
76 | | ...
77 | | ... | *Example:*
78 | | ...
79 | | ... | \| TAP Operational Data From Honeycomb Should Be \
80 | | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\
81 | | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
82 | | ...
83 | | [Arguments] | ${node} | ${interface} | ${settings}
84 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
85 | | ${api_tap}= | Set Variable | ${api_data['v3po:tap']}
86 | | Should be equal | ${api_tap['tap-name']} | ${settings['tap-name']}
87 | | ${api_mac}= | Set Variable | ${api_data['phys-address']}
88 | | Should be equal | ${api_mac} | ${settings['mac']}
89
90 | TAP Operational Data From VAT Should Be
91 | | [Documentation] | Retrieves interface TAP configuration through VAT and\
92 | | ... | compares with settings supplied in argument.
93 | | ...
94 | | ... | *Arguments:*
95 | | ... | - node - information about a DUT node. Type: dictionary
96 | | ... | - settings - Configuration data for TAP. Type: dictionary
97 | | ...
98 | | ... | *Example:*
99 | | ...
100 | | ... | \| TAP Operational Data From Honeycomb Should Be \
101 | | ... | \| ${nodes['DUT1']} \| ${{'tap-name':'tap1',\
102 | | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \|
103 | | ...
104 | | [Arguments] | ${node} | ${interface} | ${settings}
105 | | ${vat_data}= | TAP Dump | ${node} | ${interface}
106 | | Should be equal | ${vat_data['dev_name']} | ${settings['tap-name']}
107 # other settings not accessible through VAT commands
108
109 | TAP Operational Data From Honeycomb Should Be empty
110 | | [Documentation] | Attempts to retrieve interface TAP configuration\
111 | | ... | through Honeycomb and expects to recieve an empty dictionary.
112 | | ...
113 | | ... | *Arguments:*
114 | | ... | - node - information about a DUT node. Type: dictionary
115 | | ... | - interface - name of an interface on the specified node. Type: string
116 | | ...
117 | | ... | *Example:*
118 | | ...
119 | | ... | \| TAP Operational Data From Honeycomb Should Be empty\
120 | | ... | \| ${nodes['DUT1']} \| tap_int1 \|
121 | | ...
122 | | [Arguments] | ${node} | ${interface}
123 | | ${api_data}= | Get interface oper data | ${node} | ${interface}
124 | | Run keyword and expect error | *KeyError: 'v3po:tap' | Set Variable
125 | | ... | ${api_data['v3po:tap']}
126
127 | TAP Operational Data From VAT Should Be empty
128 | | [Documentation] | Attempts to retrieve interface TAP configuration\
129 | | ... | through VAT and expects a "no data" error.
130 | | ...
131 | | ... | *Arguments:*
132 | | ... | - node - information about a DUT node. Type: dictionary
133 | | ... | - interface - name of an interface on the specified node. Type: string
134 | | ...
135 | | ... | *Example:*
136 | | ...
137 | | ... | \| TAP Operational Data From VAT Should Be empty\
138 | | ... | \| ${nodes['DUT1']} \| tap_int1 \|
139 | | ...
140 | | [Arguments] | ${node} | ${interface}
141 | | Run Keyword And Expect Error | ValueError: No JSON object could be decoded
142 | | ... | TAP Dump | ${node} | ${interface}