Esempio n. 1
0
def reboot(deployment_id):
    deployment = Deployment.objects.get(id=deployment_id)
    management = deployment.device.find_management()
    user, password = settings.ILO_USER, settings.ILO_PASSWORD
    if user and IloHost(management, user, password).reboot(True):
            return True
    user, password = settings.IPMI_USER, settings.IPMI_PASSWORD
    if user and ipmi_reboot(management, user, password, True):
        return True
    user = settings.SSH_IBM_USER
    bay = deployment.device.chassis_position
    if user and bay and ssh_ibm_reboot(management, bay):
        return True
    return False
Esempio n. 2
0
def reboot(deployment_id):
    deployment = Deployment.objects.get(id=deployment_id)
    if deployment.status == DeploymentStatus.done:
        # Deployment chain requires status to be in_progress or open only.
        # But before running script assure status didn't change
        # in meantime.
        return False
    management = deployment.device.find_management()
    if not management:
        return True
    management_ip = management.address
    user, password = settings.ILO_USER, settings.ILO_PASSWORD
    if user and IloHost(management_ip, user, password).reboot(True):
        return True
    user, password = settings.IPMI_USER, settings.IPMI_PASSWORD
    if user and ipmi_reboot(management_ip, user, password, True):
        return True
    user = settings.SSH_IBM_USER
    bay = deployment.device.chassis_position
    if user and bay:
        ssh_ibm_reboot(management_ip, bay)
    return True
Esempio n. 3
0
 def setUp(self):
     self.ilo = IloHost('127.0.0.1', '', '')
     self.ilo.update(raw=SAMPLE_RIBCL)
Esempio n. 4
0
class IloHpPluginTest(TestCase):
    def setUp(self):
        self.ilo = IloHost('127.0.0.1', '', '')
        self.ilo.update(raw=SAMPLE_RIBCL)

    def test_get_base_device_info(self):
        self.assertEqual(
            _get_base_device_info(self.ilo),
            {
                'model_name':
                'HP ProLiant BL2x220c G5',
                'parts': [
                    {
                        'mgmt_firmware': ', Dec 02 2008, rev 1.70',
                        'type': 'management',
                    },
                ],
                'serial_number':
                'SN12345678',
                'type':
                'blade server',
            },
        )

    def test_get_mac_addresses(self):
        self.assertEqual(
            _get_mac_addresses(self.ilo),
            ['00215AAABB12', '00215AAABB13', '00215AAABB14'],
        )

    def test_get_processors(self):
        self.assertEqual(
            _get_processors(self.ilo),
            [
                {
                    'cores': 4,
                    'family': 'Unknown',
                    'index': 1,
                    'label': 'Proc 1',
                    'model_name': 'CPU Unknown 2500MHz, 4-core',
                    'speed': 2500,
                },
                {
                    'cores': 4,
                    'family': 'Unknown',
                    'index': 2,
                    'label': 'Proc 2',
                    'model_name': 'CPU Unknown 2500MHz, 4-core',
                    'speed': 2500,
                },
            ],
        )

    def test_get_memory(self):
        self.assertEqual(
            _get_memory(self.ilo),
            [
                {
                    'index': 1,
                    'label': 'DIMM 1A',
                    'size': 4096,
                    'speed': 667,
                },
                {
                    'index': 2,
                    'label': 'DIMM 2B',
                    'size': 4096,
                    'speed': 667,
                },
                {
                    'index': 3,
                    'label': 'DIMM 3C',
                    'size': 4096,
                    'speed': 667,
                },
                {
                    'index': 4,
                    'label': 'DIMM 4D',
                    'size': 4096,
                    'speed': 667,
                },
            ],
        )
Esempio n. 5
0
 def setUp(self):
     self.ilo = IloHost('127.0.0.1', '', '')
     self.ilo.update(raw=SAMPLE_RIBCL)
Esempio n. 6
0
class IloHpPluginTest(TestCase):

    def setUp(self):
        self.ilo = IloHost('127.0.0.1', '', '')
        self.ilo.update(raw=SAMPLE_RIBCL)

    def test_get_base_device_info(self):
        self.assertEqual(
            _get_base_device_info(self.ilo),
            {
                'model_name': 'HP ProLiant BL2x220c G5',
                'parts': [
                    {
                        'mgmt_firmware': ', Dec 02 2008, rev 1.70',
                        'type': 'management',
                    },
                ],
                'serial_number': 'SN12345678',
                'type': 'blade server',
            },
        )

    def test_get_mac_addresses(self):
        self.assertEqual(
            _get_mac_addresses(self.ilo),
            ['00215AAABB12', '00215AAABB13', '00215AAABB14'],
        )

    def test_get_processors(self):
        self.assertEqual(
            _get_processors(self.ilo),
            [
                {
                    'cores': 4,
                    'family': 'Unknown',
                    'index': 1,
                    'label': 'Proc 1',
                    'model_name': 'CPU Unknown 2500MHz, 4-core',
                    'speed': 2500,
                },
                {
                    'cores': 4,
                    'family': 'Unknown',
                    'index': 2,
                    'label': 'Proc 2',
                    'model_name': 'CPU Unknown 2500MHz, 4-core',
                    'speed': 2500,
                },
            ],
        )

    def test_get_memory(self):
        self.assertEqual(
            _get_memory(self.ilo),
            [
                {
                    'index': 1,
                    'label': 'DIMM 1A',
                    'size': 4096,
                    'speed': 667,
                },
                {
                    'index': 2,
                    'label': 'DIMM 2B',
                    'size': 4096,
                    'speed': 667,
                },
                {
                    'index': 3,
                    'label': 'DIMM 3C',
                    'size': 4096,
                    'speed': 667,
                },
                {
                    'index': 4,
                    'label': 'DIMM 4D',
                    'size': 4096,
                    'speed': 667,
                },
            ],
        )