コード例 #1
0
    def test_create_server_profile_template_with_connections(
            self, mock_wait4task, mock_post):
        name = 'spt'
        description = 'description'
        sht = '/rest/server-hardware-types/1234'
        eg = '/rest/enclosure-groups/1'
        affinity = 'Bay'
        hide_flex = True
        fw_settings = make_FirmwareSettingsV3(
            '/rest/firmware-drivers/SPP2016020_2015', 'FirmwareOnly', True,
            False)
        connections = make_ProfileConnectionV4(
            1, "eth1", '/rest/ethernet-networks/17f5e012', True, None,
            'Ethernet', None, None, 'Auto', '1000', None, None, None)

        # build the V1 SPT
        spt = make_ServerProfileTemplateV1(name, description, None, sht, eg,
                                           affinity, hide_flex, connections,
                                           fw_settings)

        # build a OV task for the create SPT operation
        task = self.build_spt_add_task_resource()

        # return the task when waiting for completion
        mock_post.return_value = [task, None]

        self.servers.create_server_profile_template(name, description, None,
                                                    sht, eg, affinity,
                                                    hide_flex, connections,
                                                    fw_settings)
        mock_post.assert_called_once_with(uri['profile-templates'], spt)
コード例 #2
0
 def test_create_server_profile_template(self, mock_wait4task, mock_post):        
     name = 'spt'
     description = 'description'
     sht = '/rest/server-hardware-types/1234'
     eg = '/rest/enclosure-groups/1'
     affinity = 'Bay'
     hideFlex = False;
     
     # build the V1 SPT
     spt = make_ServerProfileTemplateV1(name, description, None, sht, eg, affinity, hideFlex, None)
     
     # build a OV task for the create SPT operation
     task = self.build_spt_add_task_resource()  
     
     # return the task when waiting for completion      
     mock_post.return_value = [task, None]
             
     self.servers.create_server_profile_template(name, description, None, sht, eg, affinity, hideFlex, None)
     mock_post.assert_called_once_with(uri['profile-templates'], spt)         
コード例 #3
0
    def test_create_server_profile_template_with_connections(self, mock_wait4task, mock_post):
        name = 'spt'
        description = 'description'
        sht = '/rest/server-hardware-types/1234'
        eg = '/rest/enclosure-groups/1'
        affinity = 'Bay'
        hide_flex = True
        fw_settings = make_FirmwareSettingsV3('/rest/firmware-drivers/SPP2016020_2015', 'FirmwareOnly', True, False)
        connections = make_ProfileConnectionV4(1, "eth1", '/rest/ethernet-networks/17f5e012', True, None, 'Ethernet',
                                               None, None, 'Auto', '1000', None, None, None)

        # build the V1 SPT
        spt = make_ServerProfileTemplateV1(name, description, None, sht, eg, affinity, hide_flex, connections,
                                           fw_settings)

        # build a OV task for the create SPT operation
        task = self.build_spt_add_task_resource()

        # return the task when waiting for completion
        mock_post.return_value = [task, None]

        self.servers.create_server_profile_template(name, description, None, sht, eg, affinity, hide_flex, connections,
                                                    fw_settings)
        mock_post.assert_called_once_with(uri['profile-templates'], spt)
