diff --git a/ironic/drivers/fake.py b/ironic/drivers/fake.py index b139148961..619918eee9 100644 --- a/ironic/drivers/fake.py +++ b/ironic/drivers/fake.py @@ -42,6 +42,9 @@ from ironic.drivers.modules.irmc import power as irmc_power from ironic.drivers.modules import iscsi_deploy from ironic.drivers.modules.msftocs import management as msftocs_management from ironic.drivers.modules.msftocs import power as msftocs_power +from ironic.drivers.modules.oneview import common as oneview_common +from ironic.drivers.modules.oneview import management as oneview_management +from ironic.drivers.modules.oneview import power as oneview_power from ironic.drivers.modules import pxe from ironic.drivers.modules import seamicro from ironic.drivers.modules import snmp @@ -291,3 +294,23 @@ class FakeWakeOnLanDriver(base.BaseDriver): def __init__(self): self.power = wol.WakeOnLanPower() self.deploy = fake.FakeDeploy() + + +class FakeOneViewDriver(base.BaseDriver): + """Fake OneView driver. For testing purposes. """ + + def __init__(self): + if not importutils.try_import('oneview_client.client'): + raise exception.DriverLoadError( + driver=self.__class__.__name__, + reason=_("Unable to import python-oneviewclient library")) + + # Checks connectivity to OneView and version compatibility on driver + # initialization + oneview_client = oneview_common.get_oneview_client() + oneview_client.verify_oneview_version() + oneview_client.verify_credentials() + self.power = oneview_power.OneViewPower() + self.management = oneview_management.OneViewManagement() + self.boot = fake.FakeBoot() + self.deploy = fake.FakeDeploy() diff --git a/ironic/drivers/oneview.py b/ironic/drivers/oneview.py index b437c99045..8da4537b1a 100644 --- a/ironic/drivers/oneview.py +++ b/ironic/drivers/oneview.py @@ -23,7 +23,6 @@ from ironic.common import exception from ironic.common.i18n import _ from ironic.drivers import base from ironic.drivers.modules import agent -from ironic.drivers.modules import fake from ironic.drivers.modules import iscsi_deploy from ironic.drivers.modules.oneview import common from ironic.drivers.modules.oneview import management @@ -88,23 +87,3 @@ class ISCSIPXEOneViewDriver(base.BaseDriver): self.boot = pxe.PXEBoot() self.deploy = iscsi_deploy.ISCSIDeploy() self.vendor = iscsi_deploy.VendorPassthru() - - -class FakeOneViewDriver(base.BaseDriver): - """Fake OneView driver. For testing purposes. """ - - def __init__(self): - if not importutils.try_import('oneview_client.client'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import python-oneviewclient library")) - - # Checks connectivity to OneView and version compatibility on driver - # initialization - oneview_client = common.get_oneview_client() - oneview_client.verify_oneview_version() - oneview_client.verify_credentials() - self.power = power.OneViewPower() - self.management = management.OneViewManagement() - self.boot = fake.FakeBoot() - self.deploy = fake.FakeDeploy() diff --git a/setup.cfg b/setup.cfg index 7685066492..3f865f4c1d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,7 +60,7 @@ ironic.drivers = fake_ucs = ironic.drivers.fake:FakeUcsDriver fake_cimc = ironic.drivers.fake:FakeCIMCDriver fake_wol = ironic.drivers.fake:FakeWakeOnLanDriver - fake_oneview = ironic.drivers.oneview:FakeOneViewDriver + fake_oneview = ironic.drivers.fake:FakeOneViewDriver iscsi_ilo = ironic.drivers.ilo:IloVirtualMediaIscsiDriver iscsi_irmc = ironic.drivers.irmc:IRMCVirtualMediaIscsiDriver iscsi_pxe_oneview = ironic.drivers.oneview:ISCSIPXEOneViewDriver