Exemplo n.º 1
0
    def test_list_multi_idrac_settings_by_name(self, mock_requests,
                                               mock_wait_until_idrac_is_ready):
        expected_enum_attr = idrac_card.iDRACCardEnumerableAttribute(
            name='Type',
            instance_id='iDRAC.Embedded.2#Info.1#Type',
            read_only=True,
            current_value='13G Monolithic',
            pending_value=None,
            fqdd='iDRAC.Embedded.2',
            group_id='Info.1',
            possible_values=[
                '12G/13G', '12G Monolithic', '12G Modular', '13G Monolithic',
                '13G Modular', '12G DCS', '13G DCS'
            ])
        mock_requests.post('https://1.2.3.4:443/wsman', [{
            'text':
            test_utils.iDracCardEnumerations[uris.DCIM_iDRACCardEnumeration]
            ['ok']
        }, {
            'text':
            test_utils.iDracCardEnumerations[uris.DCIM_iDRACCardString]['ok']
        }, {
            'text':
            test_utils.iDracCardEnumerations[uris.DCIM_iDRACCardInteger]['ok']
        }])

        idrac_settings = self.drac_client.list_idrac_settings(
            by_name=True, fqdd_filter='iDRAC.Embedded.2')

        self.assertEqual(1, len(idrac_settings))

        # enumerable attribute
        self.assertIn('Info.1#Type', idrac_settings)
        self.assertEqual(expected_enum_attr, idrac_settings['Info.1#Type'])
Exemplo n.º 2
0
    def test_list_idrac_settings_by_name(self, mock_requests,
                                         mock_wait_until_idrac_is_ready):
        expected_enum_attr = idrac_card.iDRACCardEnumerableAttribute(
            name='Type',
            instance_id='iDRAC.Embedded.1#Info.1#Type',
            read_only=True,
            current_value='13G Monolithic',
            pending_value=None,
            fqdd='iDRAC.Embedded.1',
            group_id='Info.1',
            possible_values=[
                '12G/13G', '12G Monolithic', '12G Modular', '13G Monolithic',
                '13G Modular', '12G DCS', '13G DCS'
            ])
        expected_string_attr = idrac_card.iDRACCardStringAttribute(
            name='Version',
            instance_id='iDRAC.Embedded.1#Info.1#Version',
            read_only=True,
            current_value='2.40.40.40',
            pending_value=None,
            fqdd='iDRAC.Embedded.1',
            group_id='Info.1',
            min_length=0,
            max_length=63)
        expected_integer_attr = idrac_card.iDRACCardIntegerAttribute(
            name='Port',
            instance_id='iDRAC.Embedded.1#SSH.1#Port',
            read_only=False,
            current_value=22,
            pending_value=None,
            fqdd='iDRAC.Embedded.1',
            group_id='SSH.1',
            lower_bound=1,
            upper_bound=65535)
        mock_requests.post('https://1.2.3.4:443/wsman', [{
            'text':
            test_utils.iDracCardEnumerations[uris.DCIM_iDRACCardEnumeration]
            ['ok']
        }, {
            'text':
            test_utils.iDracCardEnumerations[uris.DCIM_iDRACCardString]['ok']
        }, {
            'text':
            test_utils.iDracCardEnumerations[uris.DCIM_iDRACCardInteger]['ok']
        }])

        idrac_settings = self.drac_client.list_idrac_settings(by_name=True)

        self.assertEqual(630, len(idrac_settings))

        # enumerable attribute
        self.assertIn('Info.1#Type', idrac_settings)
        self.assertEqual(expected_enum_attr, idrac_settings['Info.1#Type'])
        # string attribute
        self.assertIn('Info.1#Version', idrac_settings)
        self.assertEqual(expected_string_attr,
                         idrac_settings['Info.1#Version'])
        # integer attribute
        self.assertIn('SSH.1#Port', idrac_settings)
        self.assertEqual(expected_integer_attr, idrac_settings['SSH.1#Port'])