Example #1
0
    def test_server_create_options_with_cpu_only(self, packages):
        args = {
            '<chassis_id>': '999',
            '--all': False,
            '--datacenter': False,
            '--cpu': True,
            '--nic': False,
            '--disk': False,
            '--os': False,
            '--memory': False,
            '--controller': False,
        }

        test_data = [
            (999, 'Chassis 999'),
        ]
        packages.return_value = test_data

        runnable = server.ServerCreateOptions(client=self.client)

        output = runnable.execute(args)

        expected = {
            'cpu': [{
                'Description': 'Dual Quad Core Pancake 200 - 1.60GHz',
                'ID': 723
            }, {
                'Description': 'Dual Quad Core Pancake 200 - 1.80GHz',
                'ID': 724
            }],
        }

        self.assertEqual(expected, formatting.format_output(output, 'python'))
Example #2
0
    def test_server_create_options_for_bmc(self, bmpi, packages):
        args = {
            '<chassis_id>': '1099',
            '--all': True,
            '--datacenter': False,
            '--cpu': False,
            '--nic': False,
            '--disk': False,
            '--os': False,
            '--memory': False,
            '--controller': False,
        }

        test_data = [
            (1099, 'Bare Metal Instance'),
        ]
        packages.return_value = test_data

        bmpi.return_value = '1099'

        runnable = server.ServerCreateOptions(client=self.client)

        output = runnable.execute(args)

        expected = {
            'memory/cpu': [
                {
                    'cpu': ['2'],
                    'memory': '2'
                },
                {
                    'cpu': ['2', '4'],
                    'memory': '4'
                },
            ],
            'datacenter': ['RANDOM_LOCATION'],
            'disk': ['250_SATA_II', '500_SATA_II'],
            'dual nic': ['1000_DUAL', '100_DUAL', '10_DUAL'],
            'os (CENTOS)': ['CENTOS_6_64_LAMP', 'CENTOS_6_64_MINIMAL'],
            'os (REDHAT)': ['REDHAT_6_64_LAMP', 'REDHAT_6_64_MINIMAL'],
            'os (UBUNTU)': ['UBUNTU_12_64_LAMP', 'UBUNTU_12_64_MINIMAL'],
            'os (WIN)': [
                'WIN_2008-DC_64', 'WIN_2008-ENT_64', 'WIN_2008-STD-R2_64',
                'WIN_2008-STD_64', 'WIN_2012-DC-HYPERV_64'
            ],
            'single nic': ['100', '1000']
        }

        self.assertEqual(expected, formatting.format_output(output, 'python'))
Example #3
0
    def test_server_create_options(self, packages):
        args = {
            '<chassis_id>': '999',
            '--all': True,
            '--datacenter': False,
            '--cpu': False,
            '--nic': False,
            '--disk': False,
            '--os': False,
            '--memory': False,
            '--controller': False,
        }

        test_data = [
            (999, 'Chassis 999'),
        ]
        packages.return_value = test_data

        runnable = server.ServerCreateOptions(client=self.client)

        output = runnable.execute(args)

        expected = {
            'cpu': [{
                'Description': 'Dual Quad Core Pancake 200 - 1.60GHz',
                'ID': 723
            }, {
                'Description': 'Dual Quad Core Pancake 200 - 1.80GHz',
                'ID': 724
            }],
            'datacenter': ['RANDOM_LOCATION'],
            'disk': ['250_SATA_II', '500_SATA_II'],
            'disk_controllers': ['None', 'RAID0'],
            'dual nic': ['1000_DUAL', '100_DUAL', '10_DUAL'],
            'memory': [4, 6],
            'os (CENTOS)': ['CENTOS_6_64_LAMP', 'CENTOS_6_64_MINIMAL'],
            'os (REDHAT)': ['REDHAT_6_64_LAMP', 'REDHAT_6_64_MINIMAL'],
            'os (UBUNTU)': ['UBUNTU_12_64_LAMP', 'UBUNTU_12_64_MINIMAL'],
            'os (WIN)': [
                'WIN_2008-DC_64', 'WIN_2008-ENT_64', 'WIN_2008-STD-R2_64',
                'WIN_2008-STD_64', 'WIN_2012-DC-HYPERV_64'
            ],
            'single nic': ['100', '1000']
        }

        self.assertEqual(expected, formatting.format_output(output, 'python'))
Example #4
0
    def test_server_create_options_with_invalid_chassis(self, packages):
        args = {
            '<chassis_id>': '999',
            '--all': True,
            '--datacenter': False,
            '--cpu': False,
            '--nic': False,
            '--disk': False,
            '--os': False,
            '--memory': False,
            '--controller': False,
        }

        test_data = [
            (998, 'Legacy Chassis'),
        ]
        packages.return_value = test_data

        runnable = server.ServerCreateOptions(client=self.client)

        self.assertRaises(exceptions.CLIAbort, runnable.execute, args)