class VIFPortProfileOVSRepresentor(VIFPortProfileOpenVSwitch): """Port profile info for OpenVSwitch networks using a representor. This class is now frozen and retained for backwards compatibility. The ``datapath_offload`` field in port profiles should be used instead. """ # Version 1.0: Initial release # Version 1.1: VIFPortProfileOpenVSwitch updated to 1.1 from 1.0 # Version 1.2: VIFPortProfileOpenVSwitch updated to 1.2 from 1.1 # Version 1.3: VIFPortProfileOpenVSwitch updated to 1.3 from 1.2 VERSION = '1.3' fields = { #: Name to set on the representor (if set). 'representor_name': fields.StringField(nullable=True), #: The PCI address of the Virtual Function. 'representor_address': fields.PCIAddressField(nullable=True), } def obj_make_compatible(self, primitive, target_version): target_version = versionutils.convert_version_to_tuple(target_version) if target_version < (1, 1): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.0') elif target_version < (1, 2): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.1') elif target_version < (1, 3): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.2') else: super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.3')
class VIFHostDevice(VIFBase): """A hostdev-style VIF. Hostdev-style VIFs provide a guest with direct access to an SR-IOV Virtual Function (VF). Contrast this with :class:`~ovs_vif.objects.vif.VIFDirect`, which includes a software layer between the VF and the guest. For libvirt drivers, this maps to type='hostdev' """ # Version 1.0: Initial release VERSION = '1.0' fields = { #: The type of the host device. #: #: Valid values are ``ethernet`` and ``generic``. #: #: - ``ethernet`` is ``<interface type='hostdev'>`` #: - ``generic`` is ``<hostdev mode='subsystem' type='pci'>`` 'dev_type': osv_fields.VIFHostDeviceDevTypeField(), #: The PCI address of the host device. 'dev_address': fields.PCIAddressField(), }
class VIFDirect(VIFBase): """A direct-style VIF. Despite the confusing name, direct-style VIFs utilize macvtap which is a device driver that inserts a software layer between a guest and an SR-IOV Virtual Function (VF). Contrast this with :class:`~os_vif.objects.vif.VIFHostDevice`, which allows the guest to directly connect to the VF. For libvirt drivers, this maps to type='direct' """ # Version 1.0: Initial release VERSION = '1.0' fields = { #: Name of the device to create. 'vif_name': fields.StringField(), #: The PCI address of the host device. 'dev_address': fields.PCIAddressField(), #: Port connection mode. 'mode': osv_fields.VIFDirectModeField(), #: The VLAN device name to use. 'vlan_name': fields.StringField(), }
class VIFHostDevice(VIFBase): # For libvirt drivers, this maps to type='hostdev' VERSION = '1.0' fields = { # The type of the host device. # Valid values are ethernet and generic. # Ethernet is <interface type='hostdev'> # Generic is <hostdev mode='subsystem' type='pci'> 'dev_type': osv_fields.VIFHostDeviceDevTypeField(), # The PCI address of the host device 'dev_address': fields.PCIAddressField(), }
class VIFPortProfileOVSRepresentor(VIFPortProfileOpenVSwitch): """Port profile info for OpenVSwitch networks using a representor. This profile provides the metadata required to associate a VIF with a :term:`VF` representor and :term:`Open vSwitch` port. If `representor_name` is specified, it indicates a desire to rename the representor to the given name on plugging. .. note:: This port profile is provided for backwards compatibility only. This interface has been superceded by the one provided by the :class:`DatapathOffloadRepresentor` class, which is now a field element of the :class:`VIFPortProfileBase` class. The ``datapath_offload`` field in port profiles should be used instead. """ # Version 1.0: Initial release # Version 1.1: VIFPortProfileOpenVSwitch updated to 1.1 from 1.0 # Version 1.2: VIFPortProfileOpenVSwitch updated to 1.2 from 1.1 # Version 1.3: VIFPortProfileOpenVSwitch updated to 1.3 from 1.2 VERSION = '1.3' fields = { #: Name to set on the representor (if set). 'representor_name': fields.StringField(nullable=True), #: The PCI address of the Virtual Function. 'representor_address': fields.PCIAddressField(nullable=True), } def obj_make_compatible(self, primitive, target_version): target_version = versionutils.convert_version_to_tuple(target_version) if target_version < (1, 1): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.0') elif target_version < (1, 2): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.1') elif target_version < (1, 3): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.2') else: super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, '1.3')
class VIFDirect(VIFBase): # For libvirt drivers, this maps to type='direct' VERSION = '1.0' fields = { # Name of the device to create 'vif_name': fields.StringField(), # The PCI address of the host device 'dev_address': fields.PCIAddressField(), # Port connection mode 'mode': osv_fields.VIFDirectModeField(), # The VLAN device name to use 'vlan_name': fields.StringField(), }
def setUp(self): super(TestPCIAddress, self).setUp() self.field = fields.PCIAddressField() self.coerce_good_values = [ ('0000:02:00.0', '0000:02:00.0'), ('FFFF:FF:1F.7', 'ffff:ff:1f.7'), ('fFfF:fF:1F.7', 'ffff:ff:1f.7'), ] self.coerce_bad_values = [ '000:02:00.0', # Too short '00000:02:00.0', # Too long 'FFFF:FF:2F.7', # Bad slot 'FFFF:GF:1F.7', # Bad octal 1123123, # Number {}, # dict ] self.to_primitive_values = self.coerce_good_values[0:1] self.from_primitive_values = self.coerce_good_values[0:1]
class VIFPortProfileOVSRepresentor(VIFPortProfileOpenVSwitch): # Port profile info for OpenVSwitch networks using a representor # Version 1.0: Initial release # Version 1.1: VIFPortProfileOpenVSwitch updated to 1.1 VERSION = '1.1' fields = { # Name to set on the representor (if set) 'representor_name': fields.StringField(nullable=True), # The PCI address of the Virtual Function 'representor_address': fields.PCIAddressField(nullable=True), } def obj_make_compatible(self, primitive, target_version): target_version = versionutils.convert_version_to_tuple(target_version) if target_version < (1, 1): super(VIFPortProfileOVSRepresentor, self).obj_make_compatible(primitive, "1.0")
class VIFDirect(VIFBase): """A direct-style VIF. Despite the confusing name, direct-style VIFs utilize macvtap which is a device driver that inserts a software layer between a guest and an SR-IOV Virtual Function (VF). Contrast this with :class:`~os_vif.objects.vif.VIFHostDevice`, which allows the guest to directly connect to the VF. The connection to the device may operate in one of a number of different modes, :term:`VEPA` (either :term:`802.1Qbg` or :term:`802.1Qbh`), passthrough (exclusive assignment of the host NIC) or bridge (ethernet layer bridging of traffic). The passthrough mode would be used when there is a network device which needs to have a MAC address or VLAN configuration. For passthrough of network devices without MAC/VLAN configuration, :class:`~os_vif.objects.vif.VIFHostDevice` should be used instead. For libvirt drivers, this maps to type='direct' """ # Version 1.0: Initial release VERSION = '1.0' fields = { #: Name of the device to create. 'vif_name': fields.StringField(), #: The PCI address of the host device. 'dev_address': fields.PCIAddressField(), #: Port connection mode. 'mode': osv_fields.VIFDirectModeField(), #: The VLAN device name to use. 'vlan_name': fields.StringField(), }