@@ -127,16 +127,31 @@ def getListHostHAResources(self):
127127 cmd .hostid = self .getHost ().id
128128 return cmd
129129
130-
130+ def setupDummyOOBM (self ):
131+ from apache .cloudstack .api .command .admin .outOfBandManagement import configureOutOfBandManagementForHost , enableOutOfBandManagementForHost
132+
133+ oobm_cmd = configureOutOfBandManagementForHost .configureOutOfBandManagementForHostCmd ()
134+ oobm_cmd .hostid = self .host .id
135+ oobm_cmd .address = "10.1.1.1"
136+ oobm_cmd .driver = "ipmitool"
137+ oobm_cmd .username = "admin"
138+ oobm_cmd .password = "password"
139+ self .apiclient .configureOutOfBandManagementForHost (oobm_cmd )
140+
141+ enable_oobm_cmd = enableOutOfBandManagementForHost .enableOutOfBandManagementForHostCmd ()
142+ enable_oobm_cmd .hostid = self .host .id
143+ self .apiclient .enableOutOfBandManagementForHost (enable_oobm_cmd )
144+
131145 def configureAndEnableHostHa (self , initialize = True ):
146+ self .setupDummyOOBM ()
132147 self .apiclient .configureHAForHost (self .getHostHaConfigCmd ())
133148 response = self .apiclient .enableHAForHost (self .getHostHaEnableCmd ())
134149 self .assertEqual (response .haenable , True )
135150 if initialize :
136151 self .configureSimulatorHAProviderState (True , True , True , False )
137152
138-
139153 def configureAndDisableHostHa (self , hostId ):
154+ self .setupDummyOOBM ()
140155 self .apiclient .configureHAForHost (self .getHostHaConfigCmd ())
141156 cmd = self .getHostHaDisableCmd ()
142157 cmd .hostid = hostId
@@ -241,6 +256,7 @@ def test_hostha_configure_invalid_provider(self):
241256 cmd = self .getHostHaConfigCmd ()
242257 cmd .provider = 'randomDriverThatDoesNotExist'
243258 try :
259+ self .setupDummyOOBM ()
244260 response = self .apiclient .configureHAForHost (cmd )
245261 except Exception :
246262 pass
@@ -254,6 +270,7 @@ def test_hostha_configure_default_driver(self):
254270 Tests host-ha configuration with valid data
255271 """
256272 cmd = self .getHostHaConfigCmd ()
273+ self .setupDummyOOBM ()
257274 response = self .apiclient .configureHAForHost (cmd )
258275 self .assertEqual (response .hostid , cmd .hostid )
259276 self .assertEqual (response .haprovider , cmd .provider .lower ())
@@ -323,6 +340,7 @@ def test_hostha_enable_feature_valid(self):
323340 """
324341 Tests host-ha enable feature with valid options
325342 """
343+ self .setupDummyOOBM ()
326344 self .apiclient .configureHAForHost (self .getHostHaConfigCmd ())
327345 cmd = self .getHostHaEnableCmd ()
328346 response = self .apiclient .enableHAForHost (cmd )
@@ -646,6 +664,7 @@ def test_configure_ha_provider_invalid(self):
646664 """
647665
648666 # Enable ha for host
667+ self .setupDummyOOBM ()
649668 self .apiclient .configureHAForHost (self .getHostHaConfigCmd ())
650669 cmd = self .getHostHaEnableCmd ()
651670 response = self .apiclient .enableHAForHost (cmd )
@@ -665,6 +684,7 @@ def test_configure_ha_provider_invalid(self):
665684
666685 # Call the configure HA provider API with not supported provider for HA
667686 try :
687+ self .setupDummyOOBM ()
668688 self .apiclient .configureHAForHost (conf_ha_cmd )
669689 except Exception :
670690 pass
@@ -679,6 +699,7 @@ def test_configure_ha_provider_valid(self):
679699 """
680700
681701 # Enable ha for host
702+ self .setupDummyOOBM ()
682703 self .apiclient .configureHAForHost (self .getHostHaConfigCmd ())
683704 cmd = self .getHostHaEnableCmd ()
684705 response = self .apiclient .enableHAForHost (cmd )
@@ -698,6 +719,7 @@ def test_configure_ha_provider_valid(self):
698719 conf_ha_cmd .hostid = cmd .hostid
699720
700721 # Call the configure HA provider API with not supported provider for HA
722+ self .setupDummyOOBM ()
701723 response = self .apiclient .configureHAForHost (conf_ha_cmd )
702724
703725 # Check the response contains the set provider and hostID
@@ -714,6 +736,7 @@ def getHaProvider(self, host):
714736
715737 def configureHaProvider (self ):
716738 cmd = self .getHostHaConfigCmd (self .getHaProvider (self .getHost ()))
739+ self .setupDummyOOBM ()
717740 return self .apiclient .configureHAForHost (cmd )
718741
719742
0 commit comments