dellemc.enterprise_sonic.sonic_l2_interfaces (2.4.0) — module

Configure interface-to-VLAN association that is based on access or trunk mode

| "added in version" 1.0.0 of dellemc.enterprise_sonic"

Authors: Niraimadaiselvam M(@niraimadaiselvamm)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0


Add to requirements.yml

  collections:
    - name: dellemc.enterprise_sonic
      version: 2.4.0

Description

Manages Layer 2 interface attributes of Enterprise SONiC Distribution by Dell Technologies.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Eth1/3
#11         Inactive    T  Eth1/3
#12         Inactive    A  Eth1/4
#13         Inactive    T  Eth1/4
#14         Inactive    A  Eth1/5
#15         Inactive    T  Eth1/5
#
- name: Configures switch port of interfaces
  dellemc.enterprise_sonic.sonic_l2_interfaces:
   config:
     - name: Eth1/3
     - name: Eth1/4
   state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#11         Inactive
#12         Inactive
#13         Inactive
#14         Inactive    A  Eth1/5
#15         Inactive    T  Eth1/5
#
#
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Eth1/3
#11         Inactive    T  Eth1/3
#12         Inactive    A  Eth1/4
#13         Inactive    T  Eth1/4
#14         Inactive    A  Eth1/5
#15         Inactive    T  Eth1/5
#
- name: Configures switch port of interfaces
  dellemc.enterprise_sonic.sonic_l2_interfaces:
    config:
    state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
#
# After state:
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#11         Inactive
#12         Inactive
#13         Inactive
#14         Inactive
#15         Inactive
#
#
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#11         Inactive    T  Ethernet12
#12         Inactive    A  Ethernet12
#13         Inactive    T  Ethernet12
#14         Inactive    T  Ethernet12
#15         Inactive    T  Ethernet12
#16         Inactive    T  Ethernet12

- name: Delete the access vlan and a range of trunk vlans for an interface
  sonic_l2_interfaces:
    config:
      - name: Ethernet12
        access:
          vlan: 12
        trunk:
          allowed_vlans:
             - vlan: 13-16
    state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#11         Inactive    T  Ethernet12
#12         Inactive
#13         Inactive
#14         Inactive
#15         Inactive
#16         Inactive
#
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#11         Inactive    T  Eth1/7
#12         Inactive    T  Eth1/7
#
- name: Configures an access vlan for an interface
  dellemc.enterprise_sonic.sonic_l2_interfaces:
    config:
     - name: Eth1/3
       access:
         vlan: 10
    state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Eth1/3
#11         Inactive    T  Eth1/7
#12         Inactive    T  Eth1/7
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Eth1/3
#12         Inactive
#13         Inactive
#14         Inactive
#15         Inactive
#16         Inactive
#18         Inactive
#
- name: Modify the access vlan, add a range of trunk vlans and a single trunk vlan for an interface
  dellemc.enterprise_sonic.sonic_l2_interfaces:
    config:
     - name: Eth1/3
       access:
         vlan: 12
       trunk:
         allowed_vlans:
            - vlan: 13-16
            - vlan: 18
    state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#12         Inactive    A  Eth1/3
#13         Inactive    T  Eth1/3
#14         Inactive    T  Eth1/3
#15         Inactive    T  Eth1/3
#16         Inactive    T  Eth1/3
#18         Inactive    T  Eth1/3
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#11         Inactive
#12         Inactive    A  Eth1/4
#13         Inactive    T  Eth1/4
#14         Inactive    A  Eth1/5
#15         Inactive    T  Eth1/5
#
- name: Configures switch port of interfaces
  dellemc.enterprise_sonic.sonic_l2_interfaces:
    config:
     - name: Eth1/3
       access:
         vlan: 12
       trunk:
         allowed_vlans:
            - vlan: 13
            - vlan: 14
    state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#11         Inactive
#12         Inactive    A  Eth1/3
#                       A  Eth1/4
#13         Inactive    T  Eth1/3
#                       T  Eth1/4
#14         Inactive    A  Eth1/3
#                       A  Eth1/5
#15         Inactive    T  Eth1/5
#
#
# Using replaced
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Ethernet12
#                       A  Ethernet13
#11         Inactive    T  Ethernet12
#                       T  Ethernet13

- name: Replace access vlan and trunk vlans for specified interfaces
  sonic_l2_interfaces:
    config:
      - name: Ethernet12
        access:
          vlan: 12
        trunk:
          allowed_vlans:
             - vlan: 13-14
      - name: Ethernet14
        access:
          vlan: 10
        trunk:
          allowed_vlans:
             - vlan: 11
             - vlan: 13-14
    state: replaced
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Ethernet13
#                       A  Ethernet14
#11         Inactive    T  Ethernet13
#                       T  Ethernet14
#12         Inactive    A  Ethernet12
#13         Inactive    T  Ethernet12
#                       T  Ethernet14
#14         Inactive    T  Ethernet12
#                       T  Ethernet14
#
#
# Using overridden
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive    A  Ethernet11
#11         Inactive    T  Ethernet11
#12         Inactive    A  Ethernet12
#13         Inactive    T  Ethernet12

- name: Override L2 interfaces configuration in device with provided configuration
  sonic_l2_interfaces:
    config:
      - name: Ethernet13
        access:
          vlan: 12
        trunk:
          allowed_vlans:
             - vlan: 13-14
    state: overridden

Inputs

    
state:
    choices:
    - merged
    - deleted
    - replaced
    - overridden
    default: merged
    description: The state that the configuration should be left in.
    type: str

config:
    description: A list of Layer 2 interface configurations.
    elements: dict
    suboptions:
      access:
        description: Configures access mode characteristics of the interface.
        suboptions:
          vlan:
            description: Configures the specified VLAN in access mode.
            type: int
        type: dict
      name:
        description: Full name of the interface, for example, 'Eth1/26'.
        required: true
        type: str
      trunk:
        description: Configures trunking parameters on an interface.
        suboptions:
          allowed_vlans:
            description: Specifies a list of allowed trunk mode VLANs and VLAN ranges
              for the interface.
            elements: dict
            suboptions:
              vlan:
                description: Configures the specified trunk mode VLAN or VLAN range.
                type: str
            type: list
        type: dict
    type: list

Outputs

after:
  description: The resulting configuration model invocation.
  returned: when changed
  sample: 'The configuration returned is always in the same format of the parameters
    above.

    '
  type: list
before:
  description: The configuration prior to the model invocation.
  returned: always
  sample: "The configuration returned always in the same format\n of the parameters\
    \ above.\n"
  type: list
commands:
  description: The set of commands pushed to the remote device.
  returned: always
  sample:
  - command 1
  - command 2
  - command 3
  type: list