Ejemplo n.º 1
0
    def vif_list(self, task):
        """List attached VIF IDs for a node

        :param task: A TaskManager instance.
        :returns: List of VIF dictionaries, each dictionary will have an 'id'
            entry with the ID of the VIF.
        """
        default_impl = net_common.VIFPortIDMixin()
        if not self._deprecated_vif_list_shown:
            self.__class__._deprecated_vif_list_shown = True
            LOG.warning(
                _LW('The network interface %s should be updated to '
                    'implement the vif_list function. Falling '
                    'back to default implementation, this behaviour '
                    'will be removed in Pike'), self.__class__.__name__)
        return default_impl.vif_list(task)
Ejemplo n.º 2
0
    def vif_detach(self, task, vif_id):
        """Detach a virtual network interface from a node

        :param task: A TaskManager instance.
        :param vif_id: A VIF ID to detach
        :raises: NetworkError, VifNotAttached
        """
        default_impl = net_common.VIFPortIDMixin()
        if not self._deprecated_vif_detach_shown:
            self.__class__._deprecated_vif_detach_shown = True
            LOG.warning(
                _LW('The network interface %s should be updated to '
                    'implement the vif_detach function. Falling '
                    'back to default implementation, this behaviour '
                    'will be removed in Pike'), self.__class__.__name__)
        return default_impl.vif_detach(task, vif_id)
Ejemplo n.º 3
0
    def port_changed(self, task, port_obj):
        """Handle any actions required when a port changes

        :param task: a TaskManager instance.
        :param port_obj: a changed Port object.
        :raises: Conflict, FailedToUpdateDHCPOptOnPort
        """
        default_impl = net_common.VIFPortIDMixin()
        if not self._deprecated_port_change_shown:
            self.__class__._deprecated_port_change_shown = True
            LOG.warning(
                _LW('The network interface %s should be updated to '
                    'implement the port_changed function. Falling '
                    'back to default implementation, this behaviour '
                    'will be removed in Pike'), self.__class__.__name__)
        return default_impl.port_changed(task, port_obj)
Ejemplo n.º 4
0
    def vif_attach(self, task, vif_info):
        """Attach a virtual network interface to a node

        :param task: A TaskManager instance.
        :param vif_info: a dictionary of information about a VIF.
            It must have an 'id' key, whose value is a unique identifier
            for that VIF.
        :raises: NetworkError, VifAlreadyAttached, NoFreePhysicalPorts
        """
        default_impl = net_common.VIFPortIDMixin()
        if not self._deprecated_vif_attach_shown:
            self.__class__._deprecated_vif_attach_shown = True
            LOG.warning(
                _LW('The network interface %s should be updated to '
                    'implement the vif_attach function. Falling '
                    'back to default implementation, this behaviour '
                    'will be removed in Pike'), self.__class__.__name__)
        return default_impl.vif_attach(task, vif_info)
Ejemplo n.º 5
0
 def setUp(self):
     super(TestVifPortIDMixin, self).setUp()
     self.config(enabled_drivers=['fake'])
     mgr_utils.mock_the_extension_manager()
     self.interface = common.VIFPortIDMixin()
     self.node = obj_utils.create_test_node(self.context,
                                            network_interface='neutron')
     self.port = obj_utils.create_test_port(self.context,
                                            node_id=self.node.id,
                                            address='52:54:00:cf:2d:32',
                                            extra={
                                                'vif_port_id':
                                                uuidutils.generate_uuid(),
                                                'client-id':
                                                'fake1'
                                            })
     self.neutron_port = {
         'id': '132f871f-eaec-4fed-9475-0d54465e0f00',
         'mac_address': '52:54:00:cf:2d:32'
     }
Ejemplo n.º 6
0
    def get_current_vif(self, task, p_obj):
        """Returns the currently used VIF associated with port or portgroup

        We are booting the node only in one network at a time, and presence of
        cleaning_vif_port_id means we're doing cleaning, of
        provisioning_vif_port_id - provisioning.
        Otherwise it's a tenant network.

        :param task: A TaskManager instance.
        :param p_obj: Ironic port or portgroup object.
        :returns: VIF ID associated with p_obj or None.
        """
        default_impl = net_common.VIFPortIDMixin()
        if not self._deprecated_get_current_vif_shown:
            self.__class__._deprecated_get_current_vif_shown = True
            LOG.warning(
                _LW('The network interface %s should be updated to '
                    'implement the get_current_vif function. Falling '
                    'back to default implementation, this behaviour '
                    'will be removed in Pike'), self.__class__.__name__)
        return default_impl.get_current_vif(task, p_obj)