Exemplo n.º 1
0
    def test_power_off_calls_power_control_nova(self):
        system_id, machine, tenant, username, password, authurl, context = (
            self.make_parameters())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        nova_power_driver.power_off(system_id, context)

        self.assertThat(
            power_control_nova_mock, MockCalledOnceWith('off', **context))
Exemplo n.º 2
0
    def test_power_query_calls_power_state_nova(self):
        system_id, machine, tenant, username, password, authurl, context = (
            self.make_parameters())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        power_control_nova_mock.return_value = 'off'
        expected_result = nova_power_driver.power_query(system_id, context)

        self.expectThat(
            power_control_nova_mock, MockCalledOnceWith('query', **context))
        self.expectThat(expected_result, Equals('off'))
Exemplo n.º 3
0
    def test_power_on_calls_power_control_nova(self):
        (
            system_id,
            machine,
            tenant,
            username,
            password,
            authurl,
            context,
        ) = self.make_parameters()
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(nova_power_driver,
                                             "power_control_nova")
        nova_power_driver.power_on(system_id, context)

        self.assertThat(power_control_nova_mock,
                        MockCalledOnceWith("on", **context))
Exemplo n.º 4
0
        return schemas


# Register all the power drivers.
power_drivers = [
    AMTPowerDriver(),
    APCPowerDriver(),
    DLIPowerDriver(),
    HMCPowerDriver(),
    IPMIPowerDriver(),
    LXDPowerDriver(),
    ManualPowerDriver(),
    MoonshotIPMIPowerDriver(),
    MSCMPowerDriver(),
    MicrosoftOCSPowerDriver(),
    NovaPowerDriver(),
    OpenBMCPowerDriver(),
    RECSPowerDriver(),
    RedfishPowerDriver(),
    SeaMicroPowerDriver(),
    UCSMPowerDriver(),
    VirshPowerDriver(),
    VMwarePowerDriver(),
    WedgePowerDriver(),
]
for driver in power_drivers:
    PowerDriverRegistry.register_item(driver.name, driver)


# Pod drivers are also power drivers.
for driver_name, driver in PodDriverRegistry:
Exemplo n.º 5
0
            'nova_id': machine,
            'os_tenantname': tenant,
            'os_username': username,
            'os_password': password,
            'os_authurl': authurl,
            'user_domain_name': user_domain_name,
            'project_domain_name': project_domain_name,
        }
        return system_id, machine, tenant, username, password,
               authurl, user_domain_name, project_domain_name, context

    def test_power_on_calls_power_control_nova_v3(self):
        system_id, machine, tenant, username, password, authurl,
            user_domain_name, project_domain_name, context = (
            self.make_parameters_v3())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        nova_power_driver.power_on(system_id, context)

        self.assertThat(
            power_control_nova_mock, MockCalledOnceWith('on', **context))

    def test_power_off_calls_power_control_nova_v3(self):
        system_id, machine, tenant, username, password, authurl,
            user_domain_name, project_domain_name, context = (
            self.make_parameters_v3())
        nova_power_driver = NovaPowerDriver()
        power_control_nova_mock = self.patch(
            nova_power_driver, 'power_control_nova')
        nova_power_driver.power_off(system_id, context)