@@ -209,7 +209,7 @@ def test_network_delete_network(self):
209209 cmd_output ["description" ],
210210 )
211211
212- del_output = self .openstack ('network delete ' + name1 + ' ' + name2 )
212+ del_output = self .openstack ('network delete %s %s' % ( name1 , name2 ) )
213213 self .assertOutput ('' , del_output )
214214
215215 def test_network_list (self ):
@@ -224,7 +224,7 @@ def test_network_list(self):
224224 network_options +
225225 name1
226226 ))
227- self .addCleanup (self .openstack , 'network delete ' + name1 )
227+ self .addCleanup (self .openstack , 'network delete %s' % name1 )
228228 self .assertIsNotNone (cmd_output ["id" ])
229229 if self .haz_network :
230230 self .assertEqual (
@@ -264,10 +264,8 @@ def test_network_list(self):
264264 else :
265265 network_options = '--subnet 4.5.6.7/28 '
266266 cmd_output = json .loads (self .openstack (
267- 'network create -f json ' +
268- '--share ' +
269- network_options +
270- name2
267+ 'network create -f json --share %s%s' %
268+ (network_options , name2 )
271269 ))
272270 self .addCleanup (self .openstack , 'network delete ' + name2 )
273271 self .assertIsNotNone (cmd_output ["id" ])
@@ -313,8 +311,7 @@ def test_network_list(self):
313311 # Test list --long
314312 if self .haz_network :
315313 cmd_output = json .loads (self .openstack (
316- "network list -f json " +
317- "--long"
314+ "network list -f json --long"
318315 ))
319316 col_name = [x ["Name" ] for x in cmd_output ]
320317 self .assertIn (name1 , col_name )
@@ -323,9 +320,7 @@ def test_network_list(self):
323320 # Test list --long --enable
324321 if self .haz_network :
325322 cmd_output = json .loads (self .openstack (
326- "network list -f json " +
327- "--enable " +
328- "--long"
323+ "network list -f json --enable --long"
329324 ))
330325 col_name = [x ["Name" ] for x in cmd_output ]
331326 self .assertIn (name1 , col_name )
@@ -334,9 +329,7 @@ def test_network_list(self):
334329 # Test list --long --disable
335330 if self .haz_network :
336331 cmd_output = json .loads (self .openstack (
337- "network list -f json " +
338- "--disable " +
339- "--long"
332+ "network list -f json --disable --long"
340333 ))
341334 col_name = [x ["Name" ] for x in cmd_output ]
342335 self .assertNotIn (name1 , col_name )
@@ -345,8 +338,7 @@ def test_network_list(self):
345338 # Test list --share
346339 if self .haz_network :
347340 cmd_output = json .loads (self .openstack (
348- "network list -f json " +
349- "--share "
341+ "network list -f json --share "
350342 ))
351343 col_name = [x ["Name" ] for x in cmd_output ]
352344 self .assertNotIn (name1 , col_name )
@@ -355,8 +347,7 @@ def test_network_list(self):
355347 # Test list --no-share
356348 if self .haz_network :
357349 cmd_output = json .loads (self .openstack (
358- "network list -f json " +
359- "--no-share "
350+ "network list -f json --no-share "
360351 ))
361352 col_name = [x ["Name" ] for x in cmd_output ]
362353 self .assertIn (name1 , col_name )
@@ -368,12 +359,10 @@ def test_network_dhcp_agent(self):
368359
369360 name1 = uuid .uuid4 ().hex
370361 cmd_output1 = json .loads (self .openstack (
371- 'network create -f json ' +
372- '--description aaaa ' +
373- name1
362+ 'network create -f json --description aaaa %s' % name1
374363 ))
375364
376- self .addCleanup (self .openstack , 'network delete ' + name1 )
365+ self .addCleanup (self .openstack , 'network delete %s' % name1 )
377366
378367 # Get network ID
379368 network_id = cmd_output1 ['id' ]
@@ -386,20 +375,19 @@ def test_network_dhcp_agent(self):
386375
387376 # Add Agent to Network
388377 self .openstack (
389- 'network agent add network --dhcp '
390- + agent_id + ' ' + network_id
378+ 'network agent add network --dhcp %s %s' % (agent_id , network_id )
391379 )
392380
393381 # Test network list --agent
394382 cmd_output3 = json .loads (self .openstack (
395- 'network list -f json --agent ' + agent_id
383+ 'network list -f json --agent %s' % agent_id
396384 ))
397385
398386 # Cleanup
399387 # Remove Agent from Network
400388 self .openstack (
401- 'network agent remove network --dhcp '
402- + agent_id + ' ' + network_id
389+ 'network agent remove network --dhcp %s %s' %
390+ ( agent_id , network_id )
403391 )
404392
405393 # Assert
@@ -415,16 +403,16 @@ def test_network_set(self):
415403
416404 name = uuid .uuid4 ().hex
417405 cmd_output = json .loads (self .openstack (
418- 'network create -f json ' +
419- '--description aaaa ' +
420- '--enable ' +
421- '--no-share ' +
422- '--internal ' +
423- '--no-default ' +
424- '--enable-port-security ' +
406+ 'network create -f json '
407+ '--description aaaa '
408+ '--enable '
409+ '--no-share '
410+ '--internal '
411+ '--no-default '
412+ '--enable-port-security %s' %
425413 name
426414 ))
427- self .addCleanup (self .openstack , 'network delete ' + name )
415+ self .addCleanup (self .openstack , 'network delete %s' % name )
428416 self .assertIsNotNone (cmd_output ["id" ])
429417 self .assertEqual (
430418 'aaaa' ,
@@ -453,12 +441,12 @@ def test_network_set(self):
453441 )
454442
455443 raw_output = self .openstack (
456- 'network set ' +
457- '--description cccc ' +
458- '--disable ' +
459- '--share ' +
460- '--external ' +
461- '--disable-port-security ' +
444+ 'network set '
445+ '--description cccc '
446+ '--disable '
447+ '--share '
448+ '--external '
449+ '--disable-port-security %s' %
462450 name
463451 )
464452 self .assertOutput ('' , raw_output )
0 commit comments