eos_switchport

Synopsis

Added in version 1.0.0

Provides active state management of switchport (layer 2) interface configuration in Arista EOS. Logical switchports are mutually exclusive with eos_ipinterface.

Options

parameter required default choices comments
access_vlan no
    Configures the VLAN associated with a switchport that is configured to use 'access' mode. This parameter only takes effect if mode is equal to 'access'. Valid values for access vlan are in the range of 1 to 4094. The EOS default value for access vlan is 1
    (added in 1.0.0)
    mode no
    • trunk
    • access
    Identifies the mode of operation for the interface. Switchport interfaces can act as trunk interfaces (carrying multiple VLANs) or as access interfaces (attached to a single VLAN). The EOS default value is 'access'
    (added in 1.0.0)
    name yes
      The unique interface identifier name. The interface name must use the full interface name (no abbreviated names). For example, interfaces should be specified as Ethernet1 not Et1
      (added in 1.0.0)
      trunk_allowed_vlans no
        Configures the set of VLANs that are allowed to traverse this switchport interface. This parameter only takes effect if the mode is configured to 'trunk'. This parameter accepts a comma delimited list of VLAN IDs to configure on the trunk port. Each VLAN ID must be in the valid range of 1 to 4094. The EOS default value for trunk allowed vlans is 1-4094.
        (added in 1.0.0)
        trunk_groups no
          Configures the list of trunk groups on the switchport. The parameter accepts a comma separated list of values to be provisioned on the interface.
          (added in 1.1.0)
          trunk_native_vlan no
            Configures the native VLAN on a trunk interface for untagged packets entering the switchport. This parameter only takes effect if mode is equal to 'trunk'. Valid values for trunk native vlan are in the range of 1 to 4094. The EOS default value for trunk native value is 1.
            (added in 1.0.0)

            Important

            Requires Arista EOS 4.13.7M or later with command API enabled

            Important

            Requires Python Client for eAPI 0.3.0 or later

            Examples


            - name: Ensure Ethernet1 is an access port
              eos_switchport: name=Ethernet1 mode=access access_vlan=10
            
            - name: Ensure Ethernet12 is a trunk port
              eos_switchport: name=Ethernet12 mode=trunk trunk_native_vlan=100
            
            - name: Add the set of allowed vlans to Ethernet2/1
              eos_switchport: name=Ethernet2/1 mode=trunk trunk_allowed_vlans=1,10,100
            
            - name: Add trunk group values to an interface
              eos_switchport: name=Ethernet5 trunk_groups=foo,bar,baz
            

            Note

            All configuration is idempotent unless otherwise specified

            Note

            Supports eos metaparameters for using the eAPI transport

            Note

            Supports stateful resource configuration.