MACAddress model and friends.


BulkManager() A Manager which loads objects from the cache if it’s populated.
CleanSave Mixin for model classes.
DefaultMeta Base class for model Meta classes in the maasserver app.
ForeignKey(to[, to_field, rel_class, ...])
IPADDRESS_TYPE The vocabulary of possible types of StaticIPAddress.
MAC(value) A MAC address represented as a database value.
MACAddress(*args, **kwargs) A MACAddress represents a MAC address attached to a Node.
MACAddressField([verbose_name, name, ...]) Model field type: MAC address.
ManyToManyField(to[, db_constraint])
TimestampedModel(*args, **kwargs) Abstract base model with creation/update timestamps.


StaticIPAddressTypeClash Raised when trying to allocate an IP for a MAC where one of another type already exists.
class maasserver.models.macaddress.MACAddress(*args, **kwargs)[source]

Bases: maasserver.models.cleansave.CleanSave, maasserver.models.timestampedmodel.TimestampedModel

A MACAddress represents a MAC address attached to a Node.

  • mac_address – The MAC address.
  • node – The Node related to this MACAddress.
  • networks – The networks related to this MACAddress.

Return networks to which this MAC is connected, sorted by name.


Assign a static IP to this MAC.

It is the caller’s responsibility to create a celery Task that will write the dhcp host. It is not done here because celery doesn’t guarantee job ordering, and if the host entry is written after the host boots it is too late.

Parameters:alloc_type – See StaticIPAddress.alloc_type. This parameter musn’t be IPADDRESS_TYPE.USER_RESERVED.
Returns:A StaticIPAddress object. Returns None if the cluster_interface is not yet known, or the static_ip_range_low/high values values are not set on the cluster_interface. If an IP already exists for this type, it is always returned with no further allocation.
Raises:StaticIPAddressExhaustion if there are not enough IPs left.
Raises:StaticIPAddressTypeClash if an IP already exists with a different type.
MAAS logo


Metal As A Service.

Related Topics

This Page