def create_cleaning_ports(self, task):
    "Create neutron ports for each port on task.node to boot the ramdisk.\n\n        :param task: a TaskManager instance.\n        :raises: InvalidParameterValue if the cleaning network is None\n        :returns: a dictionary in the form {port.uuid: neutron_port['id']}\n        "
    if (not CONF.neutron.cleaning_network_uuid):
        raise exception.InvalidParameterValue(_('Valid cleaning network UUID not provided'))
    neutron_client = _build_client(task.context.auth_token)
    body = {'port': {'network_id': CONF.neutron.cleaning_network_uuid, 'admin_state_up': True}}
    ports = {}
    for ironic_port in task.ports:
        body['port']['mac_address'] = ironic_port.address
        try:
            port = neutron_client.create_port(body)
        except neutron_client_exc.ConnectionFailed as e:
            self._rollback_cleaning_ports(task)
            msg = (_('Could not create cleaning port on network %(net)s from %(node)s. %(exc)s') % {'net': CONF.neutron.cleaning_network_uuid, 'node': task.node.uuid, 'exc': e})
            LOG.exception(msg)
            raise exception.NodeCleaningFailure(msg)
        if ((not port.get('port')) or (not port['port'].get('id'))):
            self._rollback_cleaning_ports(task)
            msg = (_('Failed to create cleaning ports for node %(node)s') % task.node.uuid)
            LOG.error(msg)
            raise exception.NodeCleaningFailure(msg)
        ports[ironic_port.uuid] = port['port']['id']
    return ports
Create neutron ports for each port on task.node to boot the ramdisk.

:param task: a TaskManager instance.
:raises: InvalidParameterValue if the cleaning network is None
:returns: a dictionary in the form {port.uuid: neutron_port['id']}
def create_cleaning_ports(self, task):
    "Create neutron ports for each port on task.node to boot the ramdisk.\n\n        :param task: a TaskManager instance.\n        :raises: InvalidParameterValue if the cleaning network is None\n        :returns: a dictionary in the form {port.uuid: neutron_port['id']}\n        "
    if (not CONF.neutron.cleaning_network_uuid):
        raise exception.InvalidParameterValue(_('Valid cleaning network UUID not provided'))
    neutron_client = _build_client(task.context.auth_token)
    body = {'port': {'network_id': CONF.neutron.cleaning_network_uuid, 'admin_state_up': True}}
    ports = {}
    for ironic_port in task.ports:
        body['port']['mac_address'] = ironic_port.address
        try:
            port = neutron_client.create_port(body)
        except neutron_client_exc.ConnectionFailed as e:
            self._rollback_cleaning_ports(task)
            msg = (_('Could not create cleaning port on network %(net)s from %(node)s. %(exc)s') % {'net': CONF.neutron.cleaning_network_uuid, 'node': task.node.uuid, 'exc': e})
            LOG.exception(msg)
            raise exception.NodeCleaningFailure(msg)
        if ((not port.get('port')) or (not port['port'].get('id'))):
            self._rollback_cleaning_ports(task)
            msg = (_('Failed to create cleaning ports for node %(node)s') % task.node.uuid)
            LOG.error(msg)
            raise exception.NodeCleaningFailure(msg)
        ports[ironic_port.uuid] = port['port']['id']
    return ports