Skip to main content

VLAN Interface Models

Overview

The VLAN Interface models provide structured validation for VLAN interface configuration. VLAN interfaces are Layer 3 interfaces for inter-VLAN routing, supporting static IP or DHCP addressing with ARP and DDNS configuration.

Models

  • VlanInterfaceCreateModel: For creating new VLAN interfaces
  • VlanInterfaceUpdateModel: For updating existing interfaces (includes id)
  • VlanInterfaceResponseModel: Response model from API operations

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

Model Attributes

VlanInterfaceBaseModel

AttributeTypeRequiredDefaultDescription
namestrYesNoneInterface name (e.g., "vlan.100")
vlan_tagstrNoNoneVLAN tag (1-4096)
commentstrNoNoneDescription (max 1023 chars)
ipList[StaticIpEntry]No*NoneStatic IP addresses
dhcp_clientDhcpClientNo*NoneDHCP client configuration
mtuintNo1500MTU (576-9216)
interface_management_profilestrNoNoneManagement profile (max 31 chars)
arpList[ArpEntryWithInterface]NoNoneStatic ARP entries
ddns_configDdnsConfigNoNoneDynamic DNS configuration
folderstrNo**NoneFolder container
snippetstrNo**NoneSnippet container
devicestrNo**NoneDevice container

* Only one IP mode (static or DHCP) can be configured ** Exactly one container required for create operations

ArpEntryWithInterface

AttributeTypeRequiredDescription
namestrYesIP address
hw_addressstrNoMAC address
interfacestrNoAssociated interface

Model Validators

IP Mode Validation

Ensures only one of ip or dhcp_client is configured:

@model_validator(mode="after")
def validate_ip_mode(self) -> "VlanInterfaceBaseModel":
if self.ip and self.dhcp_client:
raise ValueError("Only one IP addressing mode allowed")
return self

Usage Examples

Static IP

from scm.models.network import VlanInterfaceCreateModel

vlan = VlanInterfaceCreateModel(
name="vlan.100",
vlan_tag="100",
ip=[{"name": "10.100.0.1/24"}],
mtu=1500,
arp=[
{"name": "10.100.0.10", "hw_address": "00:11:22:33:44:55", "interface": "ethernet1/1"}
],
folder="Interfaces"
)
payload = vlan.model_dump(exclude_unset=True)

DHCP with DDNS

vlan = VlanInterfaceCreateModel(
name="vlan.200",
vlan_tag="200",
dhcp_client={
"enable": True,
"create_default_route": False
},
ddns_config={
"ddns_enabled": True,
"ddns_vendor": "dyndns",
"ddns_hostname": "vlan200.example.com"
},
folder="Interfaces"
)