Add Honeycomb bridge domain management tests
[csit.git] / resources / libraries / robot / honeycomb / bridge_domain.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.L2Util
16 | Library | resources.libraries.python.HcAPIKwBridgeDomain.BridgeDomainKeywords
17 | Library | resources.libraries.python.HcAPIKwInterfaces.InterfaceKeywords
18 | ... | WITH NAME | InterfaceAPI
19
20 *** Keywords ***
21 | Honeycomb creates first L2 bridge domain
22 | | [Documentation] | Uses Honeycomb API to create a bridge domain on the \
23 | | ... | VPP node. Any other bridge domains will be removed in the process.
24 | | ...
25 | | ... | *Arguments:*
26 | | ... | - node - information about a DUT node. Type: dictionary
27 | | ... | - bd_name - name of the created bridge domain. Type: string
28 | | ... | - settings - settings for the created bridge domain. Type: dictionary
29 | | ...
30 | | ... | *Example:*
31 | | ...
32 | | ... | \| Honeycomb creates first L2 bridge domain \| ${nodes['DUT1']} \
33 | | ... | \| bd-04 \| ${{flood:True, learn:False}} \|
34 | | [Arguments] | ${node} | ${bd_name} | ${settings}
35 | | Add first BD | ${node} | ${bd_name} | &{settings}
36
37 | Honeycomb creates L2 bridge domain
38 | | [Documentation] | Uses Honeycomb API to create a bridge domain on the \
39 | | ... | VPP node.
40 | | ...
41 | | ... | *Arguments:*
42 | | ... | - node - information about a DUT node. Type: dictionary
43 | | ... | - bd_name - name of the created bridge domain. Type: string
44 | | ... | - settings - settings for the created bridge domain. Type: dictionary
45 | | ...
46 | | ... | *Example:*
47 | | ...
48 | | ... | \| Honeycomb creates L2 bridge domain \| ${nodes['DUT1']} \
49 | | ... | \| bd-04 \| ${{flood:True, learn:False}} \|
50 | | [Arguments] | ${node} | ${bd_name} | ${settings}
51 | | Add BD | ${node} | ${bd_name} | &{settings}
52
53 | Bridge domain configuration from Honeycomb should be
54 | | [Documentation] | Uses Honeycomb API to verify bridge domain settings\
55 | | ... | against provided values.
56 | | ...
57 | | ... | *Arguments:*
58 | | ... | - node - information about a DUT node. Type: dictionary
59 | | ... | - bd_name - name of the bridge domain. Type: string
60 | | ... | - settings - expected settings for the bridge domain. Type: dictionary
61 | | ...
62 | | ... | *Example:*
63 | | ...
64 | | ... | \| Bridge domain configuration from Honeycomb should be \
65 | | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \|
66 | | [Arguments] | ${node} | ${bd_name} | ${settings}
67 | | ${api_data}= | Get bd cfg data | ${node} | ${bd_name}
68 | | :FOR | ${key} | IN | @{settings.keys()}
69 | | | Should be equal | ${settings['${key}']} | ${api_data['${key}']}
70
71 | Bridge domain configuration from VAT should be
72 | | [Documentation] | Uses VAT to verify bridge domain settings\
73 | | ... | against provided values.
74 | | ...
75 | | ... | *Arguments:*
76 | | ... | - node - information about a DUT node. Type: dictionary
77 | | ... | - bd_name - name of the bridge domain. Type: string
78 | | ... | - settings - expected settings for the bridge domain. Type: dictionary
79 | | ...
80 | | ... | *Example:*
81 | | ...
82 | | ... | \| Bridge domain configuration from VAT should be \
83 | | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \|
84 | | [Arguments] | ${node} | ${bd_index} | ${settings}
85 | | ${vat_data}= | VPP get bridge domain data | ${node}
86 | | ${vat_data}= | Set Variable | ${vat_data[${bd_index}]}
87 | | :FOR | ${key} | IN | @{settings.keys()}
88 | | | Run keyword if | $key in $vat_data.keys()
89 | | | ... | Should be equal | ${settings['${key}']} | ${vat_data['${key}']}
90
91 | Honeycomb adds interfaces to bridge domain
92 | | [Documentation] | Uses Honeycomb API to assign interfaces to a bridge\
93 | | ... | domain.
94 | | ...
95 | | ... | *Arguments:*
96 | | ... | - node - information about a DUT node. Type: dictionary
97 | | ... | - interface1, interface2 - names of interfaces to assign to bridge\
98 | | ... | domain. Type: string
99 | | ... | - bd_name - name of the bridge domain. Type: string
100 | | ...
101 | | ... | *Example:*
102 | | ...
103 | | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \
104 | | ... | \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| bd-04 \|
105 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
106 | | ... | ${settings}
107 | | interfaceAPI.Add bridge domain to interface
108 | | ... | ${node} | ${interface1} | ${bd_name} | &{settings}
109 | | interfaceAPI.Add bridge domain to interface
110 | | ... | ${node} | ${interface2} | ${bd_name} | &{settings}
111
112 | Honeycomb should show interfaces assigned to bridge domain
113 | | [Documentation] | Uses Honeycomb API to verify interface assignment to\
114 | | ... | bridge domain.
115 | | ...
116 | | ... | *Arguments:*
117 | | ... | - node - information about a DUT node. Type: dictionary
118 | | ... | - interface1, interface2 - names of interfaces to assign to bridge\
119 | | ... | domain. Type: string
120 | | ... | - bd_name - name of the bridge domain. Type: string
121 | | ...
122 | | ... | *Example:*
123 | | ...
124 | | ... | \| Honeycomb should show interfaces assigned to bridge domain \
125 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \
126 | | ... | \| bd-04 \|
127 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
128 | | ... | ${settings}
129 | | ${if1_data}= | interfaceAPI.Get interface oper data
130 | | ... | ${node} | ${interface1}
131 | | ${if2_data}= | interfaceAPI.Get interface oper data
132 | | ... | ${node} | ${interface2}
133 | | Should be equal | ${if1_data['v3po:l2']['bridge-domain']}
134 | | ... | ${if1_data['v3po:l2']['bridge-domain']} | ${bd_name}
135 | | :FOR | ${key} | IN | @{settings.keys()}
136 | | | Should be equal | ${if1_data['v3po:l2']['${key}']}
137 | | | ... | ${if2_data['v3po:l2']['${key}']} | ${settings['${key}']}
138
139 | VAT should show interfaces assigned to bridge domain
140 | | [Documentation] | Uses VAT to verify interface assignment to\
141 | | ... | bridge domain.
142 | | ...
143 | | ... | *Arguments:*
144 | | ... | - node - information about a DUT node. Type: dictionary
145 | | ... | - interface1, interface2 - names of interfaces to assign to bridge\
146 | | ... | domain. Type: string
147 | | ... | - index - index of bridge domains on VPP node. Starts from 0,\
148 | | ... | new BDs reuse numbers after a bridge domain is removed. Type: int
149 | | ...
150 | | ... | *Example:*
151 | | ...
152 | | ... | \| VAT should show interfaces assigned to bridge domain \
153 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \
154 | | ... | \| ${4} \|
155 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${index}
156 | | ${if1_index}= | Get interface sw index | ${node} | ${interface1}
157 | | ${if2_index}= | Get interface sw index | ${node} | ${interface2}
158 | | ${if_indices}= | Create list | ${if1_index} | ${if2_index}
159 | | ${bd_data}= | VPP get bridge domain data | ${node}
160 | | ${bd_data}= | Set Variable | ${bd_data[${index}]}
161 | | :FOR | ${sw_if_index} | IN | ${bd_data['sw_if']}
162 | | | Should contain | ${if_indices} | ${sw_if_index}
163
164 | Honeycomb removes all bridge domains
165 | | [Documentation] | Uses Honeycomb API to remove all bridge domains from the \
166 | | ... | VPP node.
167 | | ...
168 | | ... | *Arguments:*
169 | | ... | - node - information about a DUT node. Type: dictionary
170 | | ...
171 | | ... | *Example:*
172 | | ...
173 | | ... | \| Honeycomb removes all bridge domains \| ${nodes['DUT1']} \|
174 | | [Arguments] | ${node}
175 | | Remove all bds | ${node}
176
177 | Honeycomb should show no bridge domains
178 | | [Documentation] | Uses Honeycomb API to verify the removal of all\
179 | | ... | bridge domains.
180 | | ...
181 | | ... | *Arguments:*
182 | | ... | - node - information about a DUT node. Type: dictionary
183 | | ...
184 | | ... | *Example:*
185 | | ...
186 | | ... | \| Honeycomb should show no bridge domains \| ${nodes['DUT1']} \|
187 | | [Arguments] | ${node}
188 | | ${bd_data} | Get all BDs cfg data | ${node}
189 | | Should be empty | ${bd_data}
190
191 | VAT should show no bridge domains
192 | | [Documentation] | Uses VAT to verify the removal of all bridge domains.
193 | | ...
194 | | ... | *Arguments:*
195 | | ... | - node - information about a DUT node. Type: dictionary
196 | | ...
197 | | ... | *Example:*
198 | | ...
199 | | ... | \| VAT should show no bridge domains \| ${nodes['DUT1']} \|
200 | | [Arguments] | ${node}
201 | | Run Keyword And Expect Error | ValueError: No JSON object could be decoded
202 | | ... | VPP get bridge domain data | ${node}