@@ -67,7 +67,7 @@ class Services:
6767
6868 def __init__ (self ):
6969 self .services = {
70-
70+ "sleep" : 60 ,
7171 "ostype" : "CentOS 5.3 (64-bit)" ,
7272 # Cent OS 5.3 (64 bit)
7373
@@ -392,8 +392,7 @@ def test_03_add_nw_multiple_times(self, value):
392392 # Trying to add same network to vm for the second time
393393 with self .assertRaises (Exception ) as e :
394394 self .addNetworkToVm (network , self .virtual_machine )
395-
396- self .debug ("Adding same network again failed with exception: %s" % e .exception )
395+ self .debug ("Adding same network again failed with exception: %s" % e .exception )
397396
398397 return
399398
@@ -515,7 +514,7 @@ def test_10_add_nw_invalid_ipaddress_running_vm(self):
515514 with self .assertRaises (Exception ) as e :
516515 self .addNetworkToVm (self .shared_network , self .virtual_machine ,
517516 ipaddress = ipaddress )
518- self .debug ("API failed with exception: %s" % e .exception )
517+ self .debug ("API failed with exception: %s" % e .exception )
519518
520519 return
521520
@@ -552,9 +551,7 @@ def test_14_add_nw_different_account(self, value):
552551
553552 with self .assertRaises (Exception ) as e :
554553 self .virtual_machine .add_nic (self .apiclient , network .id )
555- network .delete (self .apiclient )
556-
557- self .debug ("Operation failed with exception %s" % e .exception )
554+ self .debug ("Operation failed with exception %s" % e .exception )
558555
559556 return
560557
@@ -606,15 +603,13 @@ def test_24_add_nw_different_domain(self):
606603 domainid = self .child_do_admin_2 .domainid , serviceofferingid = self .service_offering .id ,
607604 mode = self .zone .networktype )
608605
606+ time .sleep (self .services ["sleep" ])
609607 self .debug ("Trying to %s network in domain %s to a vm in domain %s, This should fail" %
610608 (network .type , self .child_domain_1 .name , self .child_domain_2 .name ))
611609
612610 with self .assertRaises (Exception ) as e :
613611 virtual_machine .add_nic (self .apiclient , network .id )
614- self .debug ("Operation failed with exception %s" % e .exception )
615-
616- network .delete (self .apiclient )
617-
612+ self .debug ("Operation failed with exception %s" % e .exception )
618613 return
619614
620615 @attr (tags = ["advanced" ])
@@ -686,7 +681,7 @@ def test_25_add_nw_above_account_limit(self):
686681
687682 with self .assertRaises (Exception ) as e :
688683 virtual_machine .add_nic (self .apiclient , network_2 .id )
689- self .debug ("Operation failed with exception %s" % e .exception )
684+ self .debug ("Operation failed with exception %s" % e .exception )
690685
691686 return
692687
@@ -836,7 +831,7 @@ def test_08_remove_default_nic(self):
836831 self .virtual_machine .id )
837832 with self .assertRaises (Exception ):
838833 self .virtual_machine .remove_nic (self .apiclient , vm_list [0 ].nic [0 ].id )
839- self .debug ("Removing default nic of vm failed" )
834+ self .debug ("Removing default nic of vm failed" )
840835 return
841836
842837 @attr (tags = ["advanced" ])
@@ -867,7 +862,7 @@ def test_09_remove_foreign_nic(self):
867862 operation should fail" )
868863 with self .assertRaises (Exception ) as e :
869864 self .virtual_machine .remove_nic (self .apiclient , virtual_machine .nic [0 ].id )
870- self .debug ("Operation failed with exception: %s" % e .exception )
865+ self .debug ("Operation failed with exception: %s" % e .exception )
871866 return
872867
873868class TestUpdateVirtualMachineNIC (cloudstackTestCase ):
@@ -1045,7 +1040,7 @@ def test_12_make_default_nic_as_default(self):
10451040 self .debug ("Trying to set default nic again as default nic, This should fail" )
10461041 with self .assertRaises (Exception ) as e :
10471042 self .virtual_machine .update_default_nic (self .apiclient , nicId = defaultNicId )
1048- self .debug ("updateDefaultNic operation failed as expected with exception: %s" %
1043+ self .debug ("updateDefaultNic operation failed as expected with exception: %s" %
10491044 e .exception )
10501045
10511046 return
@@ -1070,15 +1065,16 @@ def test_13_set_foreign_nic_as_default(self):
10701065 virtual_machine = VirtualMachine .create (self .apiclient ,self .services ["virtual_machine" ],
10711066 accountid = account .name ,domainid = account .domainid ,
10721067 serviceofferingid = self .service_offering .id ,mode = self .zone .networktype )
1068+ time .sleep (self .services ["sleep" ])
10731069 self .debug ("Deployed virtual machine: %s" % virtual_machine .id )
1074-
1070+
10751071 foreignNicId = virtual_machine .nic [0 ].id
10761072
10771073 self .debug ("Trying to set nic of new virtual machine as default nic of existing virtual machine, This \
10781074 operation should fail" )
10791075 with self .assertRaises (Exception ) as e :
10801076 self .virtual_machine .update_default_nic (self .apiclient , nicId = foreignNicId )
1081- self .debug ("updateDefaultNic operation failed as expected with exception: %s" %
1077+ self .debug ("updateDefaultNic operation failed as expected with exception: %s" %
10821078 e .exception )
10831079
10841080 return
@@ -1224,6 +1220,7 @@ def test_17_add_nic_different_zone(self):
12241220 cmd .networkid = isolated_network .id
12251221
12261222 with self .assertRaises (Exception ) as e :
1223+ time .sleep (5 )
12271224 self .apiclient .addNicToVirtualMachine (cmd )
12281225 self .debug ("addNicToVirtualMachine API failed with exception: %s" % e .exception )
12291226
@@ -1265,6 +1262,7 @@ def test_18_add_nic_basic_zone(self):
12651262 virtual_machine = VirtualMachine .create (self .apiclient ,self .services ["virtual_machine" ],
12661263 serviceofferingid = self .service_offering .id ,
12671264 mode = basicZone .networktype )
1265+ time .sleep (self .services ["sleep" ])
12681266 self .debug ("Deployed virtual machine %s: " % virtual_machine .id )
12691267
12701268 cmd = addNicToVirtualMachine .addNicToVirtualMachineCmd ()
@@ -1274,6 +1272,7 @@ def test_18_add_nic_basic_zone(self):
12741272 self .dedbug ("Trying to add isolated network to VM (both in basic zone,\
12751273 this operation should fail" )
12761274 with self .assertRaises (Exception ) as e :
1275+ time .sleep (5 )
12771276 self .apiclient .addNicToVirtualMachine (cmd )
12781277 self .debug ("addNicToVirtualMachine API failed with exception: %s" % e .exception )
12791278
@@ -1306,6 +1305,7 @@ def test_26_add_nic_insufficient_permission(self):
13061305 insufficient permission" )
13071306
13081307 with self .assertRaises (Exception ) as e :
1308+ time .sleep (5 )
13091309 api_client .addNicToVirtualMachine (cmd )
13101310 self .debug ("addNicToVirtualMachine API failed with exception: %s" % e .exception )
13111311
@@ -1372,7 +1372,7 @@ def tearDown(self):
13721372 def tearDownClass (cls ):
13731373 try :
13741374 # Disable Network Offerings
1375- # cls.isolated_network_offering.update(cls.api_client, state='Disabled')
1375+ cls .isolated_network_offering .update (cls .api_client , state = 'Disabled' )
13761376 # Cleanup resources used
13771377 cleanup_resources (cls .api_client , cls ._cleanup )
13781378
@@ -1601,7 +1601,7 @@ def test_21_update_nic_wrong_vm_id(self):
16011601
16021602 with self .assertRaises (Exception ) as e :
16031603 self .apiclient .updateDefaultNicForVirtualMachine (cmd )
1604- self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
1604+ self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
16051605 e .exception )
16061606
16071607 return
@@ -1647,7 +1647,7 @@ def test_22_update_nic_wrong_nic_id(self):
16471647
16481648 with self .assertRaises (Exception ) as e :
16491649 self .apiclient .updateDefaultNicForVirtualMachine (cmd )
1650- self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
1650+ self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
16511651 e .exception )
16521652
16531653 return
@@ -1676,7 +1676,7 @@ def test_23_update_nic_incorrect_vm_state(self):
16761676 accountid = account .name ,domainid = account .domainid ,
16771677 serviceofferingid = self .service_offering .id ,
16781678 mode = self .zone .networktype )
1679-
1679+ time . sleep ( self . services [ "sleep" ])
16801680 self .debug ("Created virtual machine %s" % virtual_machine .id )
16811681
16821682 self .debug ("Creating isolated network in account %s" % account .name )
@@ -1729,7 +1729,7 @@ def test_23_update_nic_incorrect_vm_state(self):
17291729
17301730 with self .assertRaises (Exception ) as e :
17311731 self .apiclient .updateDefaultNicForVirtualMachine (cmd )
1732- self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
1732+ self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
17331733 e .exception )
17341734
17351735 return
@@ -1779,7 +1779,7 @@ def test_28_update_nic_insufficient_permission(self):
17791779
17801780 with self .assertRaises (Exception ) as e :
17811781 api_client .updateDefaultNicForVirtualMachine (cmd )
1782- self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
1782+ self .debug ("updateDefaultNicForVirtualMachine API failed with exception: %s" %
17831783 e .exception )
17841784
17851785 return
0 commit comments