Skip to main content

Aggregate Interface Models

Overview

The Aggregate Interface models provide structured validation for aggregate (bonded) ethernet interface configuration. These models support Layer 2 and Layer 3 modes with LACP (Link Aggregation Control Protocol) configuration.

Models

  • AggregateInterfaceCreateModel: For creating new aggregate interfaces
  • AggregateInterfaceUpdateModel: For updating existing interfaces (includes id)
  • AggregateInterfaceResponseModel: Response model from API operations
  • AggregateLayer2: Layer 2 mode configuration
  • AggregateLayer3: Layer 3 mode configuration

All models use extra="forbid" to reject undefined fields.

Model Attributes

AggregateInterfaceBaseModel

AttributeTypeRequiredDefaultDescription
namestrYesNoneInterface name (e.g., "ae1")
commentstrNoNoneDescription (max 1023 chars)
layer2AggregateLayer2No*NoneLayer 2 mode configuration
layer3AggregateLayer3No*NoneLayer 3 mode configuration
folderstrNo**NoneFolder container
snippetstrNo**NoneSnippet container
devicestrNo**NoneDevice container

* Only one mode can be configured (oneOf validation) ** Exactly one container required for create operations

AggregateLayer2

AttributeTypeRequiredDefaultDescription
vlan_tagstrNoNoneVLAN tag (1-4096)
lacpLacpConfigNoNoneLACP configuration

AggregateLayer3

AttributeTypeRequiredDefaultDescription
ipList[StaticIp]No*NoneStatic IP addresses
dhcp_clientDhcpClientNo*NoneDHCP client configuration
mtuintNo1500MTU (576-9216)
interface_management_profilestrNoNoneManagement profile
arpList[ArpEntry]NoNoneStatic ARP entries
ddns_configDdnsConfigNoNoneDynamic DNS config
lacpLacpConfigNoNoneLACP configuration

* Only one IP mode can be configured (oneOf validation)

LacpConfig

AttributeTypeDefaultDescription
enableboolFalseEnable LACP
fast_failoverboolFalseEnable fast failover
modestr"passive"LACP mode (passive/active)
transmission_ratestr"slow"Rate (fast/slow)
system_priorityint32768System priority (1-65535)
max_portsint8Max ports (1-8)

Model Validators

Interface Mode Validation

Ensures only one of layer2 or layer3 is configured:

@model_validator(mode="after")
def validate_interface_mode(self) -> "AggregateInterfaceBaseModel":
modes = [self.layer2, self.layer3]
configured = [m for m in modes if m is not None]
if len(configured) > 1:
raise ValueError("Only one interface mode allowed: layer2 or layer3")
return self

Usage Examples

Layer 3 with LACP

from scm.models.network import AggregateInterfaceCreateModel

interface = AggregateInterfaceCreateModel(
name="ae1",
layer3={
"ip": [{"name": "10.0.0.1/24"}],
"mtu": 9000,
"lacp": {
"enable": True,
"mode": "active",
"fast_failover": True
}
},
folder="Interfaces"
)
payload = interface.model_dump(exclude_unset=True)

Layer 2 with VLAN

interface = AggregateInterfaceCreateModel(
name="ae2",
layer2={
"vlan_tag": "100",
"lacp": {"enable": True, "mode": "passive"}
},
folder="Interfaces"
)