Skip to main content

Tunnel Interface Models

Overview

The Tunnel Interface models provide structured validation for tunnel interface configuration. Tunnel interfaces are used for VPN tunnels (IPsec, GRE) and other encapsulated traffic.

Models

  • TunnelInterfaceCreateModel: For creating new tunnel interfaces
  • TunnelInterfaceUpdateModel: For updating existing interfaces (includes id)
  • TunnelInterfaceResponseModel: Response model from API operations

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

Model Attributes

TunnelInterfaceBaseModel

AttributeTypeRequiredDefaultDescription
namestrYesNoneInterface name (e.g., "tunnel.1")
commentstrNoNoneDescription (max 1023 chars)
ipList[str]NoNoneIPv4 addresses
mtuintNo1500MTU (576-9216)
interface_management_profilestrNoNoneManagement profile (max 31 chars)
folderstrNo*NoneFolder container
snippetstrNo*NoneSnippet container
devicestrNo*NoneDevice container

* Exactly one container required for create operations

Usage Examples

Create Tunnel Interface

from scm.models.network import TunnelInterfaceCreateModel

tunnel = TunnelInterfaceCreateModel(
name="tunnel.1",
comment="Site-to-Site VPN",
ip=["10.254.0.1/30"],
mtu=1400,
folder="Interfaces"
)
payload = tunnel.model_dump(exclude_unset=True)

Unnumbered Tunnel

tunnel = TunnelInterfaceCreateModel(
name="tunnel.2",
comment="GRE Tunnel",
mtu=1476,
folder="Interfaces"
)