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