@@ -213,3 +213,92 @@ func (its *integTestSuite) TestEndpointGroupCreateDelete(c *C) {
213
213
214
214
assertNoErr (its .client .NetworkDelete ("default" , "test" ), c , "deleting network" )
215
215
}
216
+
217
+ // TestEndpointGroupInspect test endpointGroup inspect command
218
+ func (its * integTestSuite ) TestEndpointGroupInspect (c * C ) {
219
+ // Create a network
220
+ err := its .client .NetworkPost (& client.Network {
221
+ TenantName : "default" ,
222
+ NetworkName : "test" ,
223
+ Subnet : "10.1.1.0/24" ,
224
+ Encap : its .encap ,
225
+ })
226
+ assertNoErr (err , c , "creating network" )
227
+
228
+ // Create a epg
229
+ err = its .client .EndpointGroupPost (& client.EndpointGroup {
230
+ TenantName : "default" ,
231
+ NetworkName : "test" ,
232
+ GroupName : "epgA" ,
233
+ })
234
+ assertNoErr (err , c , "creating endpointgroup" )
235
+
236
+ // verify endpointGroup state is correct
237
+ insp , err := its .client .EndpointGroupInspect ("default" , "epgA" )
238
+ assertNoErr (err , c , "inspecting endpointGroup" )
239
+ log .Infof ("Inspecting endpointGroup: %+v" , insp )
240
+ c .Assert (len (insp .Oper .Endpoints ), Equals , 0 )
241
+ c .Assert (insp .Oper .PktTag , Equals , 1 )
242
+ c .Assert (insp .Oper .NumEndpoints , Equals , 0 )
243
+
244
+ for i := 0 ; i < its .iterations ; i ++ {
245
+ addr , err := its .allocAddress ("" , "test.default" , "" )
246
+ assertNoErr (err , c , "allocating address" )
247
+ c .Assert (addr , Equals , "10.1.1.1" )
248
+
249
+ // create an endpoint in epg
250
+ epCfg1 , err := its .createEndpoint ("default" , "test" , "epgA" , addr , "" )
251
+ assertNoErr (err , c , "creating endpoint" )
252
+
253
+ // verify endpointGroup & endpoint inspect output
254
+ insp , err := its .client .EndpointGroupInspect ("default" , "epgA" )
255
+ assertNoErr (err , c , "inspecting endpointGroup" )
256
+ log .Infof ("Inspecting endpointGroup: %+v" , insp )
257
+ c .Assert (len (insp .Oper .Endpoints ), Equals , 1 )
258
+ c .Assert (insp .Oper .NumEndpoints , Equals , 1 )
259
+
260
+ // verify the endpoint inspect and flow
261
+ its .verifyEndpointInspect ("default" , "test" , epCfg1 , c )
262
+ its .verifyEndpointFlow (epCfg1 , c )
263
+
264
+ // allocate a specific address
265
+ addr , err = its .allocAddress ("" , "test.default" , "10.1.1.5" )
266
+ assertNoErr (err , c , "allocating address" )
267
+ c .Assert (addr , Equals , "10.1.1.5" )
268
+
269
+ // create an endpoint in epg
270
+ epCfg2 , err := its .createEndpoint ("default" , "test" , "epgA" , addr , "" )
271
+ assertNoErr (err , c , "creating endpoint" )
272
+
273
+ // verify network & endpoint inspect output
274
+ insp , err = its .client .EndpointGroupInspect ("default" , "epgA" )
275
+ assertNoErr (err , c , "inspecting endpointGroup" )
276
+ log .Infof ("Inspecting endpointGroup: %+v" , insp )
277
+ c .Assert (len (insp .Oper .Endpoints ), Equals , 2 )
278
+ c .Assert (insp .Oper .NumEndpoints , Equals , 2 )
279
+
280
+ // verify endpoint inspect and flows is added
281
+ its .verifyEndpointInspect ("default" , "test" , epCfg2 , c )
282
+ its .verifyEndpointFlow (epCfg2 , c )
283
+
284
+ // delete the endpoints
285
+ err = its .deleteEndpoint ("default" , "test" , "" , epCfg1 )
286
+ assertNoErr (err , c , "deleting endpoint" )
287
+ err = its .deleteEndpoint ("default" , "test" , "" , epCfg2 )
288
+ assertNoErr (err , c , "deleting endpoint" )
289
+
290
+ // verify there are no more endpoints in epg
291
+ insp , err = its .client .EndpointGroupInspect ("default" , "epgA" )
292
+ assertNoErr (err , c , "inspecting endpointGroup" )
293
+ c .Assert (len (insp .Oper .Endpoints ), Equals , 0 )
294
+ log .Infof ("Inspecting endpointGroup: %+v" , insp )
295
+ c .Assert (len (insp .Oper .Endpoints ), Equals , 0 )
296
+ c .Assert (insp .Oper .NumEndpoints , Equals , 0 )
297
+
298
+ // verify flows are also gone
299
+ its .verifyEndpointFlowRemoved (epCfg1 , c )
300
+ its .verifyEndpointFlowRemoved (epCfg2 , c )
301
+ }
302
+
303
+ assertNoErr (its .client .EndpointGroupDelete ("default" , "epgA" ), c , "deleting endpointGroup" )
304
+ }
0 commit comments