Exemple #1
0
class VIFBase(osv_base.VersionedObject, base.ComparableVersionedObject):
    """Represents a virtual network interface."""
    # Version 1.0: Initial version
    VERSION = '1.0'

    fields = {
        # Unique identifier of the VIF port
        'id': fields.UUIDField(),

        # The guest MAC address
        'address': fields.MACAddressField(nullable=True),

        # The network to which the VIF is connected
        'network': fields.ObjectField('Network', nullable=True),

        # Name of the registered os_vif plugin
        'plugin': fields.StringField(),

        # Whether the VIF is initially online
        'active': fields.BooleanField(default=True),

        # Whether the host VIF should be preserved on unplug
        'preserve_on_delete': fields.BooleanField(default=False),

        # Whether the network service has provided traffic filtering
        'has_traffic_filtering': fields.BooleanField(default=False),

        # The virtual port profile metadata
        'port_profile': fields.ObjectField('VIFPortProfileBase',
                                           subclasses=True)
    }
Exemple #2
0
class VIFPortProfileFPTap(VIFPortProfileBase):
    # Port profile info for Calico networks using fastpath

    VERSION = '1.0'

    fields = {
        # The mac address of the host vhostuser port
        'mac_address': fields.MACAddressField(nullable=True),
    }
 def setUp(self):
     super(TestMACAddress, self).setUp()
     self.field = fields.MACAddressField()
     self.coerce_good_values = [
         ('c6:df:11:a5:c8:5d', 'c6:df:11:a5:c8:5d'),
         ('C6:DF:11:A5:C8:5D', 'c6:df:11:a5:c8:5d'),
         ('c6:df:11:a5:c8:5d', 'c6:df:11:a5:c8:5d'),
         ('C6:DF:11:A5:C8:5D', 'c6:df:11:a5:c8:5d'),
     ]
     self.coerce_bad_values = [
         'C6:DF:11:A5:C8',  # Too short
         'C6:DF:11:A5:C8:5D:D7',  # Too long
         'C6:DF:11:A5:C8:KD',  # Bad octal
     ]
     self.to_primitive_values = self.coerce_good_values[0:1]
     self.from_primitive_values = self.coerce_good_values[0:1]
Exemple #4
0
class VIFPortProfileFPTap(VIFPortProfileBase):
    """Port profile info for Calico networks using fastpath."""

    # Version 1.0: Initial release
    # Version 1.1: VIFPortProfileBase updated to 1.1 from 1.0
    VERSION = '1.1'

    fields = {
        #: The MAC address of the host vhostuser port.
        'mac_address': fields.MACAddressField(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(VIFPortProfileFPTap,
                  self).obj_make_compatible(primitive, '1.0')
        else:
            super(VIFPortProfileFPTap,
                  self).obj_make_compatible(primitive, '1.1')
Exemple #5
0
class VIFBase(osv_base.VersionedObject, base.ComparableVersionedObject):
    """Represents a virtual network interface.

    The base VIF defines fields that are common to all types of VIF and
    provides an association to the network the VIF is plugged into. It should
    not be instantiated itself - use a subclass instead.
    """

    # Version 1.0: Initial release
    VERSION = '1.0'

    fields = {
        #: Unique identifier of the VIF port.
        'id': fields.UUIDField(),

        #: The guest MAC address.
        'address': fields.MACAddressField(nullable=True),

        #: The network to which the VIF is connected.
        'network': fields.ObjectField('Network', nullable=True),

        #: Name of the registered os_vif plugin.
        'plugin': fields.StringField(),

        #: Whether the VIF is initially online.
        'active': fields.BooleanField(default=True),

        #: Whether the host VIF should be preserved on unplug.
        'preserve_on_delete': fields.BooleanField(default=False),

        #: Whether the network service has provided traffic filtering.
        'has_traffic_filtering': fields.BooleanField(default=False),

        #: The virtual port profile metadata.
        'port_profile': fields.ObjectField('VIFPortProfileBase',
                                           subclasses=True)
    }