コード例 #4
0
    def create_server_profile_template(self,
                                       name=None,
                                       description=None,
                                       serverProfileDescription=None,
                                       serverHardwareTypeUri=None,
                                       enclosureGroupUri=None,
                                       affinity=None,
                                       hideUnusedFlexNics=None,
                                       profileConnectionV4=None,
                                       firmwareSettingsV3=None,
                                       bootSettings=None,
                                       bootModeSetting=None,
                                       sanStorageV3=None,
                                       blocking=True,
                                       verbose=False):
        """
        Create a ServerProfileTemplateV1 dictionary for use with the V200 API
        Args:
            name:
                Unique name of the Server Profile Template
            description:
                Description of the Server Profile Template
            serverProfileDescription:
                The description of the server profiles created from this template.
            serverHardwareTypeUri:
                Identifies the server hardware type for which the Server Profile
                was designed. The serverHardwareTypeUri is determined when the
                profile is created.
            enclosureGroupUri:
                 Identifies the enclosure group for which the Server Profile Template
                 was designed. The enclosureGroupUri is determined when the profile
                 template is created and cannot be modified.
            affinity:
                This identifies the behavior of the server profile when the server
                hardware is removed or replaced. This can be set to 'Bay' or
                'BayAndServer'.
            hideUnusedFlexNics:
                This setting controls the enumeration of physical functions that do
                not correspond to connections in a profile.
            profileConnectionV4:
                An array of profileConnectionV4
            firmwareSettingsV3:
                FirmwareSettingsV3 dictionary that defines the firmware baseline
                and management.
            bootSettings:
                Dictionary that indicates that the server will attempt to boot from
                this connection. This object can only be specified if
                "boot.manageBoot" is set to 'true'
            bootModeSetting:
                Dictionary that describes the boot mode settings to be configured on
                Gen9 and newer servers.
            sanStorageV3:
                Dictionary that describes the SAN storage settings.

        Returns: dict
        """
        profile_template = make_ServerProfileTemplateV1(
            name, description, serverProfileDescription, serverHardwareTypeUri,
            enclosureGroupUri, affinity, hideUnusedFlexNics,
            profileConnectionV4, firmwareSettingsV3, bootSettings,
            bootModeSetting, sanStorageV3)

        task, body = self._con.post(uri['profile-templates'], profile_template)
        tout = 600
        if blocking is True:
            task = self._activity.wait4task(task, tout, verbose=verbose)
            if 'type' in task and task['type'].startswith('Task'):
                entity = self._activity.get_task_associated_resource(task)
                profile_template = self._con.get(entity['resourceUri'])
                return profile_template
        return task
コード例 #5
0
    def create_server_profile_template(self, name=None, description=None,
                                       serverProfileDescription=None, serverHardwareTypeUri=None,
                                       enclosureGroupUri=None, affinity=None, hideUnusedFlexNics=None,
                                       profileConnectionV4=None, firmwareSettingsV3=None, bootSettings=None,
                                       bootModeSetting=None, sanStorageV3=None, blocking=True, verbose=False):
        """
        Create a ServerProfileTemplateV1 dictionary for use with the V200 API
        Args:
            name:
                Unique name of the Server Profile Template
            description:
                Description of the Server Profile Template
            serverProfileDescription:
                The description of the server profiles created from this template.
            serverHardwareTypeUri:
                Identifies the server hardware type for which the Server Profile
                was designed. The serverHardwareTypeUri is determined when the
                profile is created.
            enclosureGroupUri:
                 Identifies the enclosure group for which the Server Profile Template
                 was designed. The enclosureGroupUri is determined when the profile
                 template is created and cannot be modified.
            affinity:
                This identifies the behavior of the server profile when the server
                hardware is removed or replaced. This can be set to 'Bay' or
                'BayAndServer'.
            hideUnusedFlexNics:
                This setting controls the enumeration of physical functions that do
                not correspond to connections in a profile.
            profileConnectionV4:
                An array of profileConnectionV4
            firmwareSettingsV3:
                FirmwareSettingsV3 dictionary that defines the firmware baseline
                and management.
            bootSettings:
                Dictionary that indicates that the server will attempt to boot from
                this connection. This object can only be specified if
                "boot.manageBoot" is set to 'true'
            bootModeSetting:
                Dictionary that describes the boot mode settings to be configured on
                Gen9 and newer servers.
            sanStorageV3:
                Dictionary that describes the SAN storage settings.

        Returns: dict
        """
        profile_template = make_ServerProfileTemplateV1(name,
                                                        description,
                                                        serverProfileDescription,
                                                        serverHardwareTypeUri,
                                                        enclosureGroupUri,
                                                        affinity,
                                                        hideUnusedFlexNics,
                                                        profileConnectionV4,
                                                        firmwareSettingsV3,
                                                        bootSettings,
                                                        bootModeSetting,
                                                        sanStorageV3)

        task, body = self._con.post(uri['profile-templates'], profile_template)
        tout = 600
        if blocking is True:
            task = self._activity.wait4task(task, tout, verbose=verbose)
            if 'type' in task and task['type'].startswith('Task'):
                entity = self._activity.get_task_associated_resource(task)
                profile_template = self._con.get(entity['resourceUri'])
                return profile_template
        return task