dellemc.enterprise_sonic.sonic_interfaces – Configure Interface attributes on interfaces such as, Eth, LAG, VLAN, and loopback. (create a loopback interface if it does not exist.)

Note

This plugin is part of the dellemc.enterprise_sonic collection (version 1.1.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install dellemc.enterprise_sonic.

To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_interfaces.

New in version 1.0.0: of dellemc.enterprise_sonic

Synopsis

  • Configure Interface attributes such as, MTU, admin statu, and so on, on interfaces such as, Eth, LAG, VLAN, and loopback. (create a loopback interface if it does not exist.)

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

config

list / elements=dictionary

A list of interface configurations.

description

string

Description about the interface.

enabled

boolean

Administrative state of the interface.

Choices:

  • no

  • yes

mtu

integer

MTU of the interface.

name

string / required

The name of the interface, for example, ‘Eth1/15’.

state

string

The state the configuration should be left in.

Choices:

  • merged ← (default)

  • deleted

Notes

Note

  • Tested against Enterprise SONiC Distribution by Dell Technologies.

  • Supports check_mode.

Examples

# Using deleted
#
# Before state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name                Description         Admin          Oper           Speed          MTU
#------------------------------------------------------------------------------------------
#Eth1/1           -                   up                            100000         9100
#Eth1/2           -                   up                            100000         9100
#Eth1/3           -                   down                          100000         9100
#Eth1/3           -                   down                          1000           5000
#Eth1/5           -                   down                          100000         9100
#
- name: Configures interfaces
  dellemc.enterprise_sonic.sonic_interfaces:
    config:
      name: Eth1/3
    state: deleted
#
# After state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name                Description         Admin          Oper           Speed          MTU
#------------------------------------------------------------------------------------------
#Eth1/1           -                   up                            100000         9100
#Eth1/2           -                   up                            100000         9100
#Eth1/3           -                   down                          100000         9100
#Eth1/3           -                   up                            100000         9100
#Eth1/5           -                   down                          100000         9100
#
#
# Using deleted
#
# Before state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name                Description         Admin          Oper           Speed          MTU
#------------------------------------------------------------------------------------------
#Eth1/1           -                   up                            100000         9100
#Eth1/2           -                   up                            100000         9100
#Eth1/3           -                   down                          100000         9100
#Eth1/3           -                   down                          1000           9100
#Eth1/5           -                   down                          100000         9100
#

- name: Configures interfaces
  dellemc.enterprise_sonic.sonic_interfaces:
    config:
    state: deleted

#
# After state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name                Description         Admin          Oper           Speed          MTU
#------------------------------------------------------------------------------------------
#Eth1/1           -                   up                            100000         9100
#Eth1/2           -                   up                            100000         9100
#Eth1/3           -                   up                            100000         9100
#Eth1/3           -                   up                            100000         9100
#Eth1/5           -                   up                            100000         9100
#
#
# Using merged
#
# Before state:
# -------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name                Description         Admin          Oper           Speed          MTU
#------------------------------------------------------------------------------------------
#Eth1/1           -                   up                            100000         9100
#Eth1/2           -                   up                            100000         9100
#Eth1/3           -                   down                          100000         9100
#Eth1/3           -                   down                          1000           9100
#
- name: Configures interfaces
  dellemc.enterprise_sonic.sonic_interfaces:
    config:
     - name: Eth1/3
       description: 'Ethernet Twelve'
     - name: Eth1/5
       description: 'Ethernet Sixteen'
       enable: True
       mtu: 3500
    state: merged
#
#
# After state:
# ------------
#
# show interface status | no-more
#------------------------------------------------------------------------------------------
#Name                Description         Admin          Oper           Speed          MTU
#------------------------------------------------------------------------------------------
#Eth1/1           -                   up                            100000         9100
#Eth1/2           -                   up                            100000         9100
#Eth1/3           -                   down                          100000         9100
#Eth1/4           -                   down                          1000           9100
#Eth1/5           -                   down                          100000         3500
#
#

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

list / elements=string

The resulting configuration model invocation.

Returned: when changed

Sample: “The configuration returned is always in the same format of the parameters above.\n”

before

list / elements=string

The configuration prior to the model invocation.

Returned: always

Sample: “The configuration returned is always in the same format of the parameters above.\n”

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: always

Sample: [“command 1”, “command 2”, “command 3”]

Authors

  • Niraimadaiselvam M(@niraimadaiselvamm